aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tvaudio.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-08-15 13:57:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:35 -0400
commitfae91e72b79ba9a21f0ce7551a1fd7e8984c85a6 (patch)
tree1db62e590a010d7ece7f170aedbcc72c8f126122 /drivers/media/video/tvaudio.c
parent5b5439652af79106b792faf79b2c1e787e143ba0 (diff)
[PATCH] I2C: Drop I2C_DEVNAME and i2c_clientname
I2C_DEVNAME and i2c_clientname were introduced in 2.5.68 [1] to help media/video driver authors who wanted their code to be compatible with both Linux 2.4 and 2.6. The cause of the incompatibility has gone since [2], so I think we can get rid of them, as they tend to make the code harder to read and longer to preprocess/compile for no more benefit. I'd hope nobody seriously attempts to keep media/video driver compatible across Linux trees anymore, BTW. [1] http://marc.theaimsgroup.com/?l=linux-kernel&m=104930186524598&w=2 [2] http://www.linuxhq.com/kernel/v2.6/0-test3/include/linux/i2c.h Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/media/video/tvaudio.c')
-rw-r--r--drivers/media/video/tvaudio.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index f6aab89593ea..258724b2d6d2 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -162,24 +162,23 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
162 unsigned char buffer[2]; 162 unsigned char buffer[2];
163 163
164 if (-1 == subaddr) { 164 if (-1 == subaddr) {
165 dprintk("%s: chip_write: 0x%x\n", 165 dprintk("%s: chip_write: 0x%x\n", chip->c.name, val);
166 i2c_clientname(&chip->c), val);
167 chip->shadow.bytes[1] = val; 166 chip->shadow.bytes[1] = val;
168 buffer[0] = val; 167 buffer[0] = val;
169 if (1 != i2c_master_send(&chip->c,buffer,1)) { 168 if (1 != i2c_master_send(&chip->c,buffer,1)) {
170 printk(KERN_WARNING "%s: I/O error (write 0x%x)\n", 169 printk(KERN_WARNING "%s: I/O error (write 0x%x)\n",
171 i2c_clientname(&chip->c), val); 170 chip->c.name, val);
172 return -1; 171 return -1;
173 } 172 }
174 } else { 173 } else {
175 dprintk("%s: chip_write: reg%d=0x%x\n", 174 dprintk("%s: chip_write: reg%d=0x%x\n",
176 i2c_clientname(&chip->c), subaddr, val); 175 chip->c.name, subaddr, val);
177 chip->shadow.bytes[subaddr+1] = val; 176 chip->shadow.bytes[subaddr+1] = val;
178 buffer[0] = subaddr; 177 buffer[0] = subaddr;
179 buffer[1] = val; 178 buffer[1] = val;
180 if (2 != i2c_master_send(&chip->c,buffer,2)) { 179 if (2 != i2c_master_send(&chip->c,buffer,2)) {
181 printk(KERN_WARNING "%s: I/O error (write reg%d=0x%x)\n", 180 printk(KERN_WARNING "%s: I/O error (write reg%d=0x%x)\n",
182 i2c_clientname(&chip->c), subaddr, val); 181 chip->c.name, subaddr, val);
183 return -1; 182 return -1;
184 } 183 }
185 } 184 }
@@ -203,11 +202,10 @@ static int chip_read(struct CHIPSTATE *chip)
203 unsigned char buffer; 202 unsigned char buffer;
204 203
205 if (1 != i2c_master_recv(&chip->c,&buffer,1)) { 204 if (1 != i2c_master_recv(&chip->c,&buffer,1)) {
206 printk(KERN_WARNING "%s: I/O error (read)\n", 205 printk(KERN_WARNING "%s: I/O error (read)\n", chip->c.name);
207 i2c_clientname(&chip->c));
208 return -1; 206 return -1;
209 } 207 }
210 dprintk("%s: chip_read: 0x%x\n",i2c_clientname(&chip->c),buffer); 208 dprintk("%s: chip_read: 0x%x\n", chip->c.name, buffer);
211 return buffer; 209 return buffer;
212} 210}
213 211
@@ -222,12 +220,11 @@ static int chip_read2(struct CHIPSTATE *chip, int subaddr)
222 write[0] = subaddr; 220 write[0] = subaddr;
223 221
224 if (2 != i2c_transfer(chip->c.adapter,msgs,2)) { 222 if (2 != i2c_transfer(chip->c.adapter,msgs,2)) {
225 printk(KERN_WARNING "%s: I/O error (read2)\n", 223 printk(KERN_WARNING "%s: I/O error (read2)\n", chip->c.name);
226 i2c_clientname(&chip->c));
227 return -1; 224 return -1;
228 } 225 }
229 dprintk("%s: chip_read2: reg%d=0x%x\n", 226 dprintk("%s: chip_read2: reg%d=0x%x\n",
230 i2c_clientname(&chip->c),subaddr,read[0]); 227 chip->c.name, subaddr, read[0]);
231 return read[0]; 228 return read[0];
232} 229}
233 230
@@ -240,7 +237,7 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
240 237
241 /* update our shadow register set; print bytes if (debug > 0) */ 238 /* update our shadow register set; print bytes if (debug > 0) */
242 dprintk("%s: chip_cmd(%s): reg=%d, data:", 239 dprintk("%s: chip_cmd(%s): reg=%d, data:",
243 i2c_clientname(&chip->c),name,cmd->bytes[0]); 240 chip->c.name, name, cmd->bytes[0]);
244 for (i = 1; i < cmd->count; i++) { 241 for (i = 1; i < cmd->count; i++) {
245 dprintk(" 0x%x",cmd->bytes[i]); 242 dprintk(" 0x%x",cmd->bytes[i]);
246 chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i]; 243 chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i];
@@ -249,7 +246,7 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
249 246
250 /* send data to the chip */ 247 /* send data to the chip */
251 if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) { 248 if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) {
252 printk(KERN_WARNING "%s: I/O error (%s)\n", i2c_clientname(&chip->c), name); 249 printk(KERN_WARNING "%s: I/O error (%s)\n", chip->c.name, name);
253 return -1; 250 return -1;
254 } 251 }
255 return 0; 252 return 0;
@@ -274,9 +271,9 @@ static int chip_thread(void *data)
274 struct CHIPSTATE *chip = data; 271 struct CHIPSTATE *chip = data;
275 struct CHIPDESC *desc = chiplist + chip->type; 272 struct CHIPDESC *desc = chiplist + chip->type;
276 273
277 daemonize("%s",i2c_clientname(&chip->c)); 274 daemonize("%s", chip->c.name);
278 allow_signal(SIGTERM); 275 allow_signal(SIGTERM);
279 dprintk("%s: thread started\n", i2c_clientname(&chip->c)); 276 dprintk("%s: thread started\n", chip->c.name);
280 277
281 for (;;) { 278 for (;;) {
282 add_wait_queue(&chip->wq, &wait); 279 add_wait_queue(&chip->wq, &wait);
@@ -288,7 +285,7 @@ static int chip_thread(void *data)
288 try_to_freeze(); 285 try_to_freeze();
289 if (chip->done || signal_pending(current)) 286 if (chip->done || signal_pending(current))
290 break; 287 break;
291 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); 288 dprintk("%s: thread wakeup\n", chip->c.name);
292 289
293 /* don't do anything for radio or if mode != auto */ 290 /* don't do anything for radio or if mode != auto */
294 if (chip->norm == VIDEO_MODE_RADIO || chip->mode != 0) 291 if (chip->norm == VIDEO_MODE_RADIO || chip->mode != 0)
@@ -301,7 +298,7 @@ static int chip_thread(void *data)
301 mod_timer(&chip->wt, jiffies+2*HZ); 298 mod_timer(&chip->wt, jiffies+2*HZ);
302 } 299 }
303 300
304 dprintk("%s: thread exiting\n", i2c_clientname(&chip->c)); 301 dprintk("%s: thread exiting\n", chip->c.name);
305 complete_and_exit(&chip->texit, 0); 302 complete_and_exit(&chip->texit, 0);
306 return 0; 303 return 0;
307} 304}
@@ -314,7 +311,7 @@ static void generic_checkmode(struct CHIPSTATE *chip)
314 if (mode == chip->prevmode) 311 if (mode == chip->prevmode)
315 return; 312 return;
316 313
317 dprintk("%s: thread checkmode\n", i2c_clientname(&chip->c)); 314 dprintk("%s: thread checkmode\n", chip->c.name);
318 chip->prevmode = mode; 315 chip->prevmode = mode;
319 316
320 if (mode & VIDEO_SOUND_STEREO) 317 if (mode & VIDEO_SOUND_STEREO)
@@ -1501,7 +1498,7 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1501 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); 1498 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : "");
1502 1499
1503 /* fill required data structures */ 1500 /* fill required data structures */
1504 strcpy(i2c_clientname(&chip->c),desc->name); 1501 strcpy(chip->c.name, desc->name);
1505 chip->type = desc-chiplist; 1502 chip->type = desc-chiplist;
1506 chip->shadow.count = desc->registers+1; 1503 chip->shadow.count = desc->registers+1;
1507 chip->prevmode = -1; 1504 chip->prevmode = -1;
@@ -1538,7 +1535,7 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1538 chip->tpid = kernel_thread(chip_thread,(void *)chip,0); 1535 chip->tpid = kernel_thread(chip_thread,(void *)chip,0);
1539 if (chip->tpid < 0) 1536 if (chip->tpid < 0)
1540 printk(KERN_WARNING "%s: kernel_thread() failed\n", 1537 printk(KERN_WARNING "%s: kernel_thread() failed\n",
1541 i2c_clientname(&chip->c)); 1538 chip->c.name);
1542 wake_up_interruptible(&chip->wq); 1539 wake_up_interruptible(&chip->wq);
1543 } 1540 }
1544 return 0; 1541 return 0;
@@ -1591,7 +1588,7 @@ static int chip_command(struct i2c_client *client,
1591 struct CHIPSTATE *chip = i2c_get_clientdata(client); 1588 struct CHIPSTATE *chip = i2c_get_clientdata(client);
1592 struct CHIPDESC *desc = chiplist + chip->type; 1589 struct CHIPDESC *desc = chiplist + chip->type;
1593 1590
1594 dprintk("%s: chip_command 0x%x\n",i2c_clientname(&chip->c),cmd); 1591 dprintk("%s: chip_command 0x%x\n", chip->c.name, cmd);
1595 1592
1596 switch (cmd) { 1593 switch (cmd) {
1597 case AUDC_SET_INPUT: 1594 case AUDC_SET_INPUT:
@@ -1702,7 +1699,7 @@ static struct i2c_driver driver = {
1702 1699
1703static struct i2c_client client_template = 1700static struct i2c_client client_template =
1704{ 1701{
1705 I2C_DEVNAME("(unset)"), 1702 .name = "(unset)",
1706 .flags = I2C_CLIENT_ALLOW_USE, 1703 .flags = I2C_CLIENT_ALLOW_USE,
1707 .driver = &driver, 1704 .driver = &driver,
1708}; 1705};