diff options
author | Igor M. Liplianin <liplianin@me.by> | 2010-01-17 10:11:00 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:42 -0500 |
commit | 34d2f9bf189c36ef8642cf6b64e80dfb756d888f (patch) | |
tree | 26c62895383ec0e84b07bf50f056db7551b40c6c /drivers/media/dvb/dm1105 | |
parent | ed7c847aef137a5e1f5de0eac0ad2c03e183839d (diff) |
V4L/DVB: dm1105: use dm1105_dev & dev instead of dm1105dvb
This is for better readability and smaller size of code.
Also it is similar to other drivers.
Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dm1105')
-rw-r--r-- | drivers/media/dvb/dm1105/dm1105.c | 357 |
1 files changed, 178 insertions, 179 deletions
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index cc6577c4c12b..abc26adec2a8 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c | |||
@@ -270,7 +270,7 @@ struct infrared { | |||
270 | u32 ir_command; | 270 | u32 ir_command; |
271 | }; | 271 | }; |
272 | 272 | ||
273 | struct dm1105dvb { | 273 | struct dm1105_dev { |
274 | /* pci */ | 274 | /* pci */ |
275 | struct pci_dev *pdev; | 275 | struct pci_dev *pdev; |
276 | u8 __iomem *io_mem; | 276 | u8 __iomem *io_mem; |
@@ -309,17 +309,17 @@ struct dm1105dvb { | |||
309 | spinlock_t lock; | 309 | spinlock_t lock; |
310 | }; | 310 | }; |
311 | 311 | ||
312 | #define dm_io_mem(reg) ((unsigned long)(&dm1105dvb->io_mem[reg])) | 312 | #define dm_io_mem(reg) ((unsigned long)(&dev->io_mem[reg])) |
313 | 313 | ||
314 | static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap, | 314 | static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap, |
315 | struct i2c_msg *msgs, int num) | 315 | struct i2c_msg *msgs, int num) |
316 | { | 316 | { |
317 | struct dm1105dvb *dm1105dvb ; | 317 | struct dm1105_dev *dev ; |
318 | 318 | ||
319 | int addr, rc, i, j, k, len, byte, data; | 319 | int addr, rc, i, j, k, len, byte, data; |
320 | u8 status; | 320 | u8 status; |
321 | 321 | ||
322 | dm1105dvb = i2c_adap->algo_data; | 322 | dev = i2c_adap->algo_data; |
323 | for (i = 0; i < num; i++) { | 323 | for (i = 0; i < num; i++) { |
324 | outb(0x00, dm_io_mem(DM1105_I2CCTR)); | 324 | outb(0x00, dm_io_mem(DM1105_I2CCTR)); |
325 | if (msgs[i].flags & I2C_M_RD) { | 325 | if (msgs[i].flags & I2C_M_RD) { |
@@ -406,22 +406,22 @@ static struct i2c_algorithm dm1105_algo = { | |||
406 | .functionality = functionality, | 406 | .functionality = functionality, |
407 | }; | 407 | }; |
408 | 408 | ||
409 | static inline struct dm1105dvb *feed_to_dm1105dvb(struct dvb_demux_feed *feed) | 409 | static inline struct dm1105_dev *feed_to_dm1105_dev(struct dvb_demux_feed *feed) |
410 | { | 410 | { |
411 | return container_of(feed->demux, struct dm1105dvb, demux); | 411 | return container_of(feed->demux, struct dm1105_dev, demux); |
412 | } | 412 | } |
413 | 413 | ||
414 | static inline struct dm1105dvb *frontend_to_dm1105dvb(struct dvb_frontend *fe) | 414 | static inline struct dm1105_dev *frontend_to_dm1105_dev(struct dvb_frontend *fe) |
415 | { | 415 | { |
416 | return container_of(fe->dvb, struct dm1105dvb, dvb_adapter); | 416 | return container_of(fe->dvb, struct dm1105_dev, dvb_adapter); |
417 | } | 417 | } |
418 | 418 | ||
419 | static int dm1105dvb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 419 | static int dm1105_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
420 | { | 420 | { |
421 | struct dm1105dvb *dm1105dvb = frontend_to_dm1105dvb(fe); | 421 | struct dm1105_dev *dev = frontend_to_dm1105_dev(fe); |
422 | u32 lnb_mask, lnb_13v, lnb_18v, lnb_off; | 422 | u32 lnb_mask, lnb_13v, lnb_18v, lnb_off; |
423 | 423 | ||
424 | switch (dm1105dvb->boardnr) { | 424 | switch (dev->boardnr) { |
425 | case DM1105_BOARD_AXESS_DM05: | 425 | case DM1105_BOARD_AXESS_DM05: |
426 | lnb_mask = DM05_LNB_MASK; | 426 | lnb_mask = DM05_LNB_MASK; |
427 | lnb_off = DM05_LNB_OFF; | 427 | lnb_off = DM05_LNB_OFF; |
@@ -448,51 +448,56 @@ static int dm1105dvb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t volta | |||
448 | return 0; | 448 | return 0; |
449 | } | 449 | } |
450 | 450 | ||
451 | static void dm1105dvb_set_dma_addr(struct dm1105dvb *dm1105dvb) | 451 | static void dm1105_set_dma_addr(struct dm1105_dev *dev) |
452 | { | 452 | { |
453 | outl(cpu_to_le32(dm1105dvb->dma_addr), dm_io_mem(DM1105_STADR)); | 453 | outl(cpu_to_le32(dev->dma_addr), dm_io_mem(DM1105_STADR)); |
454 | } | 454 | } |
455 | 455 | ||
456 | static int __devinit dm1105dvb_dma_map(struct dm1105dvb *dm1105dvb) | 456 | static int __devinit dm1105_dma_map(struct dm1105_dev *dev) |
457 | { | 457 | { |
458 | dm1105dvb->ts_buf = pci_alloc_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, &dm1105dvb->dma_addr); | 458 | dev->ts_buf = pci_alloc_consistent(dev->pdev, |
459 | 6 * DM1105_DMA_BYTES, | ||
460 | &dev->dma_addr); | ||
459 | 461 | ||
460 | return !dm1105dvb->ts_buf; | 462 | return !dev->ts_buf; |
461 | } | 463 | } |
462 | 464 | ||
463 | static void dm1105dvb_dma_unmap(struct dm1105dvb *dm1105dvb) | 465 | static void dm1105_dma_unmap(struct dm1105_dev *dev) |
464 | { | 466 | { |
465 | pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr); | 467 | pci_free_consistent(dev->pdev, |
468 | 6 * DM1105_DMA_BYTES, | ||
469 | dev->ts_buf, | ||
470 | dev->dma_addr); | ||
466 | } | 471 | } |
467 | 472 | ||
468 | static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb) | 473 | static void dm1105_enable_irqs(struct dm1105_dev *dev) |
469 | { | 474 | { |
470 | outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK)); | 475 | outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK)); |
471 | outb(1, dm_io_mem(DM1105_CR)); | 476 | outb(1, dm_io_mem(DM1105_CR)); |
472 | } | 477 | } |
473 | 478 | ||
474 | static void dm1105dvb_disable_irqs(struct dm1105dvb *dm1105dvb) | 479 | static void dm1105_disable_irqs(struct dm1105_dev *dev) |
475 | { | 480 | { |
476 | outb(INTMAK_IRM, dm_io_mem(DM1105_INTMAK)); | 481 | outb(INTMAK_IRM, dm_io_mem(DM1105_INTMAK)); |
477 | outb(0, dm_io_mem(DM1105_CR)); | 482 | outb(0, dm_io_mem(DM1105_CR)); |
478 | } | 483 | } |
479 | 484 | ||
480 | static int dm1105dvb_start_feed(struct dvb_demux_feed *f) | 485 | static int dm1105_start_feed(struct dvb_demux_feed *f) |
481 | { | 486 | { |
482 | struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f); | 487 | struct dm1105_dev *dev = feed_to_dm1105_dev(f); |
483 | 488 | ||
484 | if (dm1105dvb->full_ts_users++ == 0) | 489 | if (dev->full_ts_users++ == 0) |
485 | dm1105dvb_enable_irqs(dm1105dvb); | 490 | dm1105_enable_irqs(dev); |
486 | 491 | ||
487 | return 0; | 492 | return 0; |
488 | } | 493 | } |
489 | 494 | ||
490 | static int dm1105dvb_stop_feed(struct dvb_demux_feed *f) | 495 | static int dm1105_stop_feed(struct dvb_demux_feed *f) |
491 | { | 496 | { |
492 | struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f); | 497 | struct dm1105_dev *dev = feed_to_dm1105_dev(f); |
493 | 498 | ||
494 | if (--dm1105dvb->full_ts_users == 0) | 499 | if (--dev->full_ts_users == 0) |
495 | dm1105dvb_disable_irqs(dm1105dvb); | 500 | dm1105_disable_irqs(dev); |
496 | 501 | ||
497 | return 0; | 502 | return 0; |
498 | } | 503 | } |
@@ -516,42 +521,39 @@ static void dm1105_emit_key(struct work_struct *work) | |||
516 | /* work handler */ | 521 | /* work handler */ |
517 | static void dm1105_dmx_buffer(struct work_struct *work) | 522 | static void dm1105_dmx_buffer(struct work_struct *work) |
518 | { | 523 | { |
519 | struct dm1105dvb *dm1105dvb = | 524 | struct dm1105_dev *dev = container_of(work, struct dm1105_dev, work); |
520 | container_of(work, struct dm1105dvb, work); | ||
521 | unsigned int nbpackets; | 525 | unsigned int nbpackets; |
522 | u32 oldwrp = dm1105dvb->wrp; | 526 | u32 oldwrp = dev->wrp; |
523 | u32 nextwrp = dm1105dvb->nextwrp; | 527 | u32 nextwrp = dev->nextwrp; |
524 | 528 | ||
525 | if (!((dm1105dvb->ts_buf[oldwrp] == 0x47) && | 529 | if (!((dev->ts_buf[oldwrp] == 0x47) && |
526 | (dm1105dvb->ts_buf[oldwrp + 188] == 0x47) && | 530 | (dev->ts_buf[oldwrp + 188] == 0x47) && |
527 | (dm1105dvb->ts_buf[oldwrp + 188 * 2] == 0x47))) { | 531 | (dev->ts_buf[oldwrp + 188 * 2] == 0x47))) { |
528 | dm1105dvb->PacketErrorCount++; | 532 | dev->PacketErrorCount++; |
529 | /* bad packet found */ | 533 | /* bad packet found */ |
530 | if ((dm1105dvb->PacketErrorCount >= 2) && | 534 | if ((dev->PacketErrorCount >= 2) && |
531 | (dm1105dvb->dmarst == 0)) { | 535 | (dev->dmarst == 0)) { |
532 | outb(1, dm_io_mem(DM1105_RST)); | 536 | outb(1, dm_io_mem(DM1105_RST)); |
533 | dm1105dvb->wrp = 0; | 537 | dev->wrp = 0; |
534 | dm1105dvb->PacketErrorCount = 0; | 538 | dev->PacketErrorCount = 0; |
535 | dm1105dvb->dmarst = 0; | 539 | dev->dmarst = 0; |
536 | return; | 540 | return; |
537 | } | 541 | } |
538 | } | 542 | } |
539 | 543 | ||
540 | if (nextwrp < oldwrp) { | 544 | if (nextwrp < oldwrp) { |
541 | memcpy(dm1105dvb->ts_buf + dm1105dvb->buffer_size, | 545 | memcpy(dev->ts_buf + dev->buffer_size, dev->ts_buf, nextwrp); |
542 | dm1105dvb->ts_buf, nextwrp); | 546 | nbpackets = ((dev->buffer_size - oldwrp) + nextwrp) / 188; |
543 | nbpackets = ((dm1105dvb->buffer_size - oldwrp) + nextwrp) / 188; | ||
544 | } else | 547 | } else |
545 | nbpackets = (nextwrp - oldwrp) / 188; | 548 | nbpackets = (nextwrp - oldwrp) / 188; |
546 | 549 | ||
547 | dm1105dvb->wrp = nextwrp; | 550 | dev->wrp = nextwrp; |
548 | dvb_dmx_swfilter_packets(&dm1105dvb->demux, | 551 | dvb_dmx_swfilter_packets(&dev->demux, &dev->ts_buf[oldwrp], nbpackets); |
549 | &dm1105dvb->ts_buf[oldwrp], nbpackets); | ||
550 | } | 552 | } |
551 | 553 | ||
552 | static irqreturn_t dm1105dvb_irq(int irq, void *dev_id) | 554 | static irqreturn_t dm1105_irq(int irq, void *dev_id) |
553 | { | 555 | { |
554 | struct dm1105dvb *dm1105dvb = dev_id; | 556 | struct dm1105_dev *dev = dev_id; |
555 | 557 | ||
556 | /* Read-Write INSTS Ack's Interrupt for DM1105 chip 16.03.2008 */ | 558 | /* Read-Write INSTS Ack's Interrupt for DM1105 chip 16.03.2008 */ |
557 | unsigned int intsts = inb(dm_io_mem(DM1105_INTSTS)); | 559 | unsigned int intsts = inb(dm_io_mem(DM1105_INTSTS)); |
@@ -560,20 +562,20 @@ static irqreturn_t dm1105dvb_irq(int irq, void *dev_id) | |||
560 | switch (intsts) { | 562 | switch (intsts) { |
561 | case INTSTS_TSIRQ: | 563 | case INTSTS_TSIRQ: |
562 | case (INTSTS_TSIRQ | INTSTS_IR): | 564 | case (INTSTS_TSIRQ | INTSTS_IR): |
563 | dm1105dvb->nextwrp = inl(dm_io_mem(DM1105_WRP)) - | 565 | dev->nextwrp = inl(dm_io_mem(DM1105_WRP)) - |
564 | inl(dm_io_mem(DM1105_STADR)); | 566 | inl(dm_io_mem(DM1105_STADR)); |
565 | queue_work(dm1105dvb->wq, &dm1105dvb->work); | 567 | queue_work(dev->wq, &dev->work); |
566 | break; | 568 | break; |
567 | case INTSTS_IR: | 569 | case INTSTS_IR: |
568 | dm1105dvb->ir.ir_command = inl(dm_io_mem(DM1105_IRCODE)); | 570 | dev->ir.ir_command = inl(dm_io_mem(DM1105_IRCODE)); |
569 | schedule_work(&dm1105dvb->ir.work); | 571 | schedule_work(&dev->ir.work); |
570 | break; | 572 | break; |
571 | } | 573 | } |
572 | 574 | ||
573 | return IRQ_HANDLED; | 575 | return IRQ_HANDLED; |
574 | } | 576 | } |
575 | 577 | ||
576 | int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) | 578 | int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) |
577 | { | 579 | { |
578 | struct input_dev *input_dev; | 580 | struct input_dev *input_dev; |
579 | struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; | 581 | struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; |
@@ -615,14 +617,14 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) | |||
615 | return err; | 617 | return err; |
616 | } | 618 | } |
617 | 619 | ||
618 | void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105) | 620 | void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) |
619 | { | 621 | { |
620 | ir_input_unregister(dm1105->ir.input_dev); | 622 | ir_input_unregister(dm1105->ir.input_dev); |
621 | } | 623 | } |
622 | 624 | ||
623 | static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb) | 625 | static int __devinit dm1105_hw_init(struct dm1105_dev *dev) |
624 | { | 626 | { |
625 | dm1105dvb_disable_irqs(dm1105dvb); | 627 | dm1105_disable_irqs(dev); |
626 | 628 | ||
627 | outb(0, dm_io_mem(DM1105_HOST_CTR)); | 629 | outb(0, dm_io_mem(DM1105_HOST_CTR)); |
628 | 630 | ||
@@ -632,8 +634,8 @@ static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb) | |||
632 | outw(0xc10a, dm_io_mem(DM1105_TSCTR)); | 634 | outw(0xc10a, dm_io_mem(DM1105_TSCTR)); |
633 | 635 | ||
634 | /* map DMA and set address */ | 636 | /* map DMA and set address */ |
635 | dm1105dvb_dma_map(dm1105dvb); | 637 | dm1105_dma_map(dev); |
636 | dm1105dvb_set_dma_addr(dm1105dvb); | 638 | dm1105_set_dma_addr(dev); |
637 | /* big buffer */ | 639 | /* big buffer */ |
638 | outl(5*DM1105_DMA_BYTES, dm_io_mem(DM1105_RLEN)); | 640 | outl(5*DM1105_DMA_BYTES, dm_io_mem(DM1105_RLEN)); |
639 | outb(47, dm_io_mem(DM1105_INTCNT)); | 641 | outb(47, dm_io_mem(DM1105_INTCNT)); |
@@ -646,15 +648,15 @@ static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb) | |||
646 | return 0; | 648 | return 0; |
647 | } | 649 | } |
648 | 650 | ||
649 | static void dm1105dvb_hw_exit(struct dm1105dvb *dm1105dvb) | 651 | static void dm1105_hw_exit(struct dm1105_dev *dev) |
650 | { | 652 | { |
651 | dm1105dvb_disable_irqs(dm1105dvb); | 653 | dm1105_disable_irqs(dev); |
652 | 654 | ||
653 | /* IR disable */ | 655 | /* IR disable */ |
654 | outb(0, dm_io_mem(DM1105_IRCTR)); | 656 | outb(0, dm_io_mem(DM1105_IRCTR)); |
655 | outb(INTMAK_NONEMASK, dm_io_mem(DM1105_INTMAK)); | 657 | outb(INTMAK_NONEMASK, dm_io_mem(DM1105_INTMAK)); |
656 | 658 | ||
657 | dm1105dvb_dma_unmap(dm1105dvb); | 659 | dm1105_dma_unmap(dev); |
658 | } | 660 | } |
659 | 661 | ||
660 | static struct stv0299_config sharp_z0194a_config = { | 662 | static struct stv0299_config sharp_z0194a_config = { |
@@ -688,78 +690,75 @@ static struct ds3000_config dvbworld_ds3000_config = { | |||
688 | .demod_address = 0x68, | 690 | .demod_address = 0x68, |
689 | }; | 691 | }; |
690 | 692 | ||
691 | static int __devinit frontend_init(struct dm1105dvb *dm1105dvb) | 693 | static int __devinit frontend_init(struct dm1105_dev *dev) |
692 | { | 694 | { |
693 | int ret; | 695 | int ret; |
694 | 696 | ||
695 | switch (dm1105dvb->boardnr) { | 697 | switch (dev->boardnr) { |
696 | case DM1105_BOARD_DVBWORLD_2004: | 698 | case DM1105_BOARD_DVBWORLD_2004: |
697 | dm1105dvb->fe = dvb_attach( | 699 | dev->fe = dvb_attach( |
698 | cx24116_attach, &serit_sp2633_config, | 700 | cx24116_attach, &serit_sp2633_config, |
699 | &dm1105dvb->i2c_adap); | 701 | &dev->i2c_adap); |
700 | if (dm1105dvb->fe) { | 702 | if (dev->fe) { |
701 | dm1105dvb->fe->ops.set_voltage = dm1105dvb_set_voltage; | 703 | dev->fe->ops.set_voltage = dm1105_set_voltage; |
702 | break; | 704 | break; |
703 | } | 705 | } |
704 | 706 | ||
705 | dm1105dvb->fe = dvb_attach( | 707 | dev->fe = dvb_attach( |
706 | ds3000_attach, &dvbworld_ds3000_config, | 708 | ds3000_attach, &dvbworld_ds3000_config, |
707 | &dm1105dvb->i2c_adap); | 709 | &dev->i2c_adap); |
708 | if (dm1105dvb->fe) | 710 | if (dev->fe) |
709 | dm1105dvb->fe->ops.set_voltage = dm1105dvb_set_voltage; | 711 | dev->fe->ops.set_voltage = dm1105_set_voltage; |
710 | 712 | ||
711 | break; | 713 | break; |
712 | case DM1105_BOARD_DVBWORLD_2002: | 714 | case DM1105_BOARD_DVBWORLD_2002: |
713 | case DM1105_BOARD_AXESS_DM05: | 715 | case DM1105_BOARD_AXESS_DM05: |
714 | default: | 716 | default: |
715 | dm1105dvb->fe = dvb_attach( | 717 | dev->fe = dvb_attach( |
716 | stv0299_attach, &sharp_z0194a_config, | 718 | stv0299_attach, &sharp_z0194a_config, |
717 | &dm1105dvb->i2c_adap); | 719 | &dev->i2c_adap); |
718 | if (dm1105dvb->fe) { | 720 | if (dev->fe) { |
719 | dm1105dvb->fe->ops.set_voltage = | 721 | dev->fe->ops.set_voltage = dm1105_set_voltage; |
720 | dm1105dvb_set_voltage; | 722 | dvb_attach(dvb_pll_attach, dev->fe, 0x60, |
721 | dvb_attach(dvb_pll_attach, dm1105dvb->fe, 0x60, | 723 | &dev->i2c_adap, DVB_PLL_OPERA1); |
722 | &dm1105dvb->i2c_adap, DVB_PLL_OPERA1); | ||
723 | break; | 724 | break; |
724 | } | 725 | } |
725 | 726 | ||
726 | dm1105dvb->fe = dvb_attach( | 727 | dev->fe = dvb_attach( |
727 | stv0288_attach, &earda_config, | 728 | stv0288_attach, &earda_config, |
728 | &dm1105dvb->i2c_adap); | 729 | &dev->i2c_adap); |
729 | if (dm1105dvb->fe) { | 730 | if (dev->fe) { |
730 | dm1105dvb->fe->ops.set_voltage = | 731 | dev->fe->ops.set_voltage = dm1105_set_voltage; |
731 | dm1105dvb_set_voltage; | 732 | dvb_attach(stb6000_attach, dev->fe, 0x61, |
732 | dvb_attach(stb6000_attach, dm1105dvb->fe, 0x61, | 733 | &dev->i2c_adap); |
733 | &dm1105dvb->i2c_adap); | ||
734 | break; | 734 | break; |
735 | } | 735 | } |
736 | 736 | ||
737 | dm1105dvb->fe = dvb_attach( | 737 | dev->fe = dvb_attach( |
738 | si21xx_attach, &serit_config, | 738 | si21xx_attach, &serit_config, |
739 | &dm1105dvb->i2c_adap); | 739 | &dev->i2c_adap); |
740 | if (dm1105dvb->fe) | 740 | if (dev->fe) |
741 | dm1105dvb->fe->ops.set_voltage = | 741 | dev->fe->ops.set_voltage = dm1105_set_voltage; |
742 | dm1105dvb_set_voltage; | ||
743 | 742 | ||
744 | } | 743 | } |
745 | 744 | ||
746 | if (!dm1105dvb->fe) { | 745 | if (!dev->fe) { |
747 | dev_err(&dm1105dvb->pdev->dev, "could not attach frontend\n"); | 746 | dev_err(&dev->pdev->dev, "could not attach frontend\n"); |
748 | return -ENODEV; | 747 | return -ENODEV; |
749 | } | 748 | } |
750 | 749 | ||
751 | ret = dvb_register_frontend(&dm1105dvb->dvb_adapter, dm1105dvb->fe); | 750 | ret = dvb_register_frontend(&dev->dvb_adapter, dev->fe); |
752 | if (ret < 0) { | 751 | if (ret < 0) { |
753 | if (dm1105dvb->fe->ops.release) | 752 | if (dev->fe->ops.release) |
754 | dm1105dvb->fe->ops.release(dm1105dvb->fe); | 753 | dev->fe->ops.release(dev->fe); |
755 | dm1105dvb->fe = NULL; | 754 | dev->fe = NULL; |
756 | return ret; | 755 | return ret; |
757 | } | 756 | } |
758 | 757 | ||
759 | return 0; | 758 | return 0; |
760 | } | 759 | } |
761 | 760 | ||
762 | static void __devinit dm1105dvb_read_mac(struct dm1105dvb *dm1105dvb, u8 *mac) | 761 | static void __devinit dm1105_read_mac(struct dm1105_dev *dev, u8 *mac) |
763 | { | 762 | { |
764 | static u8 command[1] = { 0x28 }; | 763 | static u8 command[1] = { 0x28 }; |
765 | 764 | ||
@@ -777,47 +776,47 @@ static void __devinit dm1105dvb_read_mac(struct dm1105dvb *dm1105dvb, u8 *mac) | |||
777 | }, | 776 | }, |
778 | }; | 777 | }; |
779 | 778 | ||
780 | dm1105_i2c_xfer(&dm1105dvb->i2c_adap, msg , 2); | 779 | dm1105_i2c_xfer(&dev->i2c_adap, msg , 2); |
781 | dev_info(&dm1105dvb->pdev->dev, "MAC %pM\n", mac); | 780 | dev_info(&dev->pdev->dev, "MAC %pM\n", mac); |
782 | } | 781 | } |
783 | 782 | ||
784 | static int __devinit dm1105_probe(struct pci_dev *pdev, | 783 | static int __devinit dm1105_probe(struct pci_dev *pdev, |
785 | const struct pci_device_id *ent) | 784 | const struct pci_device_id *ent) |
786 | { | 785 | { |
787 | struct dm1105dvb *dm1105dvb; | 786 | struct dm1105_dev *dev; |
788 | struct dvb_adapter *dvb_adapter; | 787 | struct dvb_adapter *dvb_adapter; |
789 | struct dvb_demux *dvbdemux; | 788 | struct dvb_demux *dvbdemux; |
790 | struct dmx_demux *dmx; | 789 | struct dmx_demux *dmx; |
791 | int ret = -ENOMEM; | 790 | int ret = -ENOMEM; |
792 | int i; | 791 | int i; |
793 | 792 | ||
794 | dm1105dvb = kzalloc(sizeof(struct dm1105dvb), GFP_KERNEL); | 793 | dev = kzalloc(sizeof(struct dm1105_dev), GFP_KERNEL); |
795 | if (!dm1105dvb) | 794 | if (!dev) |
796 | return -ENOMEM; | 795 | return -ENOMEM; |
797 | 796 | ||
798 | /* board config */ | 797 | /* board config */ |
799 | dm1105dvb->nr = dm1105_devcount; | 798 | dev->nr = dm1105_devcount; |
800 | dm1105dvb->boardnr = UNSET; | 799 | dev->boardnr = UNSET; |
801 | if (card[dm1105dvb->nr] < ARRAY_SIZE(dm1105_boards)) | 800 | if (card[dev->nr] < ARRAY_SIZE(dm1105_boards)) |
802 | dm1105dvb->boardnr = card[dm1105dvb->nr]; | 801 | dev->boardnr = card[dev->nr]; |
803 | for (i = 0; UNSET == dm1105dvb->boardnr && | 802 | for (i = 0; UNSET == dev->boardnr && |
804 | i < ARRAY_SIZE(dm1105_subids); i++) | 803 | i < ARRAY_SIZE(dm1105_subids); i++) |
805 | if (pdev->subsystem_vendor == | 804 | if (pdev->subsystem_vendor == |
806 | dm1105_subids[i].subvendor && | 805 | dm1105_subids[i].subvendor && |
807 | pdev->subsystem_device == | 806 | pdev->subsystem_device == |
808 | dm1105_subids[i].subdevice) | 807 | dm1105_subids[i].subdevice) |
809 | dm1105dvb->boardnr = dm1105_subids[i].card; | 808 | dev->boardnr = dm1105_subids[i].card; |
810 | 809 | ||
811 | if (UNSET == dm1105dvb->boardnr) { | 810 | if (UNSET == dev->boardnr) { |
812 | dm1105dvb->boardnr = DM1105_BOARD_UNKNOWN; | 811 | dev->boardnr = DM1105_BOARD_UNKNOWN; |
813 | dm1105_card_list(pdev); | 812 | dm1105_card_list(pdev); |
814 | } | 813 | } |
815 | 814 | ||
816 | dm1105_devcount++; | 815 | dm1105_devcount++; |
817 | dm1105dvb->pdev = pdev; | 816 | dev->pdev = pdev; |
818 | dm1105dvb->buffer_size = 5 * DM1105_DMA_BYTES; | 817 | dev->buffer_size = 5 * DM1105_DMA_BYTES; |
819 | dm1105dvb->PacketErrorCount = 0; | 818 | dev->PacketErrorCount = 0; |
820 | dm1105dvb->dmarst = 0; | 819 | dev->dmarst = 0; |
821 | 820 | ||
822 | ret = pci_enable_device(pdev); | 821 | ret = pci_enable_device(pdev); |
823 | if (ret < 0) | 822 | if (ret < 0) |
@@ -833,47 +832,47 @@ static int __devinit dm1105_probe(struct pci_dev *pdev, | |||
833 | if (ret < 0) | 832 | if (ret < 0) |
834 | goto err_pci_disable_device; | 833 | goto err_pci_disable_device; |
835 | 834 | ||
836 | dm1105dvb->io_mem = pci_iomap(pdev, 0, pci_resource_len(pdev, 0)); | 835 | dev->io_mem = pci_iomap(pdev, 0, pci_resource_len(pdev, 0)); |
837 | if (!dm1105dvb->io_mem) { | 836 | if (!dev->io_mem) { |
838 | ret = -EIO; | 837 | ret = -EIO; |
839 | goto err_pci_release_regions; | 838 | goto err_pci_release_regions; |
840 | } | 839 | } |
841 | 840 | ||
842 | spin_lock_init(&dm1105dvb->lock); | 841 | spin_lock_init(&dev->lock); |
843 | pci_set_drvdata(pdev, dm1105dvb); | 842 | pci_set_drvdata(pdev, dev); |
844 | 843 | ||
845 | ret = dm1105dvb_hw_init(dm1105dvb); | 844 | ret = dm1105_hw_init(dev); |
846 | if (ret < 0) | 845 | if (ret < 0) |
847 | goto err_pci_iounmap; | 846 | goto err_pci_iounmap; |
848 | 847 | ||
849 | /* i2c */ | 848 | /* i2c */ |
850 | i2c_set_adapdata(&dm1105dvb->i2c_adap, dm1105dvb); | 849 | i2c_set_adapdata(&dev->i2c_adap, dev); |
851 | strcpy(dm1105dvb->i2c_adap.name, DRIVER_NAME); | 850 | strcpy(dev->i2c_adap.name, DRIVER_NAME); |
852 | dm1105dvb->i2c_adap.owner = THIS_MODULE; | 851 | dev->i2c_adap.owner = THIS_MODULE; |
853 | dm1105dvb->i2c_adap.class = I2C_CLASS_TV_DIGITAL; | 852 | dev->i2c_adap.class = I2C_CLASS_TV_DIGITAL; |
854 | dm1105dvb->i2c_adap.dev.parent = &pdev->dev; | 853 | dev->i2c_adap.dev.parent = &pdev->dev; |
855 | dm1105dvb->i2c_adap.algo = &dm1105_algo; | 854 | dev->i2c_adap.algo = &dm1105_algo; |
856 | dm1105dvb->i2c_adap.algo_data = dm1105dvb; | 855 | dev->i2c_adap.algo_data = dev; |
857 | ret = i2c_add_adapter(&dm1105dvb->i2c_adap); | 856 | ret = i2c_add_adapter(&dev->i2c_adap); |
858 | 857 | ||
859 | if (ret < 0) | 858 | if (ret < 0) |
860 | goto err_dm1105dvb_hw_exit; | 859 | goto err_dm1105_hw_exit; |
861 | 860 | ||
862 | /* dvb */ | 861 | /* dvb */ |
863 | ret = dvb_register_adapter(&dm1105dvb->dvb_adapter, DRIVER_NAME, | 862 | ret = dvb_register_adapter(&dev->dvb_adapter, DRIVER_NAME, |
864 | THIS_MODULE, &pdev->dev, adapter_nr); | 863 | THIS_MODULE, &pdev->dev, adapter_nr); |
865 | if (ret < 0) | 864 | if (ret < 0) |
866 | goto err_i2c_del_adapter; | 865 | goto err_i2c_del_adapter; |
867 | 866 | ||
868 | dvb_adapter = &dm1105dvb->dvb_adapter; | 867 | dvb_adapter = &dev->dvb_adapter; |
869 | 868 | ||
870 | dm1105dvb_read_mac(dm1105dvb, dvb_adapter->proposed_mac); | 869 | dm1105_read_mac(dev, dvb_adapter->proposed_mac); |
871 | 870 | ||
872 | dvbdemux = &dm1105dvb->demux; | 871 | dvbdemux = &dev->demux; |
873 | dvbdemux->filternum = 256; | 872 | dvbdemux->filternum = 256; |
874 | dvbdemux->feednum = 256; | 873 | dvbdemux->feednum = 256; |
875 | dvbdemux->start_feed = dm1105dvb_start_feed; | 874 | dvbdemux->start_feed = dm1105_start_feed; |
876 | dvbdemux->stop_feed = dm1105dvb_stop_feed; | 875 | dvbdemux->stop_feed = dm1105_stop_feed; |
877 | dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | | 876 | dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | |
878 | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); | 877 | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); |
879 | ret = dvb_dmx_init(dvbdemux); | 878 | ret = dvb_dmx_init(dvbdemux); |
@@ -881,113 +880,113 @@ static int __devinit dm1105_probe(struct pci_dev *pdev, | |||
881 | goto err_dvb_unregister_adapter; | 880 | goto err_dvb_unregister_adapter; |
882 | 881 | ||
883 | dmx = &dvbdemux->dmx; | 882 | dmx = &dvbdemux->dmx; |
884 | dm1105dvb->dmxdev.filternum = 256; | 883 | dev->dmxdev.filternum = 256; |
885 | dm1105dvb->dmxdev.demux = dmx; | 884 | dev->dmxdev.demux = dmx; |
886 | dm1105dvb->dmxdev.capabilities = 0; | 885 | dev->dmxdev.capabilities = 0; |
887 | 886 | ||
888 | ret = dvb_dmxdev_init(&dm1105dvb->dmxdev, dvb_adapter); | 887 | ret = dvb_dmxdev_init(&dev->dmxdev, dvb_adapter); |
889 | if (ret < 0) | 888 | if (ret < 0) |
890 | goto err_dvb_dmx_release; | 889 | goto err_dvb_dmx_release; |
891 | 890 | ||
892 | dm1105dvb->hw_frontend.source = DMX_FRONTEND_0; | 891 | dev->hw_frontend.source = DMX_FRONTEND_0; |
893 | 892 | ||
894 | ret = dmx->add_frontend(dmx, &dm1105dvb->hw_frontend); | 893 | ret = dmx->add_frontend(dmx, &dev->hw_frontend); |
895 | if (ret < 0) | 894 | if (ret < 0) |
896 | goto err_dvb_dmxdev_release; | 895 | goto err_dvb_dmxdev_release; |
897 | 896 | ||
898 | dm1105dvb->mem_frontend.source = DMX_MEMORY_FE; | 897 | dev->mem_frontend.source = DMX_MEMORY_FE; |
899 | 898 | ||
900 | ret = dmx->add_frontend(dmx, &dm1105dvb->mem_frontend); | 899 | ret = dmx->add_frontend(dmx, &dev->mem_frontend); |
901 | if (ret < 0) | 900 | if (ret < 0) |
902 | goto err_remove_hw_frontend; | 901 | goto err_remove_hw_frontend; |
903 | 902 | ||
904 | ret = dmx->connect_frontend(dmx, &dm1105dvb->hw_frontend); | 903 | ret = dmx->connect_frontend(dmx, &dev->hw_frontend); |
905 | if (ret < 0) | 904 | if (ret < 0) |
906 | goto err_remove_mem_frontend; | 905 | goto err_remove_mem_frontend; |
907 | 906 | ||
908 | ret = frontend_init(dm1105dvb); | 907 | ret = frontend_init(dev); |
909 | if (ret < 0) | 908 | if (ret < 0) |
910 | goto err_disconnect_frontend; | 909 | goto err_disconnect_frontend; |
911 | 910 | ||
912 | dvb_net_init(dvb_adapter, &dm1105dvb->dvbnet, dmx); | 911 | dvb_net_init(dvb_adapter, &dev->dvbnet, dmx); |
913 | dm1105_ir_init(dm1105dvb); | 912 | dm1105_ir_init(dev); |
914 | 913 | ||
915 | INIT_WORK(&dm1105dvb->work, dm1105_dmx_buffer); | 914 | INIT_WORK(&dev->work, dm1105_dmx_buffer); |
916 | sprintf(dm1105dvb->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num); | 915 | sprintf(dev->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num); |
917 | dm1105dvb->wq = create_singlethread_workqueue(dm1105dvb->wqn); | 916 | dev->wq = create_singlethread_workqueue(dev->wqn); |
918 | if (!dm1105dvb->wq) | 917 | if (!dev->wq) |
919 | goto err_dvb_net; | 918 | goto err_dvb_net; |
920 | 919 | ||
921 | ret = request_irq(pdev->irq, dm1105dvb_irq, IRQF_SHARED, | 920 | ret = request_irq(pdev->irq, dm1105_irq, IRQF_SHARED, |
922 | DRIVER_NAME, dm1105dvb); | 921 | DRIVER_NAME, dev); |
923 | if (ret < 0) | 922 | if (ret < 0) |
924 | goto err_workqueue; | 923 | goto err_workqueue; |
925 | 924 | ||
926 | return 0; | 925 | return 0; |
927 | 926 | ||
928 | err_workqueue: | 927 | err_workqueue: |
929 | destroy_workqueue(dm1105dvb->wq); | 928 | destroy_workqueue(dev->wq); |
930 | err_dvb_net: | 929 | err_dvb_net: |
931 | dvb_net_release(&dm1105dvb->dvbnet); | 930 | dvb_net_release(&dev->dvbnet); |
932 | err_disconnect_frontend: | 931 | err_disconnect_frontend: |
933 | dmx->disconnect_frontend(dmx); | 932 | dmx->disconnect_frontend(dmx); |
934 | err_remove_mem_frontend: | 933 | err_remove_mem_frontend: |
935 | dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend); | 934 | dmx->remove_frontend(dmx, &dev->mem_frontend); |
936 | err_remove_hw_frontend: | 935 | err_remove_hw_frontend: |
937 | dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend); | 936 | dmx->remove_frontend(dmx, &dev->hw_frontend); |
938 | err_dvb_dmxdev_release: | 937 | err_dvb_dmxdev_release: |
939 | dvb_dmxdev_release(&dm1105dvb->dmxdev); | 938 | dvb_dmxdev_release(&dev->dmxdev); |
940 | err_dvb_dmx_release: | 939 | err_dvb_dmx_release: |
941 | dvb_dmx_release(dvbdemux); | 940 | dvb_dmx_release(dvbdemux); |
942 | err_dvb_unregister_adapter: | 941 | err_dvb_unregister_adapter: |
943 | dvb_unregister_adapter(dvb_adapter); | 942 | dvb_unregister_adapter(dvb_adapter); |
944 | err_i2c_del_adapter: | 943 | err_i2c_del_adapter: |
945 | i2c_del_adapter(&dm1105dvb->i2c_adap); | 944 | i2c_del_adapter(&dev->i2c_adap); |
946 | err_dm1105dvb_hw_exit: | 945 | err_dm1105_hw_exit: |
947 | dm1105dvb_hw_exit(dm1105dvb); | 946 | dm1105_hw_exit(dev); |
948 | err_pci_iounmap: | 947 | err_pci_iounmap: |
949 | pci_iounmap(pdev, dm1105dvb->io_mem); | 948 | pci_iounmap(pdev, dev->io_mem); |
950 | err_pci_release_regions: | 949 | err_pci_release_regions: |
951 | pci_release_regions(pdev); | 950 | pci_release_regions(pdev); |
952 | err_pci_disable_device: | 951 | err_pci_disable_device: |
953 | pci_disable_device(pdev); | 952 | pci_disable_device(pdev); |
954 | err_kfree: | 953 | err_kfree: |
955 | pci_set_drvdata(pdev, NULL); | 954 | pci_set_drvdata(pdev, NULL); |
956 | kfree(dm1105dvb); | 955 | kfree(dev); |
957 | return ret; | 956 | return ret; |
958 | } | 957 | } |
959 | 958 | ||
960 | static void __devexit dm1105_remove(struct pci_dev *pdev) | 959 | static void __devexit dm1105_remove(struct pci_dev *pdev) |
961 | { | 960 | { |
962 | struct dm1105dvb *dm1105dvb = pci_get_drvdata(pdev); | 961 | struct dm1105_dev *dev = pci_get_drvdata(pdev); |
963 | struct dvb_adapter *dvb_adapter = &dm1105dvb->dvb_adapter; | 962 | struct dvb_adapter *dvb_adapter = &dev->dvb_adapter; |
964 | struct dvb_demux *dvbdemux = &dm1105dvb->demux; | 963 | struct dvb_demux *dvbdemux = &dev->demux; |
965 | struct dmx_demux *dmx = &dvbdemux->dmx; | 964 | struct dmx_demux *dmx = &dvbdemux->dmx; |
966 | 965 | ||
967 | dm1105_ir_exit(dm1105dvb); | 966 | dm1105_ir_exit(dev); |
968 | dmx->close(dmx); | 967 | dmx->close(dmx); |
969 | dvb_net_release(&dm1105dvb->dvbnet); | 968 | dvb_net_release(&dev->dvbnet); |
970 | if (dm1105dvb->fe) | 969 | if (dev->fe) |
971 | dvb_unregister_frontend(dm1105dvb->fe); | 970 | dvb_unregister_frontend(dev->fe); |
972 | 971 | ||
973 | dmx->disconnect_frontend(dmx); | 972 | dmx->disconnect_frontend(dmx); |
974 | dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend); | 973 | dmx->remove_frontend(dmx, &dev->mem_frontend); |
975 | dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend); | 974 | dmx->remove_frontend(dmx, &dev->hw_frontend); |
976 | dvb_dmxdev_release(&dm1105dvb->dmxdev); | 975 | dvb_dmxdev_release(&dev->dmxdev); |
977 | dvb_dmx_release(dvbdemux); | 976 | dvb_dmx_release(dvbdemux); |
978 | dvb_unregister_adapter(dvb_adapter); | 977 | dvb_unregister_adapter(dvb_adapter); |
979 | if (&dm1105dvb->i2c_adap) | 978 | if (&dev->i2c_adap) |
980 | i2c_del_adapter(&dm1105dvb->i2c_adap); | 979 | i2c_del_adapter(&dev->i2c_adap); |
981 | 980 | ||
982 | dm1105dvb_hw_exit(dm1105dvb); | 981 | dm1105_hw_exit(dev); |
983 | synchronize_irq(pdev->irq); | 982 | synchronize_irq(pdev->irq); |
984 | free_irq(pdev->irq, dm1105dvb); | 983 | free_irq(pdev->irq, dev); |
985 | pci_iounmap(pdev, dm1105dvb->io_mem); | 984 | pci_iounmap(pdev, dev->io_mem); |
986 | pci_release_regions(pdev); | 985 | pci_release_regions(pdev); |
987 | pci_disable_device(pdev); | 986 | pci_disable_device(pdev); |
988 | pci_set_drvdata(pdev, NULL); | 987 | pci_set_drvdata(pdev, NULL); |
989 | dm1105_devcount--; | 988 | dm1105_devcount--; |
990 | kfree(dm1105dvb); | 989 | kfree(dev); |
991 | } | 990 | } |
992 | 991 | ||
993 | static struct pci_device_id dm1105_id_table[] __devinitdata = { | 992 | static struct pci_device_id dm1105_id_table[] __devinitdata = { |