diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-12-12 05:30:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:05 -0500 |
commit | 8c9fc8de546134d021de58c7ade6f025c9d1da1c (patch) | |
tree | 4ffcc30d257e5d3c375a0932d4d66e42a7e8e7cc /drivers/media | |
parent | f69d419a0bdf4cd2551200b6777a226fea527d1a (diff) |
V4L/DVB (6863): upd64083: CodingStyle cleanups
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/upd64083.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index d467cc34ac4d..2d9a88f70c85 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
@@ -17,7 +17,8 @@ | |||
17 | * | 17 | * |
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21 | * 02110-1301, USA. | ||
21 | */ | 22 | */ |
22 | 23 | ||
23 | #include <linux/version.h> | 24 | #include <linux/version.h> |
@@ -34,7 +35,7 @@ MODULE_DESCRIPTION("uPD64083 driver"); | |||
34 | MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil"); | 35 | MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil"); |
35 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
36 | 37 | ||
37 | static int debug = 0; | 38 | static int debug; |
38 | module_param(debug, bool, 0644); | 39 | module_param(debug, bool, 0644); |
39 | 40 | ||
40 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); | 41 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
@@ -85,7 +86,7 @@ static void upd64083_write(struct i2c_client *client, u8 reg, u8 val) | |||
85 | 86 | ||
86 | buf[0] = reg; | 87 | buf[0] = reg; |
87 | buf[1] = val; | 88 | buf[1] = val; |
88 | v4l_dbg(1, debug, client, "writing reg addr: %02x val: %02x\n", reg, val); | 89 | v4l_dbg(1, debug, client, "write reg: %02x val: %02x\n", reg, val); |
89 | if (i2c_master_send(client, buf, 2) != 2) | 90 | if (i2c_master_send(client, buf, 2) != 2) |
90 | v4l_err(client, "I/O error write 0x%02x/0x%02x\n", reg, val); | 91 | v4l_err(client, "I/O error write 0x%02x/0x%02x\n", reg, val); |
91 | } | 92 | } |
@@ -106,7 +107,7 @@ static u8 upd64083_read(struct i2c_client *client, u8 reg) | |||
106 | 107 | ||
107 | /* ------------------------------------------------------------------------ */ | 108 | /* ------------------------------------------------------------------------ */ |
108 | 109 | ||
109 | static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *arg) | 110 | static int upd64083_command(struct i2c_client *client, unsigned cmd, void *arg) |
110 | { | 111 | { |
111 | struct upd64083_state *state = i2c_get_clientdata(client); | 112 | struct upd64083_state *state = i2c_get_clientdata(client); |
112 | struct v4l2_routing *route = arg; | 113 | struct v4l2_routing *route = arg; |
@@ -142,20 +143,23 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a | |||
142 | { | 143 | { |
143 | struct v4l2_register *reg = arg; | 144 | struct v4l2_register *reg = arg; |
144 | 145 | ||
145 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) | 146 | if (!v4l2_chip_match_i2c_client(client, |
147 | reg->match_type, reg->match_chip)) | ||
146 | return -EINVAL; | 148 | return -EINVAL; |
147 | if (!capable(CAP_SYS_ADMIN)) | 149 | if (!capable(CAP_SYS_ADMIN)) |
148 | return -EPERM; | 150 | return -EPERM; |
149 | if (cmd == VIDIOC_DBG_G_REGISTER) | 151 | if (cmd == VIDIOC_DBG_G_REGISTER) { |
150 | reg->val = upd64083_read(client, reg->reg & 0xff); | 152 | reg->val = upd64083_read(client, reg->reg & 0xff); |
151 | else | 153 | break; |
152 | upd64083_write(client, reg->reg & 0xff, reg->val & 0xff); | 154 | } |
155 | upd64083_write(client, reg->reg & 0xff, reg->val & 0xff); | ||
153 | break; | 156 | break; |
154 | } | 157 | } |
155 | #endif | 158 | #endif |
156 | 159 | ||
157 | case VIDIOC_G_CHIP_IDENT: | 160 | case VIDIOC_G_CHIP_IDENT: |
158 | return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64083, 0); | 161 | return v4l2_chip_ident_i2c_client(client, arg, |
162 | V4L2_IDENT_UPD64083, 0); | ||
159 | 163 | ||
160 | default: | 164 | default: |
161 | break; | 165 | break; |
@@ -176,20 +180,19 @@ static int upd64083_probe(struct i2c_client *client) | |||
176 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 180 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
177 | return -EIO; | 181 | return -EIO; |
178 | 182 | ||
179 | v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); | 183 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
184 | client->addr << 1, client->adapter->name); | ||
180 | 185 | ||
181 | state = kmalloc(sizeof(struct upd64083_state), GFP_KERNEL); | 186 | state = kmalloc(sizeof(struct upd64083_state), GFP_KERNEL); |
182 | if (state == NULL) { | 187 | if (state == NULL) |
183 | return -ENOMEM; | 188 | return -ENOMEM; |
184 | } | ||
185 | i2c_set_clientdata(client, state); | 189 | i2c_set_clientdata(client, state); |
186 | /* Initially assume that a ghost reduction chip is present */ | 190 | /* Initially assume that a ghost reduction chip is present */ |
187 | state->mode = 0; /* YCS mode */ | 191 | state->mode = 0; /* YCS mode */ |
188 | state->ext_y_adc = (1 << 5); | 192 | state->ext_y_adc = (1 << 5); |
189 | memcpy(state->regs, upd64083_init, TOT_REGS); | 193 | memcpy(state->regs, upd64083_init, TOT_REGS); |
190 | for (i = 0; i < TOT_REGS; i++) { | 194 | for (i = 0; i < TOT_REGS; i++) |
191 | upd64083_write(client, i, state->regs[i]); | 195 | upd64083_write(client, i, state->regs[i]); |
192 | } | ||
193 | return 0; | 196 | return 0; |
194 | } | 197 | } |
195 | 198 | ||