Commit 89ce2216e338f62c411bea12df37a2f54f2ce13a

Authored by Steven Toth
Committed by Mauro Carvalho Chehab
1 parent 12886871ae

V4L/DVB (8646): cx23885: Convert framework to use a single tuner callback function.

Code reduction. Tuner callback now assumes that tsport is passed as the void arg.

Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 3 changed files with 18 additions and 32 deletions Side-by-side Diff

drivers/media/video/cx23885/cx23885-cards.c
... ... @@ -329,11 +329,15 @@
329 329 dev->name, tv.model);
330 330 }
331 331  
332   -static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
333   - int command, int arg)
  332 +int cx23885_tuner_callback(void *priv, int command, int arg)
334 333 {
  334 + struct cx23885_tsport *port = priv;
  335 + struct cx23885_dev *dev = port->dev;
335 336 u32 bitmask = 0;
336 337  
  338 + if (command == XC2028_RESET_CLK)
  339 + return 0;
  340 +
337 341 if (command != 0) {
338 342 printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
339 343 __func__, command);
340 344  
... ... @@ -354,9 +358,9 @@
354 358  
355 359 /* Two identical tuners on two different i2c buses,
356 360 * we need to reset the correct gpio. */
357   - if (port == 0)
  361 + if (port->nr == 0)
358 362 bitmask = 0x01;
359   - else if (port == 1)
  363 + else if (port->nr == 1)
360 364 bitmask = 0x04;
361 365 }
362 366 break;
... ... @@ -370,25 +374,6 @@
370 374 }
371 375  
372 376 return 0;
373   -}
374   -
375   -int cx23885_xc5000_tuner_callback(void *priv, int command, int arg)
376   -{
377   - struct cx23885_i2c *bus = priv;
378   - struct cx23885_dev *dev = bus->dev;
379   -
380   - return cx23885_tuner_callback(dev, bus->nr, command, arg);
381   -}
382   -
383   -int cx23885_xc3028_tuner_callback(void *priv, int command, int arg)
384   -{
385   - struct cx23885_tsport *port = priv;
386   - struct cx23885_dev *dev = port->dev;
387   -
388   - if (command == XC2028_RESET_CLK)
389   - return 0;
390   -
391   - return cx23885_tuner_callback(dev, port->nr, command, arg);
392 377 }
393 378  
394 379 void cx23885_gpio_setup(struct cx23885_dev *dev)
drivers/media/video/cx23885/cx23885-dvb.c
... ... @@ -189,13 +189,13 @@
189 189 static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
190 190 .i2c_address = 0x61,
191 191 .if_khz = 5380,
192   - .tuner_callback = cx23885_xc5000_tuner_callback,
  192 + .tuner_callback = cx23885_tuner_callback,
193 193 };
194 194  
195 195 static struct xc5000_config dvico_xc5000_tunerconfig = {
196 196 .i2c_address = 0x64,
197 197 .if_khz = 5380,
198   - .tuner_callback = cx23885_xc5000_tuner_callback,
  198 + .tuner_callback = cx23885_tuner_callback,
199 199 };
200 200  
201 201 static struct tda829x_config tda829x_no_probe = {
... ... @@ -391,7 +391,7 @@
391 391 if (port->dvb.frontend != NULL)
392 392 dvb_attach(xc5000_attach, port->dvb.frontend,
393 393 &i2c_bus->i2c_adap,
394   - &hauppauge_hvr1500q_tunerconfig, i2c_bus);
  394 + &hauppauge_hvr1500q_tunerconfig, port);
395 395 break;
396 396 case CX23885_BOARD_HAUPPAUGE_HVR1500:
397 397 i2c_bus = &dev->i2c_bus[1];
... ... @@ -403,7 +403,8 @@
403 403 struct xc2028_config cfg = {
404 404 .i2c_adap = &i2c_bus->i2c_adap,
405 405 .i2c_addr = 0x61,
406   - .callback = cx23885_xc3028_tuner_callback,
  406 + .video_dev = port,
  407 + .callback = cx23885_tuner_callback,
407 408 };
408 409 static struct xc2028_ctrl ctl = {
409 410 .fname = "xc3028-v27.fw",
... ... @@ -442,7 +443,8 @@
442 443 struct xc2028_config cfg = {
443 444 .i2c_adap = &dev->i2c_bus[1].i2c_adap,
444 445 .i2c_addr = 0x64,
445   - .callback = cx23885_xc3028_tuner_callback,
  446 + .video_dev = port,
  447 + .callback = cx23885_tuner_callback,
446 448 };
447 449 static struct xc2028_ctrl ctl = {
448 450 .fname = "xc3028L-v36.fw",
... ... @@ -470,7 +472,7 @@
470 472 if (port->dvb.frontend != NULL)
471 473 dvb_attach(xc5000_attach, port->dvb.frontend,
472 474 &i2c_bus->i2c_adap,
473   - &dvico_xc5000_tunerconfig, i2c_bus);
  475 + &dvico_xc5000_tunerconfig, port);
474 476 break;
475 477 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: {
476 478 i2c_bus = &dev->i2c_bus[port->nr - 1];
... ... @@ -484,7 +486,7 @@
484 486 .i2c_adap = &i2c_bus->i2c_adap,
485 487 .i2c_addr = 0x61,
486 488 .video_dev = port,
487   - .callback = cx23885_xc3028_tuner_callback,
  489 + .callback = cx23885_tuner_callback,
488 490 };
489 491 static struct xc2028_ctrl ctl = {
490 492 .fname = "xc3028-v27.fw",
drivers/media/video/cx23885/cx23885.h
... ... @@ -410,8 +410,7 @@
410 410 extern struct cx23885_subid cx23885_subids[];
411 411 extern const unsigned int cx23885_idcount;
412 412  
413   -extern int cx23885_xc5000_tuner_callback(void *priv, int command, int arg);
414   -extern int cx23885_xc3028_tuner_callback(void *priv, int command, int arg);
  413 +extern int cx23885_tuner_callback(void *priv, int command, int arg);
415 414 extern void cx23885_card_list(struct cx23885_dev *dev);
416 415 extern int cx23885_ir_init(struct cx23885_dev *dev);
417 416 extern void cx23885_gpio_setup(struct cx23885_dev *dev);