diff options
Diffstat (limited to 'drivers')
210 files changed, 1943 insertions, 1497 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 3ff267861541..bd22f8667eed 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -250,7 +250,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) | |||
| 250 | return acpi_rsdp; | 250 | return acpi_rsdp; |
| 251 | #endif | 251 | #endif |
| 252 | 252 | ||
| 253 | if (efi_enabled) { | 253 | if (efi_enabled(EFI_CONFIG_TABLES)) { |
| 254 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) | 254 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) |
| 255 | return efi.acpi20; | 255 | return efi.acpi20; |
| 256 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) | 256 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) |
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index 6a0955e6d4fc..53ecac5a2161 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h | |||
| @@ -636,82 +636,82 @@ struct rx_buf_desc { | |||
| 636 | #define SEG_BASE IPHASE5575_FRAG_CONTROL_REG_BASE | 636 | #define SEG_BASE IPHASE5575_FRAG_CONTROL_REG_BASE |
| 637 | #define REASS_BASE IPHASE5575_REASS_CONTROL_REG_BASE | 637 | #define REASS_BASE IPHASE5575_REASS_CONTROL_REG_BASE |
| 638 | 638 | ||
| 639 | typedef volatile u_int freg_t; | 639 | typedef volatile u_int ffreg_t; |
| 640 | typedef u_int rreg_t; | 640 | typedef u_int rreg_t; |
| 641 | 641 | ||
| 642 | typedef struct _ffredn_t { | 642 | typedef struct _ffredn_t { |
| 643 | freg_t idlehead_high; /* Idle cell header (high) */ | 643 | ffreg_t idlehead_high; /* Idle cell header (high) */ |
| 644 | freg_t idlehead_low; /* Idle cell header (low) */ | 644 | ffreg_t idlehead_low; /* Idle cell header (low) */ |
| 645 | freg_t maxrate; /* Maximum rate */ | 645 | ffreg_t maxrate; /* Maximum rate */ |
| 646 | freg_t stparms; /* Traffic Management Parameters */ | 646 | ffreg_t stparms; /* Traffic Management Parameters */ |
| 647 | freg_t abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0 */ | 647 | ffreg_t abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0 */ |
| 648 | freg_t rm_type; /* */ | 648 | ffreg_t rm_type; /* */ |
| 649 | u_int filler5[0x17 - 0x06]; | 649 | u_int filler5[0x17 - 0x06]; |
| 650 | freg_t cmd_reg; /* Command register */ | 650 | ffreg_t cmd_reg; /* Command register */ |
| 651 | u_int filler18[0x20 - 0x18]; | 651 | u_int filler18[0x20 - 0x18]; |
| 652 | freg_t cbr_base; /* CBR Pointer Base */ | 652 | ffreg_t cbr_base; /* CBR Pointer Base */ |
| 653 | freg_t vbr_base; /* VBR Pointer Base */ | 653 | ffreg_t vbr_base; /* VBR Pointer Base */ |
| 654 | freg_t abr_base; /* ABR Pointer Base */ | 654 | ffreg_t abr_base; /* ABR Pointer Base */ |
| 655 | freg_t ubr_base; /* UBR Pointer Base */ | 655 | ffreg_t ubr_base; /* UBR Pointer Base */ |
| 656 | u_int filler24; | 656 | u_int filler24; |
| 657 | freg_t vbrwq_base; /* VBR Wait Queue Base */ | 657 | ffreg_t vbrwq_base; /* VBR Wait Queue Base */ |
| 658 | freg_t abrwq_base; /* ABR Wait Queue Base */ | 658 | ffreg_t abrwq_base; /* ABR Wait Queue Base */ |
| 659 | freg_t ubrwq_base; /* UBR Wait Queue Base */ | 659 | ffreg_t ubrwq_base; /* UBR Wait Queue Base */ |
| 660 | freg_t vct_base; /* Main VC Table Base */ | 660 | ffreg_t vct_base; /* Main VC Table Base */ |
| 661 | freg_t vcte_base; /* Extended Main VC Table Base */ | 661 | ffreg_t vcte_base; /* Extended Main VC Table Base */ |
| 662 | u_int filler2a[0x2C - 0x2A]; | 662 | u_int filler2a[0x2C - 0x2A]; |
| 663 | freg_t cbr_tab_beg; /* CBR Table Begin */ | 663 | ffreg_t cbr_tab_beg; /* CBR Table Begin */ |
| 664 | freg_t cbr_tab_end; /* CBR Table End */ | 664 | ffreg_t cbr_tab_end; /* CBR Table End */ |
| 665 | freg_t cbr_pointer; /* CBR Pointer */ | 665 | ffreg_t cbr_pointer; /* CBR Pointer */ |
| 666 | u_int filler2f[0x30 - 0x2F]; | 666 | u_int filler2f[0x30 - 0x2F]; |
| 667 | freg_t prq_st_adr; /* Packet Ready Queue Start Address */ | 667 | ffreg_t prq_st_adr; /* Packet Ready Queue Start Address */ |
| 668 | freg_t prq_ed_adr; /* Packet Ready Queue End Address */ | 668 | ffreg_t prq_ed_adr; /* Packet Ready Queue End Address */ |
| 669 | freg_t prq_rd_ptr; /* Packet Ready Queue read pointer */ | 669 | ffreg_t prq_rd_ptr; /* Packet Ready Queue read pointer */ |
| 670 | freg_t prq_wr_ptr; /* Packet Ready Queue write pointer */ | 670 | ffreg_t prq_wr_ptr; /* Packet Ready Queue write pointer */ |
| 671 | freg_t tcq_st_adr; /* Transmit Complete Queue Start Address*/ | 671 | ffreg_t tcq_st_adr; /* Transmit Complete Queue Start Address*/ |
| 672 | freg_t tcq_ed_adr; /* Transmit Complete Queue End Address */ | 672 | ffreg_t tcq_ed_adr; /* Transmit Complete Queue End Address */ |
| 673 | freg_t tcq_rd_ptr; /* Transmit Complete Queue read pointer */ | 673 | ffreg_t tcq_rd_ptr; /* Transmit Complete Queue read pointer */ |
| 674 | freg_t tcq_wr_ptr; /* Transmit Complete Queue write pointer*/ | 674 | ffreg_t tcq_wr_ptr; /* Transmit Complete Queue write pointer*/ |
| 675 | u_int filler38[0x40 - 0x38]; | 675 | u_int filler38[0x40 - 0x38]; |
| 676 | freg_t queue_base; /* Base address for PRQ and TCQ */ | 676 | ffreg_t queue_base; /* Base address for PRQ and TCQ */ |
| 677 | freg_t desc_base; /* Base address of descriptor table */ | 677 | ffreg_t desc_base; /* Base address of descriptor table */ |
| 678 | u_int filler42[0x45 - 0x42]; | 678 | u_int filler42[0x45 - 0x42]; |
| 679 | freg_t mode_reg_0; /* Mode register 0 */ | 679 | ffreg_t mode_reg_0; /* Mode register 0 */ |
| 680 | freg_t mode_reg_1; /* Mode register 1 */ | 680 | ffreg_t mode_reg_1; /* Mode register 1 */ |
| 681 | freg_t intr_status_reg;/* Interrupt Status register */ | 681 | ffreg_t intr_status_reg;/* Interrupt Status register */ |
| 682 | freg_t mask_reg; /* Mask Register */ | 682 | ffreg_t mask_reg; /* Mask Register */ |
| 683 | freg_t cell_ctr_high1; /* Total cell transfer count (high) */ | 683 | ffreg_t cell_ctr_high1; /* Total cell transfer count (high) */ |
| 684 | freg_t cell_ctr_lo1; /* Total cell transfer count (low) */ | 684 | ffreg_t cell_ctr_lo1; /* Total cell transfer count (low) */ |
| 685 | freg_t state_reg; /* Status register */ | 685 | ffreg_t state_reg; /* Status register */ |
| 686 | u_int filler4c[0x58 - 0x4c]; | 686 | u_int filler4c[0x58 - 0x4c]; |
| 687 | freg_t curr_desc_num; /* Contains the current descriptor num */ | 687 | ffreg_t curr_desc_num; /* Contains the current descriptor num */ |
| 688 | freg_t next_desc; /* Next descriptor */ | 688 | ffreg_t next_desc; /* Next descriptor */ |
| 689 | freg_t next_vc; /* Next VC */ | 689 | ffreg_t next_vc; /* Next VC */ |
| 690 | u_int filler5b[0x5d - 0x5b]; | 690 | u_int filler5b[0x5d - 0x5b]; |
| 691 | freg_t present_slot_cnt;/* Present slot count */ | 691 | ffreg_t present_slot_cnt;/* Present slot count */ |
| 692 | u_int filler5e[0x6a - 0x5e]; | 692 | u_int filler5e[0x6a - 0x5e]; |
| 693 | freg_t new_desc_num; /* New descriptor number */ | 693 | ffreg_t new_desc_num; /* New descriptor number */ |
| 694 | freg_t new_vc; /* New VC */ | 694 | ffreg_t new_vc; /* New VC */ |
| 695 | freg_t sched_tbl_ptr; /* Schedule table pointer */ | 695 | ffreg_t sched_tbl_ptr; /* Schedule table pointer */ |
| 696 | freg_t vbrwq_wptr; /* VBR wait queue write pointer */ | 696 | ffreg_t vbrwq_wptr; /* VBR wait queue write pointer */ |
| 697 | freg_t vbrwq_rptr; /* VBR wait queue read pointer */ | 697 | ffreg_t vbrwq_rptr; /* VBR wait queue read pointer */ |
| 698 | freg_t abrwq_wptr; /* ABR wait queue write pointer */ | 698 | ffreg_t abrwq_wptr; /* ABR wait queue write pointer */ |
| 699 | freg_t abrwq_rptr; /* ABR wait queue read pointer */ | 699 | ffreg_t abrwq_rptr; /* ABR wait queue read pointer */ |
| 700 | freg_t ubrwq_wptr; /* UBR wait queue write pointer */ | 700 | ffreg_t ubrwq_wptr; /* UBR wait queue write pointer */ |
| 701 | freg_t ubrwq_rptr; /* UBR wait queue read pointer */ | 701 | ffreg_t ubrwq_rptr; /* UBR wait queue read pointer */ |
| 702 | freg_t cbr_vc; /* CBR VC */ | 702 | ffreg_t cbr_vc; /* CBR VC */ |
| 703 | freg_t vbr_sb_vc; /* VBR SB VC */ | 703 | ffreg_t vbr_sb_vc; /* VBR SB VC */ |
| 704 | freg_t abr_sb_vc; /* ABR SB VC */ | 704 | ffreg_t abr_sb_vc; /* ABR SB VC */ |
| 705 | freg_t ubr_sb_vc; /* UBR SB VC */ | 705 | ffreg_t ubr_sb_vc; /* UBR SB VC */ |
| 706 | freg_t vbr_next_link; /* VBR next link */ | 706 | ffreg_t vbr_next_link; /* VBR next link */ |
| 707 | freg_t abr_next_link; /* ABR next link */ | 707 | ffreg_t abr_next_link; /* ABR next link */ |
| 708 | freg_t ubr_next_link; /* UBR next link */ | 708 | ffreg_t ubr_next_link; /* UBR next link */ |
| 709 | u_int filler7a[0x7c-0x7a]; | 709 | u_int filler7a[0x7c-0x7a]; |
| 710 | freg_t out_rate_head; /* Out of rate head */ | 710 | ffreg_t out_rate_head; /* Out of rate head */ |
| 711 | u_int filler7d[0xca-0x7d]; /* pad out to full address space */ | 711 | u_int filler7d[0xca-0x7d]; /* pad out to full address space */ |
| 712 | freg_t cell_ctr_high1_nc;/* Total cell transfer count (high) */ | 712 | ffreg_t cell_ctr_high1_nc;/* Total cell transfer count (high) */ |
| 713 | freg_t cell_ctr_lo1_nc;/* Total cell transfer count (low) */ | 713 | ffreg_t cell_ctr_lo1_nc;/* Total cell transfer count (low) */ |
| 714 | u_int fillercc[0x100-0xcc]; /* pad out to full address space */ | 714 | u_int fillercc[0x100-0xcc]; /* pad out to full address space */ |
| 715 | } ffredn_t; | 715 | } ffredn_t; |
| 716 | 716 | ||
| 717 | typedef struct _rfredn_t { | 717 | typedef struct _rfredn_t { |
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index 19e3fbfd5757..cb0c45488572 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
| @@ -94,11 +94,16 @@ void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); | |||
| 94 | #ifdef CONFIG_BCMA_DRIVER_GPIO | 94 | #ifdef CONFIG_BCMA_DRIVER_GPIO |
| 95 | /* driver_gpio.c */ | 95 | /* driver_gpio.c */ |
| 96 | int bcma_gpio_init(struct bcma_drv_cc *cc); | 96 | int bcma_gpio_init(struct bcma_drv_cc *cc); |
| 97 | int bcma_gpio_unregister(struct bcma_drv_cc *cc); | ||
| 97 | #else | 98 | #else |
| 98 | static inline int bcma_gpio_init(struct bcma_drv_cc *cc) | 99 | static inline int bcma_gpio_init(struct bcma_drv_cc *cc) |
| 99 | { | 100 | { |
| 100 | return -ENOTSUPP; | 101 | return -ENOTSUPP; |
| 101 | } | 102 | } |
| 103 | static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc) | ||
| 104 | { | ||
| 105 | return 0; | ||
| 106 | } | ||
| 102 | #endif /* CONFIG_BCMA_DRIVER_GPIO */ | 107 | #endif /* CONFIG_BCMA_DRIVER_GPIO */ |
| 103 | 108 | ||
| 104 | #endif | 109 | #endif |
diff --git a/drivers/bcma/driver_chipcommon_nflash.c b/drivers/bcma/driver_chipcommon_nflash.c index dbda91e4dff5..1f0b83e18f68 100644 --- a/drivers/bcma/driver_chipcommon_nflash.c +++ b/drivers/bcma/driver_chipcommon_nflash.c | |||
| @@ -21,7 +21,7 @@ int bcma_nflash_init(struct bcma_drv_cc *cc) | |||
| 21 | struct bcma_bus *bus = cc->core->bus; | 21 | struct bcma_bus *bus = cc->core->bus; |
| 22 | 22 | ||
| 23 | if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && | 23 | if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && |
| 24 | cc->core->id.rev != 0x38) { | 24 | cc->core->id.rev != 38) { |
| 25 | bcma_err(bus, "NAND flash on unsupported board!\n"); | 25 | bcma_err(bus, "NAND flash on unsupported board!\n"); |
| 26 | return -ENOTSUPP; | 26 | return -ENOTSUPP; |
| 27 | } | 27 | } |
diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c index 9a6f585da2d9..71f755c06fc6 100644 --- a/drivers/bcma/driver_gpio.c +++ b/drivers/bcma/driver_gpio.c | |||
| @@ -96,3 +96,8 @@ int bcma_gpio_init(struct bcma_drv_cc *cc) | |||
| 96 | 96 | ||
| 97 | return gpiochip_add(chip); | 97 | return gpiochip_add(chip); |
| 98 | } | 98 | } |
| 99 | |||
| 100 | int bcma_gpio_unregister(struct bcma_drv_cc *cc) | ||
| 101 | { | ||
| 102 | return gpiochip_remove(&cc->gpio); | ||
| 103 | } | ||
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 4a92f647b58b..324f9debda88 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
| @@ -268,6 +268,13 @@ int bcma_bus_register(struct bcma_bus *bus) | |||
| 268 | void bcma_bus_unregister(struct bcma_bus *bus) | 268 | void bcma_bus_unregister(struct bcma_bus *bus) |
| 269 | { | 269 | { |
| 270 | struct bcma_device *cores[3]; | 270 | struct bcma_device *cores[3]; |
| 271 | int err; | ||
| 272 | |||
| 273 | err = bcma_gpio_unregister(&bus->drv_cc); | ||
| 274 | if (err == -EBUSY) | ||
| 275 | bcma_err(bus, "Some GPIOs are still in use.\n"); | ||
| 276 | else if (err) | ||
| 277 | bcma_err(bus, "Can not unregister GPIO driver: %i\n", err); | ||
| 271 | 278 | ||
| 272 | cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); | 279 | cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); |
| 273 | cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); | 280 | cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index f58a4a4b4dfb..2b8303ad63c9 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
| @@ -168,7 +168,7 @@ static void wake_all_senders(struct drbd_tconn *tconn) { | |||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | /* must hold resource->req_lock */ | 170 | /* must hold resource->req_lock */ |
| 171 | static void start_new_tl_epoch(struct drbd_tconn *tconn) | 171 | void start_new_tl_epoch(struct drbd_tconn *tconn) |
| 172 | { | 172 | { |
| 173 | /* no point closing an epoch, if it is empty, anyways. */ | 173 | /* no point closing an epoch, if it is empty, anyways. */ |
| 174 | if (tconn->current_tle_writes == 0) | 174 | if (tconn->current_tle_writes == 0) |
diff --git a/drivers/block/drbd/drbd_req.h b/drivers/block/drbd/drbd_req.h index 016de6b8bb57..c08d22964d06 100644 --- a/drivers/block/drbd/drbd_req.h +++ b/drivers/block/drbd/drbd_req.h | |||
| @@ -267,6 +267,7 @@ struct bio_and_error { | |||
| 267 | int error; | 267 | int error; |
| 268 | }; | 268 | }; |
| 269 | 269 | ||
| 270 | extern void start_new_tl_epoch(struct drbd_tconn *tconn); | ||
| 270 | extern void drbd_req_destroy(struct kref *kref); | 271 | extern void drbd_req_destroy(struct kref *kref); |
| 271 | extern void _req_may_be_done(struct drbd_request *req, | 272 | extern void _req_may_be_done(struct drbd_request *req, |
| 272 | struct bio_and_error *m); | 273 | struct bio_and_error *m); |
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 53bf6182bac4..0fe220cfb9e9 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c | |||
| @@ -931,6 +931,7 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns, | |||
| 931 | enum drbd_state_rv rv = SS_SUCCESS; | 931 | enum drbd_state_rv rv = SS_SUCCESS; |
| 932 | enum sanitize_state_warnings ssw; | 932 | enum sanitize_state_warnings ssw; |
| 933 | struct after_state_chg_work *ascw; | 933 | struct after_state_chg_work *ascw; |
| 934 | bool did_remote, should_do_remote; | ||
| 934 | 935 | ||
| 935 | os = drbd_read_state(mdev); | 936 | os = drbd_read_state(mdev); |
| 936 | 937 | ||
| @@ -981,11 +982,17 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns, | |||
| 981 | (os.disk != D_DISKLESS && ns.disk == D_DISKLESS)) | 982 | (os.disk != D_DISKLESS && ns.disk == D_DISKLESS)) |
| 982 | atomic_inc(&mdev->local_cnt); | 983 | atomic_inc(&mdev->local_cnt); |
| 983 | 984 | ||
| 985 | did_remote = drbd_should_do_remote(mdev->state); | ||
| 984 | mdev->state.i = ns.i; | 986 | mdev->state.i = ns.i; |
| 987 | should_do_remote = drbd_should_do_remote(mdev->state); | ||
| 985 | mdev->tconn->susp = ns.susp; | 988 | mdev->tconn->susp = ns.susp; |
| 986 | mdev->tconn->susp_nod = ns.susp_nod; | 989 | mdev->tconn->susp_nod = ns.susp_nod; |
| 987 | mdev->tconn->susp_fen = ns.susp_fen; | 990 | mdev->tconn->susp_fen = ns.susp_fen; |
| 988 | 991 | ||
| 992 | /* put replicated vs not-replicated requests in seperate epochs */ | ||
| 993 | if (did_remote != should_do_remote) | ||
| 994 | start_new_tl_epoch(mdev->tconn); | ||
| 995 | |||
| 989 | if (os.disk == D_ATTACHING && ns.disk >= D_NEGOTIATING) | 996 | if (os.disk == D_ATTACHING && ns.disk >= D_NEGOTIATING) |
| 990 | drbd_print_uuids(mdev, "attached to UUIDs"); | 997 | drbd_print_uuids(mdev, "attached to UUIDs"); |
| 991 | 998 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 9694dd99bbbc..3fd100990453 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
| @@ -626,12 +626,13 @@ static void mtip_timeout_function(unsigned long int data) | |||
| 626 | } | 626 | } |
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { | 629 | if (cmdto_cnt) { |
| 630 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); | 630 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); |
| 631 | 631 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { | |
| 632 | mtip_restart_port(port); | 632 | mtip_restart_port(port); |
| 633 | wake_up_interruptible(&port->svc_wait); | ||
| 634 | } | ||
| 633 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); | 635 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
| 634 | wake_up_interruptible(&port->svc_wait); | ||
| 635 | } | 636 | } |
| 636 | 637 | ||
| 637 | if (port->ic_pause_timer) { | 638 | if (port->ic_pause_timer) { |
| @@ -3887,7 +3888,12 @@ static int mtip_block_remove(struct driver_data *dd) | |||
| 3887 | * Delete our gendisk structure. This also removes the device | 3888 | * Delete our gendisk structure. This also removes the device |
| 3888 | * from /dev | 3889 | * from /dev |
| 3889 | */ | 3890 | */ |
| 3890 | del_gendisk(dd->disk); | 3891 | if (dd->disk) { |
| 3892 | if (dd->disk->queue) | ||
| 3893 | del_gendisk(dd->disk); | ||
| 3894 | else | ||
| 3895 | put_disk(dd->disk); | ||
| 3896 | } | ||
| 3891 | 3897 | ||
| 3892 | spin_lock(&rssd_index_lock); | 3898 | spin_lock(&rssd_index_lock); |
| 3893 | ida_remove(&rssd_index_ida, dd->index); | 3899 | ida_remove(&rssd_index_ida, dd->index); |
| @@ -3921,7 +3927,13 @@ static int mtip_block_shutdown(struct driver_data *dd) | |||
| 3921 | "Shutting down %s ...\n", dd->disk->disk_name); | 3927 | "Shutting down %s ...\n", dd->disk->disk_name); |
| 3922 | 3928 | ||
| 3923 | /* Delete our gendisk structure, and cleanup the blk queue. */ | 3929 | /* Delete our gendisk structure, and cleanup the blk queue. */ |
| 3924 | del_gendisk(dd->disk); | 3930 | if (dd->disk) { |
| 3931 | if (dd->disk->queue) | ||
| 3932 | del_gendisk(dd->disk); | ||
| 3933 | else | ||
| 3934 | put_disk(dd->disk); | ||
| 3935 | } | ||
| 3936 | |||
| 3925 | 3937 | ||
| 3926 | spin_lock(&rssd_index_lock); | 3938 | spin_lock(&rssd_index_lock); |
| 3927 | ida_remove(&rssd_index_ida, dd->index); | 3939 | ida_remove(&rssd_index_ida, dd->index); |
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 74374fb762aa..5ac841ff6cc7 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
| @@ -161,10 +161,12 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
| 161 | static void make_response(struct xen_blkif *blkif, u64 id, | 161 | static void make_response(struct xen_blkif *blkif, u64 id, |
| 162 | unsigned short op, int st); | 162 | unsigned short op, int st); |
| 163 | 163 | ||
| 164 | #define foreach_grant(pos, rbtree, node) \ | 164 | #define foreach_grant_safe(pos, n, rbtree, node) \ |
| 165 | for ((pos) = container_of(rb_first((rbtree)), typeof(*(pos)), node); \ | 165 | for ((pos) = container_of(rb_first((rbtree)), typeof(*(pos)), node), \ |
| 166 | (n) = rb_next(&(pos)->node); \ | ||
| 166 | &(pos)->node != NULL; \ | 167 | &(pos)->node != NULL; \ |
| 167 | (pos) = container_of(rb_next(&(pos)->node), typeof(*(pos)), node)) | 168 | (pos) = container_of(n, typeof(*(pos)), node), \ |
| 169 | (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL) | ||
| 168 | 170 | ||
| 169 | 171 | ||
| 170 | static void add_persistent_gnt(struct rb_root *root, | 172 | static void add_persistent_gnt(struct rb_root *root, |
| @@ -217,10 +219,11 @@ static void free_persistent_gnts(struct rb_root *root, unsigned int num) | |||
| 217 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 219 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
| 218 | struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 220 | struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
| 219 | struct persistent_gnt *persistent_gnt; | 221 | struct persistent_gnt *persistent_gnt; |
| 222 | struct rb_node *n; | ||
| 220 | int ret = 0; | 223 | int ret = 0; |
| 221 | int segs_to_unmap = 0; | 224 | int segs_to_unmap = 0; |
| 222 | 225 | ||
| 223 | foreach_grant(persistent_gnt, root, node) { | 226 | foreach_grant_safe(persistent_gnt, n, root, node) { |
| 224 | BUG_ON(persistent_gnt->handle == | 227 | BUG_ON(persistent_gnt->handle == |
| 225 | BLKBACK_INVALID_HANDLE); | 228 | BLKBACK_INVALID_HANDLE); |
| 226 | gnttab_set_unmap_op(&unmap[segs_to_unmap], | 229 | gnttab_set_unmap_op(&unmap[segs_to_unmap], |
| @@ -230,9 +233,6 @@ static void free_persistent_gnts(struct rb_root *root, unsigned int num) | |||
| 230 | persistent_gnt->handle); | 233 | persistent_gnt->handle); |
| 231 | 234 | ||
| 232 | pages[segs_to_unmap] = persistent_gnt->page; | 235 | pages[segs_to_unmap] = persistent_gnt->page; |
| 233 | rb_erase(&persistent_gnt->node, root); | ||
| 234 | kfree(persistent_gnt); | ||
| 235 | num--; | ||
| 236 | 236 | ||
| 237 | if (++segs_to_unmap == BLKIF_MAX_SEGMENTS_PER_REQUEST || | 237 | if (++segs_to_unmap == BLKIF_MAX_SEGMENTS_PER_REQUEST || |
| 238 | !rb_next(&persistent_gnt->node)) { | 238 | !rb_next(&persistent_gnt->node)) { |
| @@ -241,6 +241,10 @@ static void free_persistent_gnts(struct rb_root *root, unsigned int num) | |||
| 241 | BUG_ON(ret); | 241 | BUG_ON(ret); |
| 242 | segs_to_unmap = 0; | 242 | segs_to_unmap = 0; |
| 243 | } | 243 | } |
| 244 | |||
| 245 | rb_erase(&persistent_gnt->node, root); | ||
| 246 | kfree(persistent_gnt); | ||
| 247 | num--; | ||
| 244 | } | 248 | } |
| 245 | BUG_ON(num != 0); | 249 | BUG_ON(num != 0); |
| 246 | } | 250 | } |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 96e9b00db081..11043c18ac5a 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
| @@ -792,6 +792,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
| 792 | { | 792 | { |
| 793 | struct llist_node *all_gnts; | 793 | struct llist_node *all_gnts; |
| 794 | struct grant *persistent_gnt; | 794 | struct grant *persistent_gnt; |
| 795 | struct llist_node *n; | ||
| 795 | 796 | ||
| 796 | /* Prevent new requests being issued until we fix things up. */ | 797 | /* Prevent new requests being issued until we fix things up. */ |
| 797 | spin_lock_irq(&info->io_lock); | 798 | spin_lock_irq(&info->io_lock); |
| @@ -804,7 +805,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
| 804 | /* Remove all persistent grants */ | 805 | /* Remove all persistent grants */ |
| 805 | if (info->persistent_gnts_c) { | 806 | if (info->persistent_gnts_c) { |
| 806 | all_gnts = llist_del_all(&info->persistent_gnts); | 807 | all_gnts = llist_del_all(&info->persistent_gnts); |
| 807 | llist_for_each_entry(persistent_gnt, all_gnts, node) { | 808 | llist_for_each_entry_safe(persistent_gnt, n, all_gnts, node) { |
| 808 | gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL); | 809 | gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL); |
| 809 | __free_page(pfn_to_page(persistent_gnt->pfn)); | 810 | __free_page(pfn_to_page(persistent_gnt->pfn)); |
| 810 | kfree(persistent_gnt); | 811 | kfree(persistent_gnt); |
| @@ -835,7 +836,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
| 835 | static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | 836 | static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, |
| 836 | struct blkif_response *bret) | 837 | struct blkif_response *bret) |
| 837 | { | 838 | { |
| 838 | int i; | 839 | int i = 0; |
| 839 | struct bio_vec *bvec; | 840 | struct bio_vec *bvec; |
| 840 | struct req_iterator iter; | 841 | struct req_iterator iter; |
| 841 | unsigned long flags; | 842 | unsigned long flags; |
| @@ -852,7 +853,8 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | |||
| 852 | */ | 853 | */ |
| 853 | rq_for_each_segment(bvec, s->request, iter) { | 854 | rq_for_each_segment(bvec, s->request, iter) { |
| 854 | BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE); | 855 | BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE); |
| 855 | i = offset >> PAGE_SHIFT; | 856 | if (bvec->bv_offset < offset) |
| 857 | i++; | ||
| 856 | BUG_ON(i >= s->req.u.rw.nr_segments); | 858 | BUG_ON(i >= s->req.u.rw.nr_segments); |
| 857 | shared_data = kmap_atomic( | 859 | shared_data = kmap_atomic( |
| 858 | pfn_to_page(s->grants_used[i]->pfn)); | 860 | pfn_to_page(s->grants_used[i]->pfn)); |
| @@ -861,7 +863,7 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | |||
| 861 | bvec->bv_len); | 863 | bvec->bv_len); |
| 862 | bvec_kunmap_irq(bvec_data, &flags); | 864 | bvec_kunmap_irq(bvec_data, &flags); |
| 863 | kunmap_atomic(shared_data); | 865 | kunmap_atomic(shared_data); |
| 864 | offset += bvec->bv_len; | 866 | offset = bvec->bv_offset + bvec->bv_len; |
| 865 | } | 867 | } |
| 866 | } | 868 | } |
| 867 | /* Add the persistent grant into the list of free grants */ | 869 | /* Add the persistent grant into the list of free grants */ |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index b00000e8aef6..33c9a44a9678 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -77,10 +77,15 @@ static struct usb_device_id ath3k_table[] = { | |||
| 77 | { USB_DEVICE(0x0CF3, 0x311D) }, | 77 | { USB_DEVICE(0x0CF3, 0x311D) }, |
| 78 | { USB_DEVICE(0x13d3, 0x3375) }, | 78 | { USB_DEVICE(0x13d3, 0x3375) }, |
| 79 | { USB_DEVICE(0x04CA, 0x3005) }, | 79 | { USB_DEVICE(0x04CA, 0x3005) }, |
| 80 | { USB_DEVICE(0x04CA, 0x3006) }, | ||
| 81 | { USB_DEVICE(0x04CA, 0x3008) }, | ||
| 80 | { USB_DEVICE(0x13d3, 0x3362) }, | 82 | { USB_DEVICE(0x13d3, 0x3362) }, |
| 81 | { USB_DEVICE(0x0CF3, 0xE004) }, | 83 | { USB_DEVICE(0x0CF3, 0xE004) }, |
| 82 | { USB_DEVICE(0x0930, 0x0219) }, | 84 | { USB_DEVICE(0x0930, 0x0219) }, |
| 83 | { USB_DEVICE(0x0489, 0xe057) }, | 85 | { USB_DEVICE(0x0489, 0xe057) }, |
| 86 | { USB_DEVICE(0x13d3, 0x3393) }, | ||
| 87 | { USB_DEVICE(0x0489, 0xe04e) }, | ||
| 88 | { USB_DEVICE(0x0489, 0xe056) }, | ||
| 84 | 89 | ||
| 85 | /* Atheros AR5BBU12 with sflash firmware */ | 90 | /* Atheros AR5BBU12 with sflash firmware */ |
| 86 | { USB_DEVICE(0x0489, 0xE02C) }, | 91 | { USB_DEVICE(0x0489, 0xE02C) }, |
| @@ -104,10 +109,15 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
| 104 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 109 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
| 105 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 110 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 106 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 111 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 112 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | ||
| 113 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | ||
| 107 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 114 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
| 108 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 115 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
| 109 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 116 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
| 110 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, | 117 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, |
| 118 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | ||
| 119 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, | ||
| 120 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, | ||
| 111 | 121 | ||
| 112 | /* Atheros AR5BBU22 with sflash firmware */ | 122 | /* Atheros AR5BBU22 with sflash firmware */ |
| 113 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, | 123 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a1d4ede5b892..7e351e345476 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -135,10 +135,15 @@ static struct usb_device_id blacklist_table[] = { | |||
| 135 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 135 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
| 136 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 136 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 137 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 138 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | ||
| 139 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | ||
| 138 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
| 139 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
| 140 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
| 141 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, | 143 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, |
| 144 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | ||
| 145 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, | ||
| 146 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, | ||
| 142 | 147 | ||
| 143 | /* Atheros AR5BBU12 with sflash firmware */ | 148 | /* Atheros AR5BBU12 with sflash firmware */ |
| 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 149 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 684b0d53764f..ee4dbeafb377 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -2062,7 +2062,8 @@ static void virtcons_remove(struct virtio_device *vdev) | |||
| 2062 | /* Disable interrupts for vqs */ | 2062 | /* Disable interrupts for vqs */ |
| 2063 | vdev->config->reset(vdev); | 2063 | vdev->config->reset(vdev); |
| 2064 | /* Finish up work that's lined up */ | 2064 | /* Finish up work that's lined up */ |
| 2065 | cancel_work_sync(&portdev->control_work); | 2065 | if (use_multiport(portdev)) |
| 2066 | cancel_work_sync(&portdev->control_work); | ||
| 2066 | 2067 | ||
| 2067 | list_for_each_entry_safe(port, port2, &portdev->ports, list) | 2068 | list_for_each_entry_safe(port, port2, &portdev->ports, list) |
| 2068 | unplug_port(port); | 2069 | unplug_port(port); |
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 281f566a5513..d1e9eb191f2b 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
| @@ -340,7 +340,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
| 340 | /* | 340 | /* |
| 341 | * Alocate and fill the csrow/channels structs | 341 | * Alocate and fill the csrow/channels structs |
| 342 | */ | 342 | */ |
| 343 | mci->csrows = kcalloc(sizeof(*mci->csrows), tot_csrows, GFP_KERNEL); | 343 | mci->csrows = kcalloc(tot_csrows, sizeof(*mci->csrows), GFP_KERNEL); |
| 344 | if (!mci->csrows) | 344 | if (!mci->csrows) |
| 345 | goto error; | 345 | goto error; |
| 346 | for (row = 0; row < tot_csrows; row++) { | 346 | for (row = 0; row < tot_csrows; row++) { |
| @@ -351,7 +351,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
| 351 | csr->csrow_idx = row; | 351 | csr->csrow_idx = row; |
| 352 | csr->mci = mci; | 352 | csr->mci = mci; |
| 353 | csr->nr_channels = tot_channels; | 353 | csr->nr_channels = tot_channels; |
| 354 | csr->channels = kcalloc(sizeof(*csr->channels), tot_channels, | 354 | csr->channels = kcalloc(tot_channels, sizeof(*csr->channels), |
| 355 | GFP_KERNEL); | 355 | GFP_KERNEL); |
| 356 | if (!csr->channels) | 356 | if (!csr->channels) |
| 357 | goto error; | 357 | goto error; |
| @@ -369,7 +369,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
| 369 | /* | 369 | /* |
| 370 | * Allocate and fill the dimm structs | 370 | * Allocate and fill the dimm structs |
| 371 | */ | 371 | */ |
| 372 | mci->dimms = kcalloc(sizeof(*mci->dimms), tot_dimms, GFP_KERNEL); | 372 | mci->dimms = kcalloc(tot_dimms, sizeof(*mci->dimms), GFP_KERNEL); |
| 373 | if (!mci->dimms) | 373 | if (!mci->dimms) |
| 374 | goto error; | 374 | goto error; |
| 375 | 375 | ||
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c index dc6e905ee1a5..0056c4dae9d5 100644 --- a/drivers/edac/edac_pci_sysfs.c +++ b/drivers/edac/edac_pci_sysfs.c | |||
| @@ -256,7 +256,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj, | |||
| 256 | struct edac_pci_dev_attribute *edac_pci_dev; | 256 | struct edac_pci_dev_attribute *edac_pci_dev; |
| 257 | edac_pci_dev = (struct edac_pci_dev_attribute *)attr; | 257 | edac_pci_dev = (struct edac_pci_dev_attribute *)attr; |
| 258 | 258 | ||
| 259 | if (edac_pci_dev->show) | 259 | if (edac_pci_dev->store) |
| 260 | return edac_pci_dev->store(edac_pci_dev->value, buffer, count); | 260 | return edac_pci_dev->store(edac_pci_dev->value, buffer, count); |
| 261 | return -EIO; | 261 | return -EIO; |
| 262 | } | 262 | } |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index fd3ae6290d71..982f1f5f5742 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
| @@ -471,7 +471,7 @@ void __init dmi_scan_machine(void) | |||
| 471 | char __iomem *p, *q; | 471 | char __iomem *p, *q; |
| 472 | int rc; | 472 | int rc; |
| 473 | 473 | ||
| 474 | if (efi_enabled) { | 474 | if (efi_enabled(EFI_CONFIG_TABLES)) { |
| 475 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) | 475 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) |
| 476 | goto error; | 476 | goto error; |
| 477 | 477 | ||
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 7b1c37497c9a..f5596db0cf58 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
| @@ -674,7 +674,7 @@ static int efi_status_to_err(efi_status_t status) | |||
| 674 | err = -EACCES; | 674 | err = -EACCES; |
| 675 | break; | 675 | break; |
| 676 | case EFI_NOT_FOUND: | 676 | case EFI_NOT_FOUND: |
| 677 | err = -ENOENT; | 677 | err = -EIO; |
| 678 | break; | 678 | break; |
| 679 | default: | 679 | default: |
| 680 | err = -EINVAL; | 680 | err = -EINVAL; |
| @@ -793,6 +793,7 @@ static ssize_t efivarfs_file_write(struct file *file, | |||
| 793 | spin_unlock(&efivars->lock); | 793 | spin_unlock(&efivars->lock); |
| 794 | efivar_unregister(var); | 794 | efivar_unregister(var); |
| 795 | drop_nlink(inode); | 795 | drop_nlink(inode); |
| 796 | d_delete(file->f_dentry); | ||
| 796 | dput(file->f_dentry); | 797 | dput(file->f_dentry); |
| 797 | 798 | ||
| 798 | } else { | 799 | } else { |
| @@ -994,7 +995,7 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 994 | list_del(&var->list); | 995 | list_del(&var->list); |
| 995 | spin_unlock(&efivars->lock); | 996 | spin_unlock(&efivars->lock); |
| 996 | efivar_unregister(var); | 997 | efivar_unregister(var); |
| 997 | drop_nlink(dir); | 998 | drop_nlink(dentry->d_inode); |
| 998 | dput(dentry); | 999 | dput(dentry); |
| 999 | return 0; | 1000 | return 0; |
| 1000 | } | 1001 | } |
| @@ -1782,7 +1783,7 @@ efivars_init(void) | |||
| 1782 | printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION, | 1783 | printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION, |
| 1783 | EFIVARS_DATE); | 1784 | EFIVARS_DATE); |
| 1784 | 1785 | ||
| 1785 | if (!efi_enabled) | 1786 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) |
| 1786 | return 0; | 1787 | return 0; |
| 1787 | 1788 | ||
| 1788 | /* For now we'll register the efi directory at /sys/firmware/efi */ | 1789 | /* For now we'll register the efi directory at /sys/firmware/efi */ |
| @@ -1822,7 +1823,7 @@ err_put: | |||
| 1822 | static void __exit | 1823 | static void __exit |
| 1823 | efivars_exit(void) | 1824 | efivars_exit(void) |
| 1824 | { | 1825 | { |
| 1825 | if (efi_enabled) { | 1826 | if (efi_enabled(EFI_RUNTIME_SERVICES)) { |
| 1826 | unregister_efivars(&__efivars); | 1827 | unregister_efivars(&__efivars); |
| 1827 | kobject_put(efi_kobj); | 1828 | kobject_put(efi_kobj); |
| 1828 | } | 1829 | } |
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c index 4da4eb9ae926..2224f1dc074b 100644 --- a/drivers/firmware/iscsi_ibft_find.c +++ b/drivers/firmware/iscsi_ibft_find.c | |||
| @@ -99,7 +99,7 @@ unsigned long __init find_ibft_region(unsigned long *sizep) | |||
| 99 | /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will | 99 | /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will |
| 100 | * only use ACPI for this */ | 100 | * only use ACPI for this */ |
| 101 | 101 | ||
| 102 | if (!efi_enabled) | 102 | if (!efi_enabled(EFI_BOOT)) |
| 103 | find_ibft_in_mem(); | 103 | find_ibft_in_mem(); |
| 104 | 104 | ||
| 105 | if (ibft_addr) { | 105 | if (ibft_addr) { |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 1d1f1e5e33f0..046bcda36abe 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
| @@ -24,7 +24,7 @@ config DRM_EXYNOS_DMABUF | |||
| 24 | 24 | ||
| 25 | config DRM_EXYNOS_FIMD | 25 | config DRM_EXYNOS_FIMD |
| 26 | bool "Exynos DRM FIMD" | 26 | bool "Exynos DRM FIMD" |
| 27 | depends on DRM_EXYNOS && !FB_S3C | 27 | depends on DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM |
| 28 | help | 28 | help |
| 29 | Choose this option if you want to use Exynos FIMD for DRM. | 29 | Choose this option if you want to use Exynos FIMD for DRM. |
| 30 | 30 | ||
| @@ -48,7 +48,7 @@ config DRM_EXYNOS_G2D | |||
| 48 | 48 | ||
| 49 | config DRM_EXYNOS_IPP | 49 | config DRM_EXYNOS_IPP |
| 50 | bool "Exynos DRM IPP" | 50 | bool "Exynos DRM IPP" |
| 51 | depends on DRM_EXYNOS | 51 | depends on DRM_EXYNOS && !ARCH_MULTIPLATFORM |
| 52 | help | 52 | help |
| 53 | Choose this option if you want to use IPP feature for DRM. | 53 | Choose this option if you want to use IPP feature for DRM. |
| 54 | 54 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index ab37437bad8a..4c5b6859c9ea 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include "exynos_drm_drv.h" | 18 | #include "exynos_drm_drv.h" |
| 19 | #include "exynos_drm_encoder.h" | 19 | #include "exynos_drm_encoder.h" |
| 20 | 20 | ||
| 21 | #define MAX_EDID 256 | ||
| 22 | #define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\ | 21 | #define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\ |
| 23 | drm_connector) | 22 | drm_connector) |
| 24 | 23 | ||
| @@ -96,7 +95,9 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 96 | to_exynos_connector(connector); | 95 | to_exynos_connector(connector); |
| 97 | struct exynos_drm_manager *manager = exynos_connector->manager; | 96 | struct exynos_drm_manager *manager = exynos_connector->manager; |
| 98 | struct exynos_drm_display_ops *display_ops = manager->display_ops; | 97 | struct exynos_drm_display_ops *display_ops = manager->display_ops; |
| 99 | unsigned int count; | 98 | struct edid *edid = NULL; |
| 99 | unsigned int count = 0; | ||
| 100 | int ret; | ||
| 100 | 101 | ||
| 101 | DRM_DEBUG_KMS("%s\n", __FILE__); | 102 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 102 | 103 | ||
| @@ -114,27 +115,21 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 114 | * because lcd panel has only one mode. | 115 | * because lcd panel has only one mode. |
| 115 | */ | 116 | */ |
| 116 | if (display_ops->get_edid) { | 117 | if (display_ops->get_edid) { |
| 117 | int ret; | 118 | edid = display_ops->get_edid(manager->dev, connector); |
| 118 | void *edid; | 119 | if (IS_ERR_OR_NULL(edid)) { |
| 119 | 120 | ret = PTR_ERR(edid); | |
| 120 | edid = kzalloc(MAX_EDID, GFP_KERNEL); | 121 | edid = NULL; |
| 121 | if (!edid) { | 122 | DRM_ERROR("Panel operation get_edid failed %d\n", ret); |
| 122 | DRM_ERROR("failed to allocate edid\n"); | 123 | goto out; |
| 123 | return 0; | ||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | ret = display_ops->get_edid(manager->dev, connector, | 126 | count = drm_add_edid_modes(connector, edid); |
| 127 | edid, MAX_EDID); | 127 | if (count < 0) { |
| 128 | if (ret < 0) { | 128 | DRM_ERROR("Add edid modes failed %d\n", count); |
| 129 | DRM_ERROR("failed to get edid data.\n"); | 129 | goto out; |
| 130 | kfree(edid); | ||
| 131 | edid = NULL; | ||
| 132 | return 0; | ||
| 133 | } | 130 | } |
| 134 | 131 | ||
| 135 | drm_mode_connector_update_edid_property(connector, edid); | 132 | drm_mode_connector_update_edid_property(connector, edid); |
| 136 | count = drm_add_edid_modes(connector, edid); | ||
| 137 | kfree(edid); | ||
| 138 | } else { | 133 | } else { |
| 139 | struct exynos_drm_panel_info *panel; | 134 | struct exynos_drm_panel_info *panel; |
| 140 | struct drm_display_mode *mode = drm_mode_create(connector->dev); | 135 | struct drm_display_mode *mode = drm_mode_create(connector->dev); |
| @@ -161,6 +156,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 161 | count = 1; | 156 | count = 1; |
| 162 | } | 157 | } |
| 163 | 158 | ||
| 159 | out: | ||
| 160 | kfree(edid); | ||
| 164 | return count; | 161 | return count; |
| 165 | } | 162 | } |
| 166 | 163 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index 9df97714b6c0..ba0a3aa78547 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | struct exynos_drm_dmabuf_attachment { | 19 | struct exynos_drm_dmabuf_attachment { |
| 20 | struct sg_table sgt; | 20 | struct sg_table sgt; |
| 21 | enum dma_data_direction dir; | 21 | enum dma_data_direction dir; |
| 22 | bool is_mapped; | ||
| 22 | }; | 23 | }; |
| 23 | 24 | ||
| 24 | static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf, | 25 | static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf, |
| @@ -72,17 +73,10 @@ static struct sg_table * | |||
| 72 | 73 | ||
| 73 | DRM_DEBUG_PRIME("%s\n", __FILE__); | 74 | DRM_DEBUG_PRIME("%s\n", __FILE__); |
| 74 | 75 | ||
| 75 | if (WARN_ON(dir == DMA_NONE)) | ||
| 76 | return ERR_PTR(-EINVAL); | ||
| 77 | |||
| 78 | /* just return current sgt if already requested. */ | 76 | /* just return current sgt if already requested. */ |
| 79 | if (exynos_attach->dir == dir) | 77 | if (exynos_attach->dir == dir && exynos_attach->is_mapped) |
| 80 | return &exynos_attach->sgt; | 78 | return &exynos_attach->sgt; |
| 81 | 79 | ||
| 82 | /* reattaching is not allowed. */ | ||
| 83 | if (WARN_ON(exynos_attach->dir != DMA_NONE)) | ||
| 84 | return ERR_PTR(-EBUSY); | ||
| 85 | |||
| 86 | buf = gem_obj->buffer; | 80 | buf = gem_obj->buffer; |
| 87 | if (!buf) { | 81 | if (!buf) { |
| 88 | DRM_ERROR("buffer is null.\n"); | 82 | DRM_ERROR("buffer is null.\n"); |
| @@ -107,13 +101,17 @@ static struct sg_table * | |||
| 107 | wr = sg_next(wr); | 101 | wr = sg_next(wr); |
| 108 | } | 102 | } |
| 109 | 103 | ||
| 110 | nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir); | 104 | if (dir != DMA_NONE) { |
| 111 | if (!nents) { | 105 | nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir); |
| 112 | DRM_ERROR("failed to map sgl with iommu.\n"); | 106 | if (!nents) { |
| 113 | sgt = ERR_PTR(-EIO); | 107 | DRM_ERROR("failed to map sgl with iommu.\n"); |
| 114 | goto err_unlock; | 108 | sg_free_table(sgt); |
| 109 | sgt = ERR_PTR(-EIO); | ||
| 110 | goto err_unlock; | ||
| 111 | } | ||
| 115 | } | 112 | } |
| 116 | 113 | ||
| 114 | exynos_attach->is_mapped = true; | ||
| 117 | exynos_attach->dir = dir; | 115 | exynos_attach->dir = dir; |
| 118 | attach->priv = exynos_attach; | 116 | attach->priv = exynos_attach; |
| 119 | 117 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b9e51bc09e81..4606fac7241a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
| @@ -148,8 +148,8 @@ struct exynos_drm_overlay { | |||
| 148 | struct exynos_drm_display_ops { | 148 | struct exynos_drm_display_ops { |
| 149 | enum exynos_drm_output_type type; | 149 | enum exynos_drm_output_type type; |
| 150 | bool (*is_connected)(struct device *dev); | 150 | bool (*is_connected)(struct device *dev); |
| 151 | int (*get_edid)(struct device *dev, struct drm_connector *connector, | 151 | struct edid *(*get_edid)(struct device *dev, |
| 152 | u8 *edid, int len); | 152 | struct drm_connector *connector); |
| 153 | void *(*get_panel)(struct device *dev); | 153 | void *(*get_panel)(struct device *dev); |
| 154 | int (*check_timing)(struct device *dev, void *timing); | 154 | int (*check_timing)(struct device *dev, void *timing); |
| 155 | int (*power_on)(struct device *dev, int mode); | 155 | int (*power_on)(struct device *dev, int mode); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 36c3905536a6..9a4c08e7453c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
| @@ -324,7 +324,7 @@ out: | |||
| 324 | g2d_userptr = NULL; | 324 | g2d_userptr = NULL; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | 327 | static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, |
| 328 | unsigned long userptr, | 328 | unsigned long userptr, |
| 329 | unsigned long size, | 329 | unsigned long size, |
| 330 | struct drm_file *filp, | 330 | struct drm_file *filp, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 850e9950b7da..28644539b305 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
| @@ -108,18 +108,17 @@ static bool drm_hdmi_is_connected(struct device *dev) | |||
| 108 | return false; | 108 | return false; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static int drm_hdmi_get_edid(struct device *dev, | 111 | static struct edid *drm_hdmi_get_edid(struct device *dev, |
| 112 | struct drm_connector *connector, u8 *edid, int len) | 112 | struct drm_connector *connector) |
| 113 | { | 113 | { |
| 114 | struct drm_hdmi_context *ctx = to_context(dev); | 114 | struct drm_hdmi_context *ctx = to_context(dev); |
| 115 | 115 | ||
| 116 | DRM_DEBUG_KMS("%s\n", __FILE__); | 116 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 117 | 117 | ||
| 118 | if (hdmi_ops && hdmi_ops->get_edid) | 118 | if (hdmi_ops && hdmi_ops->get_edid) |
| 119 | return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, | 119 | return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector); |
| 120 | len); | ||
| 121 | 120 | ||
| 122 | return 0; | 121 | return NULL; |
| 123 | } | 122 | } |
| 124 | 123 | ||
| 125 | static int drm_hdmi_check_timing(struct device *dev, void *timing) | 124 | static int drm_hdmi_check_timing(struct device *dev, void *timing) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 784a7e9a766c..d80516fc9ed7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h | |||
| @@ -30,8 +30,8 @@ struct exynos_drm_hdmi_context { | |||
| 30 | struct exynos_hdmi_ops { | 30 | struct exynos_hdmi_ops { |
| 31 | /* display */ | 31 | /* display */ |
| 32 | bool (*is_connected)(void *ctx); | 32 | bool (*is_connected)(void *ctx); |
| 33 | int (*get_edid)(void *ctx, struct drm_connector *connector, | 33 | struct edid *(*get_edid)(void *ctx, |
| 34 | u8 *edid, int len); | 34 | struct drm_connector *connector); |
| 35 | int (*check_timing)(void *ctx, void *timing); | 35 | int (*check_timing)(void *ctx, void *timing); |
| 36 | int (*power_on)(void *ctx, int mode); | 36 | int (*power_on)(void *ctx, int mode); |
| 37 | 37 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 0bda96454a02..1a556354e92f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
| @@ -869,7 +869,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, | |||
| 869 | } | 869 | } |
| 870 | } | 870 | } |
| 871 | 871 | ||
| 872 | void ipp_handle_cmd_work(struct device *dev, | 872 | static void ipp_handle_cmd_work(struct device *dev, |
| 873 | struct exynos_drm_ippdrv *ippdrv, | 873 | struct exynos_drm_ippdrv *ippdrv, |
| 874 | struct drm_exynos_ipp_cmd_work *cmd_work, | 874 | struct drm_exynos_ipp_cmd_work *cmd_work, |
| 875 | struct drm_exynos_ipp_cmd_node *c_node) | 875 | struct drm_exynos_ipp_cmd_node *c_node) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index e9e83ef688f0..f976e29def6e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
| @@ -734,7 +734,7 @@ static int rotator_remove(struct platform_device *pdev) | |||
| 734 | return 0; | 734 | return 0; |
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | struct rot_limit_table rot_limit_tbl = { | 737 | static struct rot_limit_table rot_limit_tbl = { |
| 738 | .ycbcr420_2p = { | 738 | .ycbcr420_2p = { |
| 739 | .min_w = 32, | 739 | .min_w = 32, |
| 740 | .min_h = 32, | 740 | .min_h = 32, |
| @@ -751,7 +751,7 @@ struct rot_limit_table rot_limit_tbl = { | |||
| 751 | }, | 751 | }, |
| 752 | }; | 752 | }; |
| 753 | 753 | ||
| 754 | struct platform_device_id rotator_driver_ids[] = { | 754 | static struct platform_device_id rotator_driver_ids[] = { |
| 755 | { | 755 | { |
| 756 | .name = "exynos-rot", | 756 | .name = "exynos-rot", |
| 757 | .driver_data = (unsigned long)&rot_limit_tbl, | 757 | .driver_data = (unsigned long)&rot_limit_tbl, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index d0ca3c4e06c6..13ccbd4bcfaa 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
| @@ -98,10 +98,12 @@ static bool vidi_display_is_connected(struct device *dev) | |||
| 98 | return ctx->connected ? true : false; | 98 | return ctx->connected ? true : false; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | static int vidi_get_edid(struct device *dev, struct drm_connector *connector, | 101 | static struct edid *vidi_get_edid(struct device *dev, |
| 102 | u8 *edid, int len) | 102 | struct drm_connector *connector) |
| 103 | { | 103 | { |
| 104 | struct vidi_context *ctx = get_vidi_context(dev); | 104 | struct vidi_context *ctx = get_vidi_context(dev); |
| 105 | struct edid *edid; | ||
| 106 | int edid_len; | ||
| 105 | 107 | ||
| 106 | DRM_DEBUG_KMS("%s\n", __FILE__); | 108 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 107 | 109 | ||
| @@ -111,13 +113,18 @@ static int vidi_get_edid(struct device *dev, struct drm_connector *connector, | |||
| 111 | */ | 113 | */ |
| 112 | if (!ctx->raw_edid) { | 114 | if (!ctx->raw_edid) { |
| 113 | DRM_DEBUG_KMS("raw_edid is null.\n"); | 115 | DRM_DEBUG_KMS("raw_edid is null.\n"); |
| 114 | return -EFAULT; | 116 | return ERR_PTR(-EFAULT); |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | memcpy(edid, ctx->raw_edid, min((1 + ctx->raw_edid->extensions) | 119 | edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; |
| 118 | * EDID_LENGTH, len)); | 120 | edid = kzalloc(edid_len, GFP_KERNEL); |
| 121 | if (!edid) { | ||
| 122 | DRM_DEBUG_KMS("failed to allocate edid\n"); | ||
| 123 | return ERR_PTR(-ENOMEM); | ||
| 124 | } | ||
| 119 | 125 | ||
| 120 | return 0; | 126 | memcpy(edid, ctx->raw_edid, edid_len); |
| 127 | return edid; | ||
| 121 | } | 128 | } |
| 122 | 129 | ||
| 123 | static void *vidi_get_panel(struct device *dev) | 130 | static void *vidi_get_panel(struct device *dev) |
| @@ -514,7 +521,6 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
| 514 | struct exynos_drm_manager *manager; | 521 | struct exynos_drm_manager *manager; |
| 515 | struct exynos_drm_display_ops *display_ops; | 522 | struct exynos_drm_display_ops *display_ops; |
| 516 | struct drm_exynos_vidi_connection *vidi = data; | 523 | struct drm_exynos_vidi_connection *vidi = data; |
| 517 | struct edid *raw_edid; | ||
| 518 | int edid_len; | 524 | int edid_len; |
| 519 | 525 | ||
| 520 | DRM_DEBUG_KMS("%s\n", __FILE__); | 526 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| @@ -551,11 +557,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
| 551 | } | 557 | } |
| 552 | 558 | ||
| 553 | if (vidi->connection) { | 559 | if (vidi->connection) { |
| 554 | if (!vidi->edid) { | 560 | struct edid *raw_edid = (struct edid *)(uint32_t)vidi->edid; |
| 555 | DRM_DEBUG_KMS("edid data is null.\n"); | 561 | if (!drm_edid_is_valid(raw_edid)) { |
| 562 | DRM_DEBUG_KMS("edid data is invalid.\n"); | ||
| 556 | return -EINVAL; | 563 | return -EINVAL; |
| 557 | } | 564 | } |
| 558 | raw_edid = (struct edid *)(uint32_t)vidi->edid; | ||
| 559 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; | 565 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; |
| 560 | ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); | 566 | ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); |
| 561 | if (!ctx->raw_edid) { | 567 | if (!ctx->raw_edid) { |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 41ff79d8ac8e..fbab3c468603 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <linux/regulator/consumer.h> | 34 | #include <linux/regulator/consumer.h> |
| 35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
| 36 | #include <linux/of_gpio.h> | 36 | #include <linux/of_gpio.h> |
| 37 | #include <plat/gpio-cfg.h> | ||
| 38 | 37 | ||
| 39 | #include <drm/exynos_drm.h> | 38 | #include <drm/exynos_drm.h> |
| 40 | 39 | ||
| @@ -98,8 +97,7 @@ struct hdmi_context { | |||
| 98 | 97 | ||
| 99 | void __iomem *regs; | 98 | void __iomem *regs; |
| 100 | void *parent_ctx; | 99 | void *parent_ctx; |
| 101 | int external_irq; | 100 | int irq; |
| 102 | int internal_irq; | ||
| 103 | 101 | ||
| 104 | struct i2c_client *ddc_port; | 102 | struct i2c_client *ddc_port; |
| 105 | struct i2c_client *hdmiphy_port; | 103 | struct i2c_client *hdmiphy_port; |
| @@ -1391,8 +1389,7 @@ static bool hdmi_is_connected(void *ctx) | |||
| 1391 | return hdata->hpd; | 1389 | return hdata->hpd; |
| 1392 | } | 1390 | } |
| 1393 | 1391 | ||
| 1394 | static int hdmi_get_edid(void *ctx, struct drm_connector *connector, | 1392 | static struct edid *hdmi_get_edid(void *ctx, struct drm_connector *connector) |
| 1395 | u8 *edid, int len) | ||
| 1396 | { | 1393 | { |
| 1397 | struct edid *raw_edid; | 1394 | struct edid *raw_edid; |
| 1398 | struct hdmi_context *hdata = ctx; | 1395 | struct hdmi_context *hdata = ctx; |
| @@ -1400,22 +1397,18 @@ static int hdmi_get_edid(void *ctx, struct drm_connector *connector, | |||
| 1400 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1397 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 1401 | 1398 | ||
| 1402 | if (!hdata->ddc_port) | 1399 | if (!hdata->ddc_port) |
| 1403 | return -ENODEV; | 1400 | return ERR_PTR(-ENODEV); |
| 1404 | 1401 | ||
| 1405 | raw_edid = drm_get_edid(connector, hdata->ddc_port->adapter); | 1402 | raw_edid = drm_get_edid(connector, hdata->ddc_port->adapter); |
| 1406 | if (raw_edid) { | 1403 | if (!raw_edid) |
| 1407 | hdata->dvi_mode = !drm_detect_hdmi_monitor(raw_edid); | 1404 | return ERR_PTR(-ENODEV); |
| 1408 | memcpy(edid, raw_edid, min((1 + raw_edid->extensions) | ||
| 1409 | * EDID_LENGTH, len)); | ||
| 1410 | DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n", | ||
| 1411 | (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), | ||
| 1412 | raw_edid->width_cm, raw_edid->height_cm); | ||
| 1413 | kfree(raw_edid); | ||
| 1414 | } else { | ||
| 1415 | return -ENODEV; | ||
| 1416 | } | ||
| 1417 | 1405 | ||
| 1418 | return 0; | 1406 | hdata->dvi_mode = !drm_detect_hdmi_monitor(raw_edid); |
| 1407 | DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n", | ||
| 1408 | (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), | ||
| 1409 | raw_edid->width_cm, raw_edid->height_cm); | ||
| 1410 | |||
| 1411 | return raw_edid; | ||
| 1419 | } | 1412 | } |
| 1420 | 1413 | ||
| 1421 | static int hdmi_v13_check_timing(struct fb_videomode *check_timing) | 1414 | static int hdmi_v13_check_timing(struct fb_videomode *check_timing) |
| @@ -1652,16 +1645,16 @@ static void hdmi_conf_reset(struct hdmi_context *hdata) | |||
| 1652 | 1645 | ||
| 1653 | /* resetting HDMI core */ | 1646 | /* resetting HDMI core */ |
| 1654 | hdmi_reg_writemask(hdata, reg, 0, HDMI_CORE_SW_RSTOUT); | 1647 | hdmi_reg_writemask(hdata, reg, 0, HDMI_CORE_SW_RSTOUT); |
| 1655 | mdelay(10); | 1648 | usleep_range(10000, 12000); |
| 1656 | hdmi_reg_writemask(hdata, reg, ~0, HDMI_CORE_SW_RSTOUT); | 1649 | hdmi_reg_writemask(hdata, reg, ~0, HDMI_CORE_SW_RSTOUT); |
| 1657 | mdelay(10); | 1650 | usleep_range(10000, 12000); |
| 1658 | } | 1651 | } |
| 1659 | 1652 | ||
| 1660 | static void hdmi_conf_init(struct hdmi_context *hdata) | 1653 | static void hdmi_conf_init(struct hdmi_context *hdata) |
| 1661 | { | 1654 | { |
| 1662 | struct hdmi_infoframe infoframe; | 1655 | struct hdmi_infoframe infoframe; |
| 1663 | 1656 | ||
| 1664 | /* disable HPD interrupts */ | 1657 | /* disable HPD interrupts from HDMI IP block, use GPIO instead */ |
| 1665 | hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | | 1658 | hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | |
| 1666 | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); | 1659 | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); |
| 1667 | 1660 | ||
| @@ -1779,7 +1772,7 @@ static void hdmi_v13_timing_apply(struct hdmi_context *hdata) | |||
| 1779 | u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS); | 1772 | u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS); |
| 1780 | if (val & HDMI_PHY_STATUS_READY) | 1773 | if (val & HDMI_PHY_STATUS_READY) |
| 1781 | break; | 1774 | break; |
| 1782 | mdelay(1); | 1775 | usleep_range(1000, 2000); |
| 1783 | } | 1776 | } |
| 1784 | /* steady state not achieved */ | 1777 | /* steady state not achieved */ |
| 1785 | if (tries == 0) { | 1778 | if (tries == 0) { |
| @@ -1946,7 +1939,7 @@ static void hdmi_v14_timing_apply(struct hdmi_context *hdata) | |||
| 1946 | u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS_0); | 1939 | u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS_0); |
| 1947 | if (val & HDMI_PHY_STATUS_READY) | 1940 | if (val & HDMI_PHY_STATUS_READY) |
| 1948 | break; | 1941 | break; |
| 1949 | mdelay(1); | 1942 | usleep_range(1000, 2000); |
| 1950 | } | 1943 | } |
| 1951 | /* steady state not achieved */ | 1944 | /* steady state not achieved */ |
| 1952 | if (tries == 0) { | 1945 | if (tries == 0) { |
| @@ -1998,9 +1991,9 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata) | |||
| 1998 | 1991 | ||
| 1999 | /* reset hdmiphy */ | 1992 | /* reset hdmiphy */ |
| 2000 | hdmi_reg_writemask(hdata, reg, ~0, HDMI_PHY_SW_RSTOUT); | 1993 | hdmi_reg_writemask(hdata, reg, ~0, HDMI_PHY_SW_RSTOUT); |
| 2001 | mdelay(10); | 1994 | usleep_range(10000, 12000); |
| 2002 | hdmi_reg_writemask(hdata, reg, 0, HDMI_PHY_SW_RSTOUT); | 1995 | hdmi_reg_writemask(hdata, reg, 0, HDMI_PHY_SW_RSTOUT); |
| 2003 | mdelay(10); | 1996 | usleep_range(10000, 12000); |
| 2004 | } | 1997 | } |
| 2005 | 1998 | ||
| 2006 | static void hdmiphy_poweron(struct hdmi_context *hdata) | 1999 | static void hdmiphy_poweron(struct hdmi_context *hdata) |
| @@ -2048,7 +2041,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) | |||
| 2048 | return; | 2041 | return; |
| 2049 | } | 2042 | } |
| 2050 | 2043 | ||
| 2051 | mdelay(10); | 2044 | usleep_range(10000, 12000); |
| 2052 | 2045 | ||
| 2053 | /* operation mode */ | 2046 | /* operation mode */ |
| 2054 | operation[0] = 0x1f; | 2047 | operation[0] = 0x1f; |
| @@ -2170,6 +2163,13 @@ static void hdmi_commit(void *ctx) | |||
| 2170 | 2163 | ||
| 2171 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2164 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 2172 | 2165 | ||
| 2166 | mutex_lock(&hdata->hdmi_mutex); | ||
| 2167 | if (!hdata->powered) { | ||
| 2168 | mutex_unlock(&hdata->hdmi_mutex); | ||
| 2169 | return; | ||
| 2170 | } | ||
| 2171 | mutex_unlock(&hdata->hdmi_mutex); | ||
| 2172 | |||
| 2173 | hdmi_conf_apply(hdata); | 2173 | hdmi_conf_apply(hdata); |
| 2174 | } | 2174 | } |
| 2175 | 2175 | ||
| @@ -2265,7 +2265,7 @@ static struct exynos_hdmi_ops hdmi_ops = { | |||
| 2265 | .dpms = hdmi_dpms, | 2265 | .dpms = hdmi_dpms, |
| 2266 | }; | 2266 | }; |
| 2267 | 2267 | ||
| 2268 | static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) | 2268 | static irqreturn_t hdmi_irq_thread(int irq, void *arg) |
| 2269 | { | 2269 | { |
| 2270 | struct exynos_drm_hdmi_context *ctx = arg; | 2270 | struct exynos_drm_hdmi_context *ctx = arg; |
| 2271 | struct hdmi_context *hdata = ctx->ctx; | 2271 | struct hdmi_context *hdata = ctx->ctx; |
| @@ -2280,31 +2280,6 @@ static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) | |||
| 2280 | return IRQ_HANDLED; | 2280 | return IRQ_HANDLED; |
| 2281 | } | 2281 | } |
| 2282 | 2282 | ||
| 2283 | static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) | ||
| 2284 | { | ||
| 2285 | struct exynos_drm_hdmi_context *ctx = arg; | ||
| 2286 | struct hdmi_context *hdata = ctx->ctx; | ||
| 2287 | u32 intc_flag; | ||
| 2288 | |||
| 2289 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); | ||
| 2290 | /* clearing flags for HPD plug/unplug */ | ||
| 2291 | if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) { | ||
| 2292 | DRM_DEBUG_KMS("unplugged\n"); | ||
| 2293 | hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, | ||
| 2294 | HDMI_INTC_FLAG_HPD_UNPLUG); | ||
| 2295 | } | ||
| 2296 | if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) { | ||
| 2297 | DRM_DEBUG_KMS("plugged\n"); | ||
| 2298 | hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, | ||
| 2299 | HDMI_INTC_FLAG_HPD_PLUG); | ||
| 2300 | } | ||
| 2301 | |||
| 2302 | if (ctx->drm_dev) | ||
| 2303 | drm_helper_hpd_irq_event(ctx->drm_dev); | ||
| 2304 | |||
| 2305 | return IRQ_HANDLED; | ||
| 2306 | } | ||
| 2307 | |||
| 2308 | static int hdmi_resources_init(struct hdmi_context *hdata) | 2283 | static int hdmi_resources_init(struct hdmi_context *hdata) |
| 2309 | { | 2284 | { |
| 2310 | struct device *dev = hdata->dev; | 2285 | struct device *dev = hdata->dev; |
| @@ -2555,39 +2530,24 @@ static int hdmi_probe(struct platform_device *pdev) | |||
| 2555 | 2530 | ||
| 2556 | hdata->hdmiphy_port = hdmi_hdmiphy; | 2531 | hdata->hdmiphy_port = hdmi_hdmiphy; |
| 2557 | 2532 | ||
| 2558 | hdata->external_irq = gpio_to_irq(hdata->hpd_gpio); | 2533 | hdata->irq = gpio_to_irq(hdata->hpd_gpio); |
| 2559 | if (hdata->external_irq < 0) { | 2534 | if (hdata->irq < 0) { |
| 2560 | DRM_ERROR("failed to get GPIO external irq\n"); | 2535 | DRM_ERROR("failed to get GPIO irq\n"); |
| 2561 | ret = hdata->external_irq; | 2536 | ret = hdata->irq; |
| 2562 | goto err_hdmiphy; | ||
| 2563 | } | ||
| 2564 | |||
| 2565 | hdata->internal_irq = platform_get_irq(pdev, 0); | ||
| 2566 | if (hdata->internal_irq < 0) { | ||
| 2567 | DRM_ERROR("failed to get platform internal irq\n"); | ||
| 2568 | ret = hdata->internal_irq; | ||
| 2569 | goto err_hdmiphy; | 2537 | goto err_hdmiphy; |
| 2570 | } | 2538 | } |
| 2571 | 2539 | ||
| 2572 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); | 2540 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); |
| 2573 | 2541 | ||
| 2574 | ret = request_threaded_irq(hdata->external_irq, NULL, | 2542 | ret = request_threaded_irq(hdata->irq, NULL, |
| 2575 | hdmi_external_irq_thread, IRQF_TRIGGER_RISING | | 2543 | hdmi_irq_thread, IRQF_TRIGGER_RISING | |
| 2576 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 2544 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 2577 | "hdmi_external", drm_hdmi_ctx); | 2545 | "hdmi", drm_hdmi_ctx); |
| 2578 | if (ret) { | 2546 | if (ret) { |
| 2579 | DRM_ERROR("failed to register hdmi external interrupt\n"); | 2547 | DRM_ERROR("failed to register hdmi interrupt\n"); |
| 2580 | goto err_hdmiphy; | 2548 | goto err_hdmiphy; |
| 2581 | } | 2549 | } |
| 2582 | 2550 | ||
| 2583 | ret = request_threaded_irq(hdata->internal_irq, NULL, | ||
| 2584 | hdmi_internal_irq_thread, IRQF_ONESHOT, | ||
| 2585 | "hdmi_internal", drm_hdmi_ctx); | ||
| 2586 | if (ret) { | ||
| 2587 | DRM_ERROR("failed to register hdmi internal interrupt\n"); | ||
| 2588 | goto err_free_irq; | ||
| 2589 | } | ||
| 2590 | |||
| 2591 | /* Attach HDMI Driver to common hdmi. */ | 2551 | /* Attach HDMI Driver to common hdmi. */ |
| 2592 | exynos_hdmi_drv_attach(drm_hdmi_ctx); | 2552 | exynos_hdmi_drv_attach(drm_hdmi_ctx); |
| 2593 | 2553 | ||
| @@ -2598,8 +2558,6 @@ static int hdmi_probe(struct platform_device *pdev) | |||
| 2598 | 2558 | ||
| 2599 | return 0; | 2559 | return 0; |
| 2600 | 2560 | ||
| 2601 | err_free_irq: | ||
| 2602 | free_irq(hdata->external_irq, drm_hdmi_ctx); | ||
| 2603 | err_hdmiphy: | 2561 | err_hdmiphy: |
| 2604 | i2c_del_driver(&hdmiphy_driver); | 2562 | i2c_del_driver(&hdmiphy_driver); |
| 2605 | err_ddc: | 2563 | err_ddc: |
| @@ -2617,8 +2575,7 @@ static int hdmi_remove(struct platform_device *pdev) | |||
| 2617 | 2575 | ||
| 2618 | pm_runtime_disable(dev); | 2576 | pm_runtime_disable(dev); |
| 2619 | 2577 | ||
| 2620 | free_irq(hdata->internal_irq, hdata); | 2578 | free_irq(hdata->irq, hdata); |
| 2621 | free_irq(hdata->external_irq, hdata); | ||
| 2622 | 2579 | ||
| 2623 | 2580 | ||
| 2624 | /* hdmiphy i2c driver */ | 2581 | /* hdmiphy i2c driver */ |
| @@ -2637,8 +2594,7 @@ static int hdmi_suspend(struct device *dev) | |||
| 2637 | 2594 | ||
| 2638 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2595 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 2639 | 2596 | ||
| 2640 | disable_irq(hdata->internal_irq); | 2597 | disable_irq(hdata->irq); |
| 2641 | disable_irq(hdata->external_irq); | ||
| 2642 | 2598 | ||
| 2643 | hdata->hpd = false; | 2599 | hdata->hpd = false; |
| 2644 | if (ctx->drm_dev) | 2600 | if (ctx->drm_dev) |
| @@ -2663,8 +2619,7 @@ static int hdmi_resume(struct device *dev) | |||
| 2663 | 2619 | ||
| 2664 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); | 2620 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); |
| 2665 | 2621 | ||
| 2666 | enable_irq(hdata->external_irq); | 2622 | enable_irq(hdata->irq); |
| 2667 | enable_irq(hdata->internal_irq); | ||
| 2668 | 2623 | ||
| 2669 | if (!pm_runtime_suspended(dev)) { | 2624 | if (!pm_runtime_suspended(dev)) { |
| 2670 | DRM_DEBUG_KMS("%s : Already resumed\n", __func__); | 2625 | DRM_DEBUG_KMS("%s : Already resumed\n", __func__); |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index c187ea33b748..c414584bfbae 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
| @@ -600,7 +600,7 @@ static void vp_win_reset(struct mixer_context *ctx) | |||
| 600 | /* waiting until VP_SRESET_PROCESSING is 0 */ | 600 | /* waiting until VP_SRESET_PROCESSING is 0 */ |
| 601 | if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING) | 601 | if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING) |
| 602 | break; | 602 | break; |
| 603 | mdelay(10); | 603 | usleep_range(10000, 12000); |
| 604 | } | 604 | } |
| 605 | WARN(tries == 0, "failed to reset Video Processor\n"); | 605 | WARN(tries == 0, "failed to reset Video Processor\n"); |
| 606 | } | 606 | } |
| @@ -776,6 +776,13 @@ static void mixer_win_commit(void *ctx, int win) | |||
| 776 | 776 | ||
| 777 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 777 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
| 778 | 778 | ||
| 779 | mutex_lock(&mixer_ctx->mixer_mutex); | ||
| 780 | if (!mixer_ctx->powered) { | ||
| 781 | mutex_unlock(&mixer_ctx->mixer_mutex); | ||
| 782 | return; | ||
| 783 | } | ||
| 784 | mutex_unlock(&mixer_ctx->mixer_mutex); | ||
| 785 | |||
| 779 | if (win > 1 && mixer_ctx->vp_enabled) | 786 | if (win > 1 && mixer_ctx->vp_enabled) |
| 780 | vp_video_buffer(mixer_ctx, win); | 787 | vp_video_buffer(mixer_ctx, win); |
| 781 | else | 788 | else |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 7944d301518a..9d4a2c2adf0e 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/debugfs.h> | 30 | #include <linux/debugfs.h> |
| 31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
| 32 | #include <linux/export.h> | 32 | #include <linux/export.h> |
| 33 | #include <generated/utsrelease.h> | ||
| 33 | #include <drm/drmP.h> | 34 | #include <drm/drmP.h> |
| 34 | #include "intel_drv.h" | 35 | #include "intel_drv.h" |
| 35 | #include "intel_ringbuffer.h" | 36 | #include "intel_ringbuffer.h" |
| @@ -690,6 +691,7 @@ static int i915_error_state(struct seq_file *m, void *unused) | |||
| 690 | 691 | ||
| 691 | seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, | 692 | seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, |
| 692 | error->time.tv_usec); | 693 | error->time.tv_usec); |
| 694 | seq_printf(m, "Kernel: " UTS_RELEASE); | ||
| 693 | seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device); | 695 | seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device); |
| 694 | seq_printf(m, "EIR: 0x%08x\n", error->eir); | 696 | seq_printf(m, "EIR: 0x%08x\n", error->eir); |
| 695 | seq_printf(m, "IER: 0x%08x\n", error->ier); | 697 | seq_printf(m, "IER: 0x%08x\n", error->ier); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b401788e1791..59afb7eb6db6 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -533,6 +533,7 @@ | |||
| 533 | #define MI_MODE 0x0209c | 533 | #define MI_MODE 0x0209c |
| 534 | # define VS_TIMER_DISPATCH (1 << 6) | 534 | # define VS_TIMER_DISPATCH (1 << 6) |
| 535 | # define MI_FLUSH_ENABLE (1 << 12) | 535 | # define MI_FLUSH_ENABLE (1 << 12) |
| 536 | # define ASYNC_FLIP_PERF_DISABLE (1 << 14) | ||
| 536 | 537 | ||
| 537 | #define GEN6_GT_MODE 0x20d0 | 538 | #define GEN6_GT_MODE 0x20d0 |
| 538 | #define GEN6_GT_MODE_HI (1 << 9) | 539 | #define GEN6_GT_MODE_HI (1 << 9) |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index ae253e04c391..42ff97d667d2 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
| @@ -505,13 +505,25 @@ static int init_render_ring(struct intel_ring_buffer *ring) | |||
| 505 | struct drm_i915_private *dev_priv = dev->dev_private; | 505 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 506 | int ret = init_ring_common(ring); | 506 | int ret = init_ring_common(ring); |
| 507 | 507 | ||
| 508 | if (INTEL_INFO(dev)->gen > 3) { | 508 | if (INTEL_INFO(dev)->gen > 3) |
| 509 | I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH)); | 509 | I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH)); |
| 510 | if (IS_GEN7(dev)) | 510 | |
| 511 | I915_WRITE(GFX_MODE_GEN7, | 511 | /* We need to disable the AsyncFlip performance optimisations in order |
| 512 | _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) | | 512 | * to use MI_WAIT_FOR_EVENT within the CS. It should already be |
| 513 | _MASKED_BIT_ENABLE(GFX_REPLAY_MODE)); | 513 | * programmed to '1' on all products. |
| 514 | } | 514 | */ |
| 515 | if (INTEL_INFO(dev)->gen >= 6) | ||
| 516 | I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE)); | ||
| 517 | |||
| 518 | /* Required for the hardware to program scanline values for waiting */ | ||
| 519 | if (INTEL_INFO(dev)->gen == 6) | ||
| 520 | I915_WRITE(GFX_MODE, | ||
| 521 | _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS)); | ||
| 522 | |||
| 523 | if (IS_GEN7(dev)) | ||
| 524 | I915_WRITE(GFX_MODE_GEN7, | ||
| 525 | _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) | | ||
| 526 | _MASKED_BIT_ENABLE(GFX_REPLAY_MODE)); | ||
| 515 | 527 | ||
| 516 | if (INTEL_INFO(dev)->gen >= 5) { | 528 | if (INTEL_INFO(dev)->gen >= 5) { |
| 517 | ret = init_pipe_control(ring); | 529 | ret = init_pipe_control(ring); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 4d0e60adbc6d..a2d478e8692a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -1313,14 +1313,18 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav | |||
| 1313 | if (!(tmp & EVERGREEN_CRTC_BLANK_DATA_EN)) { | 1313 | if (!(tmp & EVERGREEN_CRTC_BLANK_DATA_EN)) { |
| 1314 | radeon_wait_for_vblank(rdev, i); | 1314 | radeon_wait_for_vblank(rdev, i); |
| 1315 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; | 1315 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; |
| 1316 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); | ||
| 1316 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); | 1317 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); |
| 1318 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); | ||
| 1317 | } | 1319 | } |
| 1318 | } else { | 1320 | } else { |
| 1319 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); | 1321 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); |
| 1320 | if (!(tmp & EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE)) { | 1322 | if (!(tmp & EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE)) { |
| 1321 | radeon_wait_for_vblank(rdev, i); | 1323 | radeon_wait_for_vblank(rdev, i); |
| 1322 | tmp |= EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE; | 1324 | tmp |= EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE; |
| 1325 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); | ||
| 1323 | WREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i], tmp); | 1326 | WREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i], tmp); |
| 1327 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); | ||
| 1324 | } | 1328 | } |
| 1325 | } | 1329 | } |
| 1326 | /* wait for the next frame */ | 1330 | /* wait for the next frame */ |
| @@ -1345,6 +1349,8 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav | |||
| 1345 | blackout &= ~BLACKOUT_MODE_MASK; | 1349 | blackout &= ~BLACKOUT_MODE_MASK; |
| 1346 | WREG32(MC_SHARED_BLACKOUT_CNTL, blackout | 1); | 1350 | WREG32(MC_SHARED_BLACKOUT_CNTL, blackout | 1); |
| 1347 | } | 1351 | } |
| 1352 | /* wait for the MC to settle */ | ||
| 1353 | udelay(100); | ||
| 1348 | } | 1354 | } |
| 1349 | 1355 | ||
| 1350 | void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save) | 1356 | void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save) |
| @@ -1378,11 +1384,15 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s | |||
| 1378 | if (ASIC_IS_DCE6(rdev)) { | 1384 | if (ASIC_IS_DCE6(rdev)) { |
| 1379 | tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]); | 1385 | tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]); |
| 1380 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; | 1386 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; |
| 1387 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); | ||
| 1381 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); | 1388 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); |
| 1389 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); | ||
| 1382 | } else { | 1390 | } else { |
| 1383 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); | 1391 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); |
| 1384 | tmp &= ~EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE; | 1392 | tmp &= ~EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE; |
| 1393 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); | ||
| 1385 | WREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i], tmp); | 1394 | WREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i], tmp); |
| 1395 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); | ||
| 1386 | } | 1396 | } |
| 1387 | /* wait for the next frame */ | 1397 | /* wait for the next frame */ |
| 1388 | frame_count = radeon_get_vblank_counter(rdev, i); | 1398 | frame_count = radeon_get_vblank_counter(rdev, i); |
| @@ -2036,9 +2046,20 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
| 2036 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); | 2046 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); |
| 2037 | WREG32(DMA_TILING_CONFIG, gb_addr_config); | 2047 | WREG32(DMA_TILING_CONFIG, gb_addr_config); |
| 2038 | 2048 | ||
| 2039 | tmp = gb_addr_config & NUM_PIPES_MASK; | 2049 | if ((rdev->config.evergreen.max_backends == 1) && |
| 2040 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.evergreen.max_backends, | 2050 | (rdev->flags & RADEON_IS_IGP)) { |
| 2041 | EVERGREEN_MAX_BACKENDS, disabled_rb_mask); | 2051 | if ((disabled_rb_mask & 3) == 1) { |
| 2052 | /* RB0 disabled, RB1 enabled */ | ||
| 2053 | tmp = 0x11111111; | ||
| 2054 | } else { | ||
| 2055 | /* RB1 disabled, RB0 enabled */ | ||
| 2056 | tmp = 0x00000000; | ||
| 2057 | } | ||
| 2058 | } else { | ||
| 2059 | tmp = gb_addr_config & NUM_PIPES_MASK; | ||
| 2060 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.evergreen.max_backends, | ||
| 2061 | EVERGREEN_MAX_BACKENDS, disabled_rb_mask); | ||
| 2062 | } | ||
| 2042 | WREG32(GB_BACKEND_MAP, tmp); | 2063 | WREG32(GB_BACKEND_MAP, tmp); |
| 2043 | 2064 | ||
| 2044 | WREG32(CGTS_SYS_TCC_DISABLE, 0); | 2065 | WREG32(CGTS_SYS_TCC_DISABLE, 0); |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 59acabb45c9b..835992d8d067 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
| @@ -1216,7 +1216,7 @@ void cayman_dma_stop(struct radeon_device *rdev) | |||
| 1216 | int cayman_dma_resume(struct radeon_device *rdev) | 1216 | int cayman_dma_resume(struct radeon_device *rdev) |
| 1217 | { | 1217 | { |
| 1218 | struct radeon_ring *ring; | 1218 | struct radeon_ring *ring; |
| 1219 | u32 rb_cntl, dma_cntl; | 1219 | u32 rb_cntl, dma_cntl, ib_cntl; |
| 1220 | u32 rb_bufsz; | 1220 | u32 rb_bufsz; |
| 1221 | u32 reg_offset, wb_offset; | 1221 | u32 reg_offset, wb_offset; |
| 1222 | int i, r; | 1222 | int i, r; |
| @@ -1265,7 +1265,11 @@ int cayman_dma_resume(struct radeon_device *rdev) | |||
| 1265 | WREG32(DMA_RB_BASE + reg_offset, ring->gpu_addr >> 8); | 1265 | WREG32(DMA_RB_BASE + reg_offset, ring->gpu_addr >> 8); |
| 1266 | 1266 | ||
| 1267 | /* enable DMA IBs */ | 1267 | /* enable DMA IBs */ |
| 1268 | WREG32(DMA_IB_CNTL + reg_offset, DMA_IB_ENABLE | CMD_VMID_FORCE); | 1268 | ib_cntl = DMA_IB_ENABLE | CMD_VMID_FORCE; |
| 1269 | #ifdef __BIG_ENDIAN | ||
| 1270 | ib_cntl |= DMA_IB_SWAP_ENABLE; | ||
| 1271 | #endif | ||
| 1272 | WREG32(DMA_IB_CNTL + reg_offset, ib_cntl); | ||
| 1269 | 1273 | ||
| 1270 | dma_cntl = RREG32(DMA_CNTL + reg_offset); | 1274 | dma_cntl = RREG32(DMA_CNTL + reg_offset); |
| 1271 | dma_cntl &= ~CTXEMPTY_INT_ENABLE; | 1275 | dma_cntl &= ~CTXEMPTY_INT_ENABLE; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 3cb9d6089373..becb03e8b32f 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -1462,12 +1462,15 @@ u32 r6xx_remap_render_backend(struct radeon_device *rdev, | |||
| 1462 | u32 disabled_rb_mask) | 1462 | u32 disabled_rb_mask) |
| 1463 | { | 1463 | { |
| 1464 | u32 rendering_pipe_num, rb_num_width, req_rb_num; | 1464 | u32 rendering_pipe_num, rb_num_width, req_rb_num; |
| 1465 | u32 pipe_rb_ratio, pipe_rb_remain; | 1465 | u32 pipe_rb_ratio, pipe_rb_remain, tmp; |
| 1466 | u32 data = 0, mask = 1 << (max_rb_num - 1); | 1466 | u32 data = 0, mask = 1 << (max_rb_num - 1); |
| 1467 | unsigned i, j; | 1467 | unsigned i, j; |
| 1468 | 1468 | ||
| 1469 | /* mask out the RBs that don't exist on that asic */ | 1469 | /* mask out the RBs that don't exist on that asic */ |
| 1470 | disabled_rb_mask |= (0xff << max_rb_num) & 0xff; | 1470 | tmp = disabled_rb_mask | ((0xff << max_rb_num) & 0xff); |
| 1471 | /* make sure at least one RB is available */ | ||
| 1472 | if ((tmp & 0xff) != 0xff) | ||
| 1473 | disabled_rb_mask = tmp; | ||
| 1471 | 1474 | ||
| 1472 | rendering_pipe_num = 1 << tiling_pipe_num; | 1475 | rendering_pipe_num = 1 << tiling_pipe_num; |
| 1473 | req_rb_num = total_max_rb_num - r600_count_pipe_bits(disabled_rb_mask); | 1476 | req_rb_num = total_max_rb_num - r600_count_pipe_bits(disabled_rb_mask); |
| @@ -2313,7 +2316,7 @@ void r600_dma_stop(struct radeon_device *rdev) | |||
| 2313 | int r600_dma_resume(struct radeon_device *rdev) | 2316 | int r600_dma_resume(struct radeon_device *rdev) |
| 2314 | { | 2317 | { |
| 2315 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; | 2318 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; |
| 2316 | u32 rb_cntl, dma_cntl; | 2319 | u32 rb_cntl, dma_cntl, ib_cntl; |
| 2317 | u32 rb_bufsz; | 2320 | u32 rb_bufsz; |
| 2318 | int r; | 2321 | int r; |
| 2319 | 2322 | ||
| @@ -2353,7 +2356,11 @@ int r600_dma_resume(struct radeon_device *rdev) | |||
| 2353 | WREG32(DMA_RB_BASE, ring->gpu_addr >> 8); | 2356 | WREG32(DMA_RB_BASE, ring->gpu_addr >> 8); |
| 2354 | 2357 | ||
| 2355 | /* enable DMA IBs */ | 2358 | /* enable DMA IBs */ |
| 2356 | WREG32(DMA_IB_CNTL, DMA_IB_ENABLE); | 2359 | ib_cntl = DMA_IB_ENABLE; |
| 2360 | #ifdef __BIG_ENDIAN | ||
| 2361 | ib_cntl |= DMA_IB_SWAP_ENABLE; | ||
| 2362 | #endif | ||
| 2363 | WREG32(DMA_IB_CNTL, ib_cntl); | ||
| 2357 | 2364 | ||
| 2358 | dma_cntl = RREG32(DMA_CNTL); | 2365 | dma_cntl = RREG32(DMA_CNTL); |
| 2359 | dma_cntl &= ~CTXEMPTY_INT_ENABLE; | 2366 | dma_cntl &= ~CTXEMPTY_INT_ENABLE; |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 9056fafb00ea..0b202c07fe50 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
| @@ -1445,7 +1445,7 @@ static struct radeon_asic cayman_asic = { | |||
| 1445 | .vm = { | 1445 | .vm = { |
| 1446 | .init = &cayman_vm_init, | 1446 | .init = &cayman_vm_init, |
| 1447 | .fini = &cayman_vm_fini, | 1447 | .fini = &cayman_vm_fini, |
| 1448 | .pt_ring_index = R600_RING_TYPE_DMA_INDEX, | 1448 | .pt_ring_index = RADEON_RING_TYPE_GFX_INDEX, |
| 1449 | .set_page = &cayman_vm_set_page, | 1449 | .set_page = &cayman_vm_set_page, |
| 1450 | }, | 1450 | }, |
| 1451 | .ring = { | 1451 | .ring = { |
| @@ -1572,7 +1572,7 @@ static struct radeon_asic trinity_asic = { | |||
| 1572 | .vm = { | 1572 | .vm = { |
| 1573 | .init = &cayman_vm_init, | 1573 | .init = &cayman_vm_init, |
| 1574 | .fini = &cayman_vm_fini, | 1574 | .fini = &cayman_vm_fini, |
| 1575 | .pt_ring_index = R600_RING_TYPE_DMA_INDEX, | 1575 | .pt_ring_index = RADEON_RING_TYPE_GFX_INDEX, |
| 1576 | .set_page = &cayman_vm_set_page, | 1576 | .set_page = &cayman_vm_set_page, |
| 1577 | }, | 1577 | }, |
| 1578 | .ring = { | 1578 | .ring = { |
| @@ -1699,7 +1699,7 @@ static struct radeon_asic si_asic = { | |||
| 1699 | .vm = { | 1699 | .vm = { |
| 1700 | .init = &si_vm_init, | 1700 | .init = &si_vm_init, |
| 1701 | .fini = &si_vm_fini, | 1701 | .fini = &si_vm_fini, |
| 1702 | .pt_ring_index = R600_RING_TYPE_DMA_INDEX, | 1702 | .pt_ring_index = RADEON_RING_TYPE_GFX_INDEX, |
| 1703 | .set_page = &si_vm_set_page, | 1703 | .set_page = &si_vm_set_page, |
| 1704 | }, | 1704 | }, |
| 1705 | .ring = { | 1705 | .ring = { |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 33a56a09ff10..3e403bdda58f 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
| @@ -2470,6 +2470,14 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2470 | 1), | 2470 | 1), |
| 2471 | ATOM_DEVICE_CRT1_SUPPORT); | 2471 | ATOM_DEVICE_CRT1_SUPPORT); |
| 2472 | } | 2472 | } |
| 2473 | /* RV100 board with external TDMS bit mis-set. | ||
| 2474 | * Actually uses internal TMDS, clear the bit. | ||
| 2475 | */ | ||
| 2476 | if (dev->pdev->device == 0x5159 && | ||
| 2477 | dev->pdev->subsystem_vendor == 0x1014 && | ||
| 2478 | dev->pdev->subsystem_device == 0x029A) { | ||
| 2479 | tmp &= ~(1 << 4); | ||
| 2480 | } | ||
| 2473 | if ((tmp >> 4) & 0x1) { | 2481 | if ((tmp >> 4) & 0x1) { |
| 2474 | devices |= ATOM_DEVICE_DFP2_SUPPORT; | 2482 | devices |= ATOM_DEVICE_DFP2_SUPPORT; |
| 2475 | radeon_add_legacy_encoder(dev, | 2483 | radeon_add_legacy_encoder(dev, |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 469661fd1903..5407459e56d2 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
| @@ -286,6 +286,8 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
| 286 | p->chunks[p->chunk_ib_idx].kpage[1] == NULL) { | 286 | p->chunks[p->chunk_ib_idx].kpage[1] == NULL) { |
| 287 | kfree(p->chunks[p->chunk_ib_idx].kpage[0]); | 287 | kfree(p->chunks[p->chunk_ib_idx].kpage[0]); |
| 288 | kfree(p->chunks[p->chunk_ib_idx].kpage[1]); | 288 | kfree(p->chunks[p->chunk_ib_idx].kpage[1]); |
| 289 | p->chunks[p->chunk_ib_idx].kpage[0] = NULL; | ||
| 290 | p->chunks[p->chunk_ib_idx].kpage[1] = NULL; | ||
| 289 | return -ENOMEM; | 291 | return -ENOMEM; |
| 290 | } | 292 | } |
| 291 | } | 293 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index ad6df625e8b8..0d67674b64b1 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
| @@ -241,7 +241,8 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
| 241 | y = 0; | 241 | y = 0; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | if (ASIC_IS_AVIVO(rdev)) { | 244 | /* fixed on DCE6 and newer */ |
| 245 | if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE6(rdev)) { | ||
| 245 | int i = 0; | 246 | int i = 0; |
| 246 | struct drm_crtc *crtc_p; | 247 | struct drm_crtc *crtc_p; |
| 247 | 248 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index edfc54e41842..0d6562bb0c93 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -429,7 +429,8 @@ bool radeon_card_posted(struct radeon_device *rdev) | |||
| 429 | { | 429 | { |
| 430 | uint32_t reg; | 430 | uint32_t reg; |
| 431 | 431 | ||
| 432 | if (efi_enabled && rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) | 432 | if (efi_enabled(EFI_BOOT) && |
| 433 | rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) | ||
| 433 | return false; | 434 | return false; |
| 434 | 435 | ||
| 435 | /* first check CRTCs */ | 436 | /* first check CRTCs */ |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 1da2386d7cf7..05c96fa0b051 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -1115,14 +1115,16 @@ radeon_user_framebuffer_create(struct drm_device *dev, | |||
| 1115 | } | 1115 | } |
| 1116 | 1116 | ||
| 1117 | radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL); | 1117 | radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL); |
| 1118 | if (radeon_fb == NULL) | 1118 | if (radeon_fb == NULL) { |
| 1119 | drm_gem_object_unreference_unlocked(obj); | ||
| 1119 | return ERR_PTR(-ENOMEM); | 1120 | return ERR_PTR(-ENOMEM); |
| 1121 | } | ||
| 1120 | 1122 | ||
| 1121 | ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); | 1123 | ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); |
| 1122 | if (ret) { | 1124 | if (ret) { |
| 1123 | kfree(radeon_fb); | 1125 | kfree(radeon_fb); |
| 1124 | drm_gem_object_unreference_unlocked(obj); | 1126 | drm_gem_object_unreference_unlocked(obj); |
| 1125 | return NULL; | 1127 | return ERR_PTR(ret); |
| 1126 | } | 1128 | } |
| 1127 | 1129 | ||
| 1128 | return &radeon_fb->base; | 1130 | return &radeon_fb->base; |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 2430d80b1871..cd72062d5a91 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
| @@ -377,6 +377,9 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi | |||
| 377 | { | 377 | { |
| 378 | int r; | 378 | int r; |
| 379 | 379 | ||
| 380 | /* make sure we aren't trying to allocate more space than there is on the ring */ | ||
| 381 | if (ndw > (ring->ring_size / 4)) | ||
| 382 | return -ENOMEM; | ||
| 380 | /* Align requested size with padding so unlock_commit can | 383 | /* Align requested size with padding so unlock_commit can |
| 381 | * pad safely */ | 384 | * pad safely */ |
| 382 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; | 385 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/cayman b/drivers/gpu/drm/radeon/reg_srcs/cayman index 0f656b111c15..a072fa8c46b0 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/cayman +++ b/drivers/gpu/drm/radeon/reg_srcs/cayman | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | cayman 0x9400 | 1 | cayman 0x9400 |
| 2 | 0x0000802C GRBM_GFX_INDEX | 2 | 0x0000802C GRBM_GFX_INDEX |
| 3 | 0x00008040 WAIT_UNTIL | ||
| 3 | 0x000084FC CP_STRMOUT_CNTL | 4 | 0x000084FC CP_STRMOUT_CNTL |
| 4 | 0x000085F0 CP_COHER_CNTL | 5 | 0x000085F0 CP_COHER_CNTL |
| 5 | 0x000085F4 CP_COHER_SIZE | 6 | 0x000085F4 CP_COHER_SIZE |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 2bb6d0e84b3d..435ed3551364 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
| @@ -336,6 +336,8 @@ void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save) | |||
| 336 | WREG32(R600_CITF_CNTL, blackout); | 336 | WREG32(R600_CITF_CNTL, blackout); |
| 337 | } | 337 | } |
| 338 | } | 338 | } |
| 339 | /* wait for the MC to settle */ | ||
| 340 | udelay(100); | ||
| 339 | } | 341 | } |
| 340 | 342 | ||
| 341 | void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) | 343 | void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 44420fca7dfa..8be35c809c7b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c | |||
| @@ -429,7 +429,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, | |||
| 429 | struct ttm_bo_device *bdev = bo->bdev; | 429 | struct ttm_bo_device *bdev = bo->bdev; |
| 430 | struct ttm_bo_driver *driver = bdev->driver; | 430 | struct ttm_bo_driver *driver = bdev->driver; |
| 431 | 431 | ||
| 432 | fbo = kzalloc(sizeof(*fbo), GFP_KERNEL); | 432 | fbo = kmalloc(sizeof(*fbo), GFP_KERNEL); |
| 433 | if (!fbo) | 433 | if (!fbo) |
| 434 | return -ENOMEM; | 434 | return -ENOMEM; |
| 435 | 435 | ||
| @@ -448,7 +448,12 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, | |||
| 448 | fbo->vm_node = NULL; | 448 | fbo->vm_node = NULL; |
| 449 | atomic_set(&fbo->cpu_writers, 0); | 449 | atomic_set(&fbo->cpu_writers, 0); |
| 450 | 450 | ||
| 451 | fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); | 451 | spin_lock(&bdev->fence_lock); |
| 452 | if (bo->sync_obj) | ||
| 453 | fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); | ||
| 454 | else | ||
| 455 | fbo->sync_obj = NULL; | ||
| 456 | spin_unlock(&bdev->fence_lock); | ||
| 452 | kref_init(&fbo->list_kref); | 457 | kref_init(&fbo->list_kref); |
| 453 | kref_init(&fbo->kref); | 458 | kref_init(&fbo->kref); |
| 454 | fbo->destroy = &ttm_transfered_destroy; | 459 | fbo->destroy = &ttm_transfered_destroy; |
| @@ -661,13 +666,11 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, | |||
| 661 | */ | 666 | */ |
| 662 | 667 | ||
| 663 | set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); | 668 | set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); |
| 664 | |||
| 665 | /* ttm_buffer_object_transfer accesses bo->sync_obj */ | ||
| 666 | ret = ttm_buffer_object_transfer(bo, &ghost_obj); | ||
| 667 | spin_unlock(&bdev->fence_lock); | 669 | spin_unlock(&bdev->fence_lock); |
| 668 | if (tmp_obj) | 670 | if (tmp_obj) |
| 669 | driver->sync_obj_unref(&tmp_obj); | 671 | driver->sync_obj_unref(&tmp_obj); |
| 670 | 672 | ||
| 673 | ret = ttm_buffer_object_transfer(bo, &ghost_obj); | ||
| 671 | if (ret) | 674 | if (ret) |
| 672 | return ret; | 675 | return ret; |
| 673 | 676 | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 4dfa605e2d14..34e25471aeaa 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -306,6 +306,9 @@ | |||
| 306 | #define USB_VENDOR_ID_EZKEY 0x0518 | 306 | #define USB_VENDOR_ID_EZKEY 0x0518 |
| 307 | #define USB_DEVICE_ID_BTC_8193 0x0002 | 307 | #define USB_DEVICE_ID_BTC_8193 0x0002 |
| 308 | 308 | ||
| 309 | #define USB_VENDOR_ID_FORMOSA 0x147a | ||
| 310 | #define USB_DEVICE_ID_FORMOSA_IR_RECEIVER 0xe03e | ||
| 311 | |||
| 309 | #define USB_VENDOR_ID_FREESCALE 0x15A2 | 312 | #define USB_VENDOR_ID_FREESCALE 0x15A2 |
| 310 | #define USB_DEVICE_ID_FREESCALE_MX28 0x004F | 313 | #define USB_DEVICE_ID_FREESCALE_MX28 0x004F |
| 311 | 314 | ||
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 12e4fdc810bf..e766b5614ef5 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
| @@ -540,13 +540,24 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf, | |||
| 540 | { | 540 | { |
| 541 | struct i2c_client *client = hid->driver_data; | 541 | struct i2c_client *client = hid->driver_data; |
| 542 | int report_id = buf[0]; | 542 | int report_id = buf[0]; |
| 543 | int ret; | ||
| 543 | 544 | ||
| 544 | if (report_type == HID_INPUT_REPORT) | 545 | if (report_type == HID_INPUT_REPORT) |
| 545 | return -EINVAL; | 546 | return -EINVAL; |
| 546 | 547 | ||
| 547 | return i2c_hid_set_report(client, | 548 | if (report_id) { |
| 549 | buf++; | ||
| 550 | count--; | ||
| 551 | } | ||
| 552 | |||
| 553 | ret = i2c_hid_set_report(client, | ||
| 548 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, | 554 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, |
| 549 | report_id, buf, count); | 555 | report_id, buf, count); |
| 556 | |||
| 557 | if (report_id && ret >= 0) | ||
| 558 | ret++; /* add report_id to the number of transfered bytes */ | ||
| 559 | |||
| 560 | return ret; | ||
| 550 | } | 561 | } |
| 551 | 562 | ||
| 552 | static int i2c_hid_parse(struct hid_device *hid) | 563 | static int i2c_hid_parse(struct hid_device *hid) |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index ac9e35228254..e0e6abf1cd3b 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -70,6 +70,7 @@ static const struct hid_blacklist { | |||
| 70 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, | 70 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
| 71 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 71 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
| 72 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 72 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
| 73 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | ||
| 73 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 74 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
| 74 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | 75 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, |
| 75 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, | 76 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c index 4850d03870c2..35275099cafd 100644 --- a/drivers/infiniband/hw/qib/qib_qp.c +++ b/drivers/infiniband/hw/qib/qib_qp.c | |||
| @@ -263,20 +263,15 @@ static void remove_qp(struct qib_ibdev *dev, struct qib_qp *qp) | |||
| 263 | struct qib_qp __rcu **qpp; | 263 | struct qib_qp __rcu **qpp; |
| 264 | 264 | ||
| 265 | qpp = &dev->qp_table[n]; | 265 | qpp = &dev->qp_table[n]; |
| 266 | q = rcu_dereference_protected(*qpp, | 266 | for (; (q = rcu_dereference_protected(*qpp, |
| 267 | lockdep_is_held(&dev->qpt_lock)); | 267 | lockdep_is_held(&dev->qpt_lock))) != NULL; |
| 268 | for (; q; qpp = &q->next) { | 268 | qpp = &q->next) |
| 269 | if (q == qp) { | 269 | if (q == qp) { |
| 270 | atomic_dec(&qp->refcount); | 270 | atomic_dec(&qp->refcount); |
| 271 | *qpp = qp->next; | 271 | *qpp = qp->next; |
| 272 | rcu_assign_pointer(qp->next, NULL); | 272 | rcu_assign_pointer(qp->next, NULL); |
| 273 | q = rcu_dereference_protected(*qpp, | ||
| 274 | lockdep_is_held(&dev->qpt_lock)); | ||
| 275 | break; | 273 | break; |
| 276 | } | 274 | } |
| 277 | q = rcu_dereference_protected(*qpp, | ||
| 278 | lockdep_is_held(&dev->qpt_lock)); | ||
| 279 | } | ||
| 280 | } | 275 | } |
| 281 | 276 | ||
| 282 | spin_unlock_irqrestore(&dev->qpt_lock, flags); | 277 | spin_unlock_irqrestore(&dev->qpt_lock, flags); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 03103d2bd641..67b0c1d23678 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
| @@ -741,6 +741,9 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ | |||
| 741 | 741 | ||
| 742 | tx_req->mapping = addr; | 742 | tx_req->mapping = addr; |
| 743 | 743 | ||
| 744 | skb_orphan(skb); | ||
| 745 | skb_dst_drop(skb); | ||
| 746 | |||
| 744 | rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), | 747 | rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), |
| 745 | addr, skb->len); | 748 | addr, skb->len); |
| 746 | if (unlikely(rc)) { | 749 | if (unlikely(rc)) { |
| @@ -752,9 +755,6 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ | |||
| 752 | dev->trans_start = jiffies; | 755 | dev->trans_start = jiffies; |
| 753 | ++tx->tx_head; | 756 | ++tx->tx_head; |
| 754 | 757 | ||
| 755 | skb_orphan(skb); | ||
| 756 | skb_dst_drop(skb); | ||
| 757 | |||
| 758 | if (++priv->tx_outstanding == ipoib_sendq_size) { | 758 | if (++priv->tx_outstanding == ipoib_sendq_size) { |
| 759 | ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", | 759 | ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", |
| 760 | tx->qp->qp_num); | 760 | tx->qp->qp_num); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index a1bca70e20aa..2cfa76f5d99e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -600,6 +600,9 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
| 600 | netif_stop_queue(dev); | 600 | netif_stop_queue(dev); |
| 601 | } | 601 | } |
| 602 | 602 | ||
| 603 | skb_orphan(skb); | ||
| 604 | skb_dst_drop(skb); | ||
| 605 | |||
| 603 | rc = post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), | 606 | rc = post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), |
| 604 | address->ah, qpn, tx_req, phead, hlen); | 607 | address->ah, qpn, tx_req, phead, hlen); |
| 605 | if (unlikely(rc)) { | 608 | if (unlikely(rc)) { |
| @@ -615,9 +618,6 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
| 615 | 618 | ||
| 616 | address->last_send = priv->tx_head; | 619 | address->last_send = priv->tx_head; |
| 617 | ++priv->tx_head; | 620 | ++priv->tx_head; |
| 618 | |||
| 619 | skb_orphan(skb); | ||
| 620 | skb_dst_drop(skb); | ||
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) | 623 | if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) |
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 81837b0710a9..faf10ba1ed9a 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -975,6 +975,38 @@ static void __init free_iommu_all(void) | |||
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | /* | 977 | /* |
| 978 | * Family15h Model 10h-1fh erratum 746 (IOMMU Logging May Stall Translations) | ||
| 979 | * Workaround: | ||
| 980 | * BIOS should disable L2B micellaneous clock gating by setting | ||
| 981 | * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b | ||
| 982 | */ | ||
| 983 | static void __init amd_iommu_erratum_746_workaround(struct amd_iommu *iommu) | ||
| 984 | { | ||
| 985 | u32 value; | ||
| 986 | |||
| 987 | if ((boot_cpu_data.x86 != 0x15) || | ||
| 988 | (boot_cpu_data.x86_model < 0x10) || | ||
| 989 | (boot_cpu_data.x86_model > 0x1f)) | ||
| 990 | return; | ||
| 991 | |||
| 992 | pci_write_config_dword(iommu->dev, 0xf0, 0x90); | ||
| 993 | pci_read_config_dword(iommu->dev, 0xf4, &value); | ||
| 994 | |||
| 995 | if (value & BIT(2)) | ||
| 996 | return; | ||
| 997 | |||
| 998 | /* Select NB indirect register 0x90 and enable writing */ | ||
| 999 | pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8)); | ||
| 1000 | |||
| 1001 | pci_write_config_dword(iommu->dev, 0xf4, value | 0x4); | ||
| 1002 | pr_info("AMD-Vi: Applying erratum 746 workaround for IOMMU at %s\n", | ||
| 1003 | dev_name(&iommu->dev->dev)); | ||
| 1004 | |||
| 1005 | /* Clear the enable writing bit */ | ||
| 1006 | pci_write_config_dword(iommu->dev, 0xf0, 0x90); | ||
| 1007 | } | ||
| 1008 | |||
| 1009 | /* | ||
| 978 | * This function clues the initialization function for one IOMMU | 1010 | * This function clues the initialization function for one IOMMU |
| 979 | * together and also allocates the command buffer and programs the | 1011 | * together and also allocates the command buffer and programs the |
| 980 | * hardware. It does NOT enable the IOMMU. This is done afterwards. | 1012 | * hardware. It does NOT enable the IOMMU. This is done afterwards. |
| @@ -1172,6 +1204,8 @@ static int iommu_init_pci(struct amd_iommu *iommu) | |||
| 1172 | iommu->stored_l2[i] = iommu_read_l2(iommu, i); | 1204 | iommu->stored_l2[i] = iommu_read_l2(iommu, i); |
| 1173 | } | 1205 | } |
| 1174 | 1206 | ||
| 1207 | amd_iommu_erratum_746_workaround(iommu); | ||
| 1208 | |||
| 1175 | return pci_enable_device(iommu->dev); | 1209 | return pci_enable_device(iommu->dev); |
| 1176 | } | 1210 | } |
| 1177 | 1211 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index b9d091157884..eca28014ef3e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -4234,6 +4234,21 @@ static struct iommu_ops intel_iommu_ops = { | |||
| 4234 | .pgsize_bitmap = INTEL_IOMMU_PGSIZES, | 4234 | .pgsize_bitmap = INTEL_IOMMU_PGSIZES, |
| 4235 | }; | 4235 | }; |
| 4236 | 4236 | ||
| 4237 | static void quirk_iommu_g4x_gfx(struct pci_dev *dev) | ||
| 4238 | { | ||
| 4239 | /* G4x/GM45 integrated gfx dmar support is totally busted. */ | ||
| 4240 | printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n"); | ||
| 4241 | dmar_map_gfx = 0; | ||
| 4242 | } | ||
| 4243 | |||
| 4244 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_g4x_gfx); | ||
| 4245 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_g4x_gfx); | ||
| 4246 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e10, quirk_iommu_g4x_gfx); | ||
| 4247 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e20, quirk_iommu_g4x_gfx); | ||
| 4248 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e30, quirk_iommu_g4x_gfx); | ||
| 4249 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e40, quirk_iommu_g4x_gfx); | ||
| 4250 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e90, quirk_iommu_g4x_gfx); | ||
| 4251 | |||
| 4237 | static void quirk_iommu_rwbf(struct pci_dev *dev) | 4252 | static void quirk_iommu_rwbf(struct pci_dev *dev) |
| 4238 | { | 4253 | { |
| 4239 | /* | 4254 | /* |
| @@ -4242,12 +4257,6 @@ static void quirk_iommu_rwbf(struct pci_dev *dev) | |||
| 4242 | */ | 4257 | */ |
| 4243 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); | 4258 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); |
| 4244 | rwbf_quirk = 1; | 4259 | rwbf_quirk = 1; |
| 4245 | |||
| 4246 | /* https://bugzilla.redhat.com/show_bug.cgi?id=538163 */ | ||
| 4247 | if (dev->revision == 0x07) { | ||
| 4248 | printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n"); | ||
| 4249 | dmar_map_gfx = 0; | ||
| 4250 | } | ||
| 4251 | } | 4260 | } |
| 4252 | 4261 | ||
| 4253 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); | 4262 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); |
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 68452b768da2..03a0a01a4054 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
| @@ -248,6 +248,8 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, | |||
| 248 | CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l, | 248 | CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l, |
| 249 | CAPIMSG_CONTROL(data)); | 249 | CAPIMSG_CONTROL(data)); |
| 250 | l -= 12; | 250 | l -= 12; |
| 251 | if (l <= 0) | ||
| 252 | return; | ||
| 251 | dbgline = kmalloc(3 * l, GFP_ATOMIC); | 253 | dbgline = kmalloc(3 * l, GFP_ATOMIC); |
| 252 | if (!dbgline) | 254 | if (!dbgline) |
| 253 | return; | 255 | return; |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 3d8984edeff7..9e58dbd8d8cb 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
| @@ -340,24 +340,22 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) | |||
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | /* | 342 | /* |
| 343 | * validate_rebuild_devices | 343 | * validate_raid_redundancy |
| 344 | * @rs | 344 | * @rs |
| 345 | * | 345 | * |
| 346 | * Determine if the devices specified for rebuild can result in a valid | 346 | * Determine if there are enough devices in the array that haven't |
| 347 | * usable array that is capable of rebuilding the given devices. | 347 | * failed (or are being rebuilt) to form a usable array. |
| 348 | * | 348 | * |
| 349 | * Returns: 0 on success, -EINVAL on failure. | 349 | * Returns: 0 on success, -EINVAL on failure. |
| 350 | */ | 350 | */ |
| 351 | static int validate_rebuild_devices(struct raid_set *rs) | 351 | static int validate_raid_redundancy(struct raid_set *rs) |
| 352 | { | 352 | { |
| 353 | unsigned i, rebuild_cnt = 0; | 353 | unsigned i, rebuild_cnt = 0; |
| 354 | unsigned rebuilds_per_group, copies, d; | 354 | unsigned rebuilds_per_group, copies, d; |
| 355 | 355 | ||
| 356 | if (!(rs->print_flags & DMPF_REBUILD)) | ||
| 357 | return 0; | ||
| 358 | |||
| 359 | for (i = 0; i < rs->md.raid_disks; i++) | 356 | for (i = 0; i < rs->md.raid_disks; i++) |
| 360 | if (!test_bit(In_sync, &rs->dev[i].rdev.flags)) | 357 | if (!test_bit(In_sync, &rs->dev[i].rdev.flags) || |
| 358 | !rs->dev[i].rdev.sb_page) | ||
| 361 | rebuild_cnt++; | 359 | rebuild_cnt++; |
| 362 | 360 | ||
| 363 | switch (rs->raid_type->level) { | 361 | switch (rs->raid_type->level) { |
| @@ -393,27 +391,24 @@ static int validate_rebuild_devices(struct raid_set *rs) | |||
| 393 | * A A B B C | 391 | * A A B B C |
| 394 | * C D D E E | 392 | * C D D E E |
| 395 | */ | 393 | */ |
| 396 | rebuilds_per_group = 0; | ||
| 397 | for (i = 0; i < rs->md.raid_disks * copies; i++) { | 394 | for (i = 0; i < rs->md.raid_disks * copies; i++) { |
| 395 | if (!(i % copies)) | ||
| 396 | rebuilds_per_group = 0; | ||
| 398 | d = i % rs->md.raid_disks; | 397 | d = i % rs->md.raid_disks; |
| 399 | if (!test_bit(In_sync, &rs->dev[d].rdev.flags) && | 398 | if ((!rs->dev[d].rdev.sb_page || |
| 399 | !test_bit(In_sync, &rs->dev[d].rdev.flags)) && | ||
| 400 | (++rebuilds_per_group >= copies)) | 400 | (++rebuilds_per_group >= copies)) |
| 401 | goto too_many; | 401 | goto too_many; |
| 402 | if (!((i + 1) % copies)) | ||
| 403 | rebuilds_per_group = 0; | ||
| 404 | } | 402 | } |
| 405 | break; | 403 | break; |
| 406 | default: | 404 | default: |
| 407 | DMERR("The rebuild parameter is not supported for %s", | 405 | if (rebuild_cnt) |
| 408 | rs->raid_type->name); | 406 | return -EINVAL; |
| 409 | rs->ti->error = "Rebuild not supported for this RAID type"; | ||
| 410 | return -EINVAL; | ||
| 411 | } | 407 | } |
| 412 | 408 | ||
| 413 | return 0; | 409 | return 0; |
| 414 | 410 | ||
| 415 | too_many: | 411 | too_many: |
| 416 | rs->ti->error = "Too many rebuild devices specified"; | ||
| 417 | return -EINVAL; | 412 | return -EINVAL; |
| 418 | } | 413 | } |
| 419 | 414 | ||
| @@ -664,9 +659,6 @@ static int parse_raid_params(struct raid_set *rs, char **argv, | |||
| 664 | } | 659 | } |
| 665 | rs->md.dev_sectors = sectors_per_dev; | 660 | rs->md.dev_sectors = sectors_per_dev; |
| 666 | 661 | ||
| 667 | if (validate_rebuild_devices(rs)) | ||
| 668 | return -EINVAL; | ||
| 669 | |||
| 670 | /* Assume there are no metadata devices until the drives are parsed */ | 662 | /* Assume there are no metadata devices until the drives are parsed */ |
| 671 | rs->md.persistent = 0; | 663 | rs->md.persistent = 0; |
| 672 | rs->md.external = 1; | 664 | rs->md.external = 1; |
| @@ -995,28 +987,10 @@ static int super_validate(struct mddev *mddev, struct md_rdev *rdev) | |||
| 995 | static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | 987 | static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) |
| 996 | { | 988 | { |
| 997 | int ret; | 989 | int ret; |
| 998 | unsigned redundancy = 0; | ||
| 999 | struct raid_dev *dev; | 990 | struct raid_dev *dev; |
| 1000 | struct md_rdev *rdev, *tmp, *freshest; | 991 | struct md_rdev *rdev, *tmp, *freshest; |
| 1001 | struct mddev *mddev = &rs->md; | 992 | struct mddev *mddev = &rs->md; |
| 1002 | 993 | ||
| 1003 | switch (rs->raid_type->level) { | ||
| 1004 | case 1: | ||
| 1005 | redundancy = rs->md.raid_disks - 1; | ||
| 1006 | break; | ||
| 1007 | case 4: | ||
| 1008 | case 5: | ||
| 1009 | case 6: | ||
| 1010 | redundancy = rs->raid_type->parity_devs; | ||
| 1011 | break; | ||
| 1012 | case 10: | ||
| 1013 | redundancy = raid10_md_layout_to_copies(mddev->layout) - 1; | ||
| 1014 | break; | ||
| 1015 | default: | ||
| 1016 | ti->error = "Unknown RAID type"; | ||
| 1017 | return -EINVAL; | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | freshest = NULL; | 994 | freshest = NULL; |
| 1021 | rdev_for_each_safe(rdev, tmp, mddev) { | 995 | rdev_for_each_safe(rdev, tmp, mddev) { |
| 1022 | /* | 996 | /* |
| @@ -1045,44 +1019,43 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
| 1045 | break; | 1019 | break; |
| 1046 | default: | 1020 | default: |
| 1047 | dev = container_of(rdev, struct raid_dev, rdev); | 1021 | dev = container_of(rdev, struct raid_dev, rdev); |
| 1048 | if (redundancy--) { | 1022 | if (dev->meta_dev) |
| 1049 | if (dev->meta_dev) | 1023 | dm_put_device(ti, dev->meta_dev); |
| 1050 | dm_put_device(ti, dev->meta_dev); | ||
| 1051 | |||
| 1052 | dev->meta_dev = NULL; | ||
| 1053 | rdev->meta_bdev = NULL; | ||
| 1054 | 1024 | ||
| 1055 | if (rdev->sb_page) | 1025 | dev->meta_dev = NULL; |
| 1056 | put_page(rdev->sb_page); | 1026 | rdev->meta_bdev = NULL; |
| 1057 | 1027 | ||
| 1058 | rdev->sb_page = NULL; | 1028 | if (rdev->sb_page) |
| 1029 | put_page(rdev->sb_page); | ||
| 1059 | 1030 | ||
| 1060 | rdev->sb_loaded = 0; | 1031 | rdev->sb_page = NULL; |
| 1061 | 1032 | ||
| 1062 | /* | 1033 | rdev->sb_loaded = 0; |
| 1063 | * We might be able to salvage the data device | ||
| 1064 | * even though the meta device has failed. For | ||
| 1065 | * now, we behave as though '- -' had been | ||
| 1066 | * set for this device in the table. | ||
| 1067 | */ | ||
| 1068 | if (dev->data_dev) | ||
| 1069 | dm_put_device(ti, dev->data_dev); | ||
| 1070 | 1034 | ||
| 1071 | dev->data_dev = NULL; | 1035 | /* |
| 1072 | rdev->bdev = NULL; | 1036 | * We might be able to salvage the data device |
| 1037 | * even though the meta device has failed. For | ||
| 1038 | * now, we behave as though '- -' had been | ||
| 1039 | * set for this device in the table. | ||
| 1040 | */ | ||
| 1041 | if (dev->data_dev) | ||
| 1042 | dm_put_device(ti, dev->data_dev); | ||
| 1073 | 1043 | ||
| 1074 | list_del(&rdev->same_set); | 1044 | dev->data_dev = NULL; |
| 1045 | rdev->bdev = NULL; | ||
| 1075 | 1046 | ||
| 1076 | continue; | 1047 | list_del(&rdev->same_set); |
| 1077 | } | ||
| 1078 | ti->error = "Failed to load superblock"; | ||
| 1079 | return ret; | ||
| 1080 | } | 1048 | } |
| 1081 | } | 1049 | } |
| 1082 | 1050 | ||
| 1083 | if (!freshest) | 1051 | if (!freshest) |
| 1084 | return 0; | 1052 | return 0; |
| 1085 | 1053 | ||
| 1054 | if (validate_raid_redundancy(rs)) { | ||
| 1055 | rs->ti->error = "Insufficient redundancy to activate array"; | ||
| 1056 | return -EINVAL; | ||
| 1057 | } | ||
| 1058 | |||
| 1086 | /* | 1059 | /* |
| 1087 | * Validation of the freshest device provides the source of | 1060 | * Validation of the freshest device provides the source of |
| 1088 | * validation for the remaining devices. | 1061 | * validation for the remaining devices. |
| @@ -1432,7 +1405,7 @@ static void raid_resume(struct dm_target *ti) | |||
| 1432 | 1405 | ||
| 1433 | static struct target_type raid_target = { | 1406 | static struct target_type raid_target = { |
| 1434 | .name = "raid", | 1407 | .name = "raid", |
| 1435 | .version = {1, 4, 0}, | 1408 | .version = {1, 4, 1}, |
| 1436 | .module = THIS_MODULE, | 1409 | .module = THIS_MODULE, |
| 1437 | .ctr = raid_ctr, | 1410 | .ctr = raid_ctr, |
| 1438 | .dtr = raid_dtr, | 1411 | .dtr = raid_dtr, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 675ae5274016..5409607d4875 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -2746,19 +2746,9 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
| 2746 | return 0; | 2746 | return 0; |
| 2747 | } | 2747 | } |
| 2748 | 2748 | ||
| 2749 | /* | ||
| 2750 | * A thin device always inherits its queue limits from its pool. | ||
| 2751 | */ | ||
| 2752 | static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) | ||
| 2753 | { | ||
| 2754 | struct thin_c *tc = ti->private; | ||
| 2755 | |||
| 2756 | *limits = bdev_get_queue(tc->pool_dev->bdev)->limits; | ||
| 2757 | } | ||
| 2758 | |||
| 2759 | static struct target_type thin_target = { | 2749 | static struct target_type thin_target = { |
| 2760 | .name = "thin", | 2750 | .name = "thin", |
| 2761 | .version = {1, 6, 0}, | 2751 | .version = {1, 7, 0}, |
| 2762 | .module = THIS_MODULE, | 2752 | .module = THIS_MODULE, |
| 2763 | .ctr = thin_ctr, | 2753 | .ctr = thin_ctr, |
| 2764 | .dtr = thin_dtr, | 2754 | .dtr = thin_dtr, |
| @@ -2767,7 +2757,6 @@ static struct target_type thin_target = { | |||
| 2767 | .postsuspend = thin_postsuspend, | 2757 | .postsuspend = thin_postsuspend, |
| 2768 | .status = thin_status, | 2758 | .status = thin_status, |
| 2769 | .iterate_devices = thin_iterate_devices, | 2759 | .iterate_devices = thin_iterate_devices, |
| 2770 | .io_hints = thin_io_hints, | ||
| 2771 | }; | 2760 | }; |
| 2772 | 2761 | ||
| 2773 | /*----------------------------------------------------------------*/ | 2762 | /*----------------------------------------------------------------*/ |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index c72e4d5a9617..314a0e2faf79 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -1188,6 +1188,7 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci, | |||
| 1188 | { | 1188 | { |
| 1189 | struct dm_target *ti; | 1189 | struct dm_target *ti; |
| 1190 | sector_t len; | 1190 | sector_t len; |
| 1191 | unsigned num_requests; | ||
| 1191 | 1192 | ||
| 1192 | do { | 1193 | do { |
| 1193 | ti = dm_table_find_target(ci->map, ci->sector); | 1194 | ti = dm_table_find_target(ci->map, ci->sector); |
| @@ -1200,7 +1201,8 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci, | |||
| 1200 | * reconfiguration might also have changed that since the | 1201 | * reconfiguration might also have changed that since the |
| 1201 | * check was performed. | 1202 | * check was performed. |
| 1202 | */ | 1203 | */ |
| 1203 | if (!get_num_requests || !get_num_requests(ti)) | 1204 | num_requests = get_num_requests ? get_num_requests(ti) : 0; |
| 1205 | if (!num_requests) | ||
| 1204 | return -EOPNOTSUPP; | 1206 | return -EOPNOTSUPP; |
| 1205 | 1207 | ||
| 1206 | if (is_split_required && !is_split_required(ti)) | 1208 | if (is_split_required && !is_split_required(ti)) |
| @@ -1208,7 +1210,7 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci, | |||
| 1208 | else | 1210 | else |
| 1209 | len = min(ci->sector_count, max_io_len(ci->sector, ti)); | 1211 | len = min(ci->sector_count, max_io_len(ci->sector, ti)); |
| 1210 | 1212 | ||
| 1211 | __issue_target_requests(ci, ti, ti->num_discard_requests, len); | 1213 | __issue_target_requests(ci, ti, num_requests, len); |
| 1212 | 1214 | ||
| 1213 | ci->sector += len; | 1215 | ci->sector += len; |
| 1214 | } while (ci->sector_count -= len); | 1216 | } while (ci->sector_count -= len); |
diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c index e10e525f33e5..296941a9ae25 100644 --- a/drivers/media/radio/radio-keene.c +++ b/drivers/media/radio/radio-keene.c | |||
| @@ -374,6 +374,7 @@ static int usb_keene_probe(struct usb_interface *intf, | |||
| 374 | radio->vdev.ioctl_ops = &usb_keene_ioctl_ops; | 374 | radio->vdev.ioctl_ops = &usb_keene_ioctl_ops; |
| 375 | radio->vdev.lock = &radio->lock; | 375 | radio->vdev.lock = &radio->lock; |
| 376 | radio->vdev.release = video_device_release_empty; | 376 | radio->vdev.release = video_device_release_empty; |
| 377 | radio->vdev.vfl_dir = VFL_DIR_TX; | ||
| 377 | 378 | ||
| 378 | radio->usbdev = interface_to_usbdev(intf); | 379 | radio->usbdev = interface_to_usbdev(intf); |
| 379 | radio->intf = intf; | 380 | radio->intf = intf; |
diff --git a/drivers/media/radio/radio-si4713.c b/drivers/media/radio/radio-si4713.c index a082e400ed0f..1507c9d508d7 100644 --- a/drivers/media/radio/radio-si4713.c +++ b/drivers/media/radio/radio-si4713.c | |||
| @@ -250,6 +250,7 @@ static struct video_device radio_si4713_vdev_template = { | |||
| 250 | .name = "radio-si4713", | 250 | .name = "radio-si4713", |
| 251 | .release = video_device_release, | 251 | .release = video_device_release, |
| 252 | .ioctl_ops = &radio_si4713_ioctl_ops, | 252 | .ioctl_ops = &radio_si4713_ioctl_ops, |
| 253 | .vfl_dir = VFL_DIR_TX, | ||
| 253 | }; | 254 | }; |
| 254 | 255 | ||
| 255 | /* Platform driver interface */ | 256 | /* Platform driver interface */ |
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c index c48be195bbad..cabbe3adf435 100644 --- a/drivers/media/radio/radio-wl1273.c +++ b/drivers/media/radio/radio-wl1273.c | |||
| @@ -1971,6 +1971,7 @@ static struct video_device wl1273_viddev_template = { | |||
| 1971 | .ioctl_ops = &wl1273_ioctl_ops, | 1971 | .ioctl_ops = &wl1273_ioctl_ops, |
| 1972 | .name = WL1273_FM_DRIVER_NAME, | 1972 | .name = WL1273_FM_DRIVER_NAME, |
| 1973 | .release = wl1273_vdev_release, | 1973 | .release = wl1273_vdev_release, |
| 1974 | .vfl_dir = VFL_DIR_TX, | ||
| 1974 | }; | 1975 | }; |
| 1975 | 1976 | ||
| 1976 | static int wl1273_fm_radio_remove(struct platform_device *pdev) | 1977 | static int wl1273_fm_radio_remove(struct platform_device *pdev) |
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index 048de4536036..0a8ee8fab924 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c | |||
| @@ -518,6 +518,16 @@ static struct video_device fm_viddev_template = { | |||
| 518 | .ioctl_ops = &fm_drv_ioctl_ops, | 518 | .ioctl_ops = &fm_drv_ioctl_ops, |
| 519 | .name = FM_DRV_NAME, | 519 | .name = FM_DRV_NAME, |
| 520 | .release = video_device_release, | 520 | .release = video_device_release, |
| 521 | /* | ||
| 522 | * To ensure both the tuner and modulator ioctls are accessible we | ||
| 523 | * set the vfl_dir to M2M to indicate this. | ||
| 524 | * | ||
| 525 | * It is not really a mem2mem device of course, but it can both receive | ||
| 526 | * and transmit using the same radio device. It's the only radio driver | ||
| 527 | * that does this and it should really be split in two radio devices, | ||
| 528 | * but that would affect applications using this driver. | ||
| 529 | */ | ||
| 530 | .vfl_dir = VFL_DIR_M2M, | ||
| 521 | }; | 531 | }; |
| 522 | 532 | ||
| 523 | int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr) | 533 | int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr) |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 47ad4e270877..ff553babf455 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -237,6 +237,7 @@ config MFD_TPS65910 | |||
| 237 | depends on I2C=y && GPIOLIB | 237 | depends on I2C=y && GPIOLIB |
| 238 | select MFD_CORE | 238 | select MFD_CORE |
| 239 | select REGMAP_I2C | 239 | select REGMAP_I2C |
| 240 | select REGMAP_IRQ | ||
| 240 | select IRQ_DOMAIN | 241 | select IRQ_DOMAIN |
| 241 | help | 242 | help |
| 242 | if you say yes here you get support for the TPS65910 series of | 243 | if you say yes here you get support for the TPS65910 series of |
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index e1650badd106..4778bb124efe 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/mfd/core.h> | 19 | #include <linux/mfd/core.h> |
| 20 | #include <linux/mfd/abx500.h> | 20 | #include <linux/mfd/abx500.h> |
| 21 | #include <linux/mfd/abx500/ab8500.h> | 21 | #include <linux/mfd/abx500/ab8500.h> |
| 22 | #include <linux/mfd/abx500/ab8500-bm.h> | ||
| 22 | #include <linux/mfd/dbx500-prcmu.h> | 23 | #include <linux/mfd/dbx500-prcmu.h> |
| 23 | #include <linux/regulator/ab8500.h> | 24 | #include <linux/regulator/ab8500.h> |
| 24 | #include <linux/of.h> | 25 | #include <linux/of.h> |
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index bc8a3edb6bbf..222c03a5ddc0 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c | |||
| @@ -239,7 +239,12 @@ static int arizona_runtime_resume(struct device *dev) | |||
| 239 | return ret; | 239 | return ret; |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | regcache_sync(arizona->regmap); | 242 | ret = regcache_sync(arizona->regmap); |
| 243 | if (ret != 0) { | ||
| 244 | dev_err(arizona->dev, "Failed to restore register cache\n"); | ||
| 245 | regulator_disable(arizona->dcvdd); | ||
| 246 | return ret; | ||
| 247 | } | ||
| 243 | 248 | ||
| 244 | return 0; | 249 | return 0; |
| 245 | } | 250 | } |
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c index 74713bf5371f..2bec5f0db3ee 100644 --- a/drivers/mfd/arizona-irq.c +++ b/drivers/mfd/arizona-irq.c | |||
| @@ -176,14 +176,7 @@ int arizona_irq_init(struct arizona *arizona) | |||
| 176 | aod = &wm5102_aod; | 176 | aod = &wm5102_aod; |
| 177 | irq = &wm5102_irq; | 177 | irq = &wm5102_irq; |
| 178 | 178 | ||
| 179 | switch (arizona->rev) { | 179 | ctrlif_error = false; |
| 180 | case 0: | ||
| 181 | case 1: | ||
| 182 | ctrlif_error = false; | ||
| 183 | break; | ||
| 184 | default: | ||
| 185 | break; | ||
| 186 | } | ||
| 187 | break; | 180 | break; |
| 188 | #endif | 181 | #endif |
| 189 | #ifdef CONFIG_MFD_WM5110 | 182 | #ifdef CONFIG_MFD_WM5110 |
| @@ -191,14 +184,7 @@ int arizona_irq_init(struct arizona *arizona) | |||
| 191 | aod = &wm5110_aod; | 184 | aod = &wm5110_aod; |
| 192 | irq = &wm5110_irq; | 185 | irq = &wm5110_irq; |
| 193 | 186 | ||
| 194 | switch (arizona->rev) { | 187 | ctrlif_error = false; |
| 195 | case 0: | ||
| 196 | case 1: | ||
| 197 | ctrlif_error = false; | ||
| 198 | break; | ||
| 199 | default: | ||
| 200 | break; | ||
| 201 | } | ||
| 202 | break; | 188 | break; |
| 203 | #endif | 189 | #endif |
| 204 | default: | 190 | default: |
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c index ac74a4d1daea..885e56780358 100644 --- a/drivers/mfd/da9052-i2c.c +++ b/drivers/mfd/da9052-i2c.c | |||
| @@ -27,6 +27,66 @@ | |||
| 27 | #include <linux/of_device.h> | 27 | #include <linux/of_device.h> |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | /* I2C safe register check */ | ||
| 31 | static inline bool i2c_safe_reg(unsigned char reg) | ||
| 32 | { | ||
| 33 | switch (reg) { | ||
| 34 | case DA9052_STATUS_A_REG: | ||
| 35 | case DA9052_STATUS_B_REG: | ||
| 36 | case DA9052_STATUS_C_REG: | ||
| 37 | case DA9052_STATUS_D_REG: | ||
| 38 | case DA9052_ADC_RES_L_REG: | ||
| 39 | case DA9052_ADC_RES_H_REG: | ||
| 40 | case DA9052_VDD_RES_REG: | ||
| 41 | case DA9052_ICHG_AV_REG: | ||
| 42 | case DA9052_TBAT_RES_REG: | ||
| 43 | case DA9052_ADCIN4_RES_REG: | ||
| 44 | case DA9052_ADCIN5_RES_REG: | ||
| 45 | case DA9052_ADCIN6_RES_REG: | ||
| 46 | case DA9052_TJUNC_RES_REG: | ||
| 47 | case DA9052_TSI_X_MSB_REG: | ||
| 48 | case DA9052_TSI_Y_MSB_REG: | ||
| 49 | case DA9052_TSI_LSB_REG: | ||
| 50 | case DA9052_TSI_Z_MSB_REG: | ||
| 51 | return true; | ||
| 52 | default: | ||
| 53 | return false; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | /* | ||
| 58 | * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC | ||
| 59 | * gets lockup up or fails to respond following a system reset. | ||
| 60 | * This fix is to follow any read or write with a dummy read to a safe | ||
| 61 | * register. | ||
| 62 | */ | ||
| 63 | int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg) | ||
| 64 | { | ||
| 65 | int val; | ||
| 66 | |||
| 67 | switch (da9052->chip_id) { | ||
| 68 | case DA9052: | ||
| 69 | case DA9053_AA: | ||
| 70 | case DA9053_BA: | ||
| 71 | case DA9053_BB: | ||
| 72 | /* A dummy read to a safe register address. */ | ||
| 73 | if (!i2c_safe_reg(reg)) | ||
| 74 | return regmap_read(da9052->regmap, | ||
| 75 | DA9052_PARK_REGISTER, | ||
| 76 | &val); | ||
| 77 | break; | ||
| 78 | default: | ||
| 79 | /* | ||
| 80 | * For other chips parking of I2C register | ||
| 81 | * to a safe place is not required. | ||
| 82 | */ | ||
| 83 | break; | ||
| 84 | } | ||
| 85 | |||
| 86 | return 0; | ||
| 87 | } | ||
| 88 | EXPORT_SYMBOL(da9052_i2c_fix); | ||
| 89 | |||
| 30 | static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) | 90 | static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) |
| 31 | { | 91 | { |
| 32 | int reg_val, ret; | 92 | int reg_val, ret; |
| @@ -83,6 +143,7 @@ static int da9052_i2c_probe(struct i2c_client *client, | |||
| 83 | 143 | ||
| 84 | da9052->dev = &client->dev; | 144 | da9052->dev = &client->dev; |
| 85 | da9052->chip_irq = client->irq; | 145 | da9052->chip_irq = client->irq; |
| 146 | da9052->fix_io = da9052_i2c_fix; | ||
| 86 | 147 | ||
| 87 | i2c_set_clientdata(client, da9052); | 148 | i2c_set_clientdata(client, da9052); |
| 88 | 149 | ||
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index dc8826d8d69d..268f45d42394 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
| @@ -2524,7 +2524,7 @@ static bool read_mailbox_0(void) | |||
| 2524 | 2524 | ||
| 2525 | for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) { | 2525 | for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) { |
| 2526 | if (ev & prcmu_irq_bit[n]) | 2526 | if (ev & prcmu_irq_bit[n]) |
| 2527 | generic_handle_irq(IRQ_PRCMU_BASE + n); | 2527 | generic_handle_irq(irq_find_mapping(db8500_irq_domain, n)); |
| 2528 | } | 2528 | } |
| 2529 | r = true; | 2529 | r = true; |
| 2530 | break; | 2530 | break; |
| @@ -2737,13 +2737,14 @@ static int db8500_irq_map(struct irq_domain *d, unsigned int virq, | |||
| 2737 | } | 2737 | } |
| 2738 | 2738 | ||
| 2739 | static struct irq_domain_ops db8500_irq_ops = { | 2739 | static struct irq_domain_ops db8500_irq_ops = { |
| 2740 | .map = db8500_irq_map, | 2740 | .map = db8500_irq_map, |
| 2741 | .xlate = irq_domain_xlate_twocell, | 2741 | .xlate = irq_domain_xlate_twocell, |
| 2742 | }; | 2742 | }; |
| 2743 | 2743 | ||
| 2744 | static int db8500_irq_init(struct device_node *np) | 2744 | static int db8500_irq_init(struct device_node *np) |
| 2745 | { | 2745 | { |
| 2746 | int irq_base = -1; | 2746 | int irq_base = 0; |
| 2747 | int i; | ||
| 2747 | 2748 | ||
| 2748 | /* In the device tree case, just take some IRQs */ | 2749 | /* In the device tree case, just take some IRQs */ |
| 2749 | if (!np) | 2750 | if (!np) |
| @@ -2758,6 +2759,10 @@ static int db8500_irq_init(struct device_node *np) | |||
| 2758 | return -ENOSYS; | 2759 | return -ENOSYS; |
| 2759 | } | 2760 | } |
| 2760 | 2761 | ||
| 2762 | /* All wakeups will be used, so create mappings for all */ | ||
| 2763 | for (i = 0; i < NUM_PRCMU_WAKEUPS; i++) | ||
| 2764 | irq_create_mapping(db8500_irq_domain, i); | ||
| 2765 | |||
| 2761 | return 0; | 2766 | return 0; |
| 2762 | } | 2767 | } |
| 2763 | 2768 | ||
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index f6878f8db57d..4d73963cd8f0 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c | |||
| @@ -93,15 +93,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
| 93 | if (max77686 == NULL) | 93 | if (max77686 == NULL) |
| 94 | return -ENOMEM; | 94 | return -ENOMEM; |
| 95 | 95 | ||
| 96 | max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config); | ||
| 97 | if (IS_ERR(max77686->regmap)) { | ||
| 98 | ret = PTR_ERR(max77686->regmap); | ||
| 99 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", | ||
| 100 | ret); | ||
| 101 | kfree(max77686); | ||
| 102 | return ret; | ||
| 103 | } | ||
| 104 | |||
| 105 | i2c_set_clientdata(i2c, max77686); | 96 | i2c_set_clientdata(i2c, max77686); |
| 106 | max77686->dev = &i2c->dev; | 97 | max77686->dev = &i2c->dev; |
| 107 | max77686->i2c = i2c; | 98 | max77686->i2c = i2c; |
| @@ -111,6 +102,15 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
| 111 | max77686->irq_gpio = pdata->irq_gpio; | 102 | max77686->irq_gpio = pdata->irq_gpio; |
| 112 | max77686->irq = i2c->irq; | 103 | max77686->irq = i2c->irq; |
| 113 | 104 | ||
| 105 | max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config); | ||
| 106 | if (IS_ERR(max77686->regmap)) { | ||
| 107 | ret = PTR_ERR(max77686->regmap); | ||
| 108 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", | ||
| 109 | ret); | ||
| 110 | kfree(max77686); | ||
| 111 | return ret; | ||
| 112 | } | ||
| 113 | |||
| 114 | if (regmap_read(max77686->regmap, | 114 | if (regmap_read(max77686->regmap, |
| 115 | MAX77686_REG_DEVICE_ID, &data) < 0) { | 115 | MAX77686_REG_DEVICE_ID, &data) < 0) { |
| 116 | dev_err(max77686->dev, | 116 | dev_err(max77686->dev, |
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index cc5155e20494..9e60fed5ff82 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
| @@ -114,35 +114,37 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
| 114 | u8 reg_data; | 114 | u8 reg_data; |
| 115 | int ret = 0; | 115 | int ret = 0; |
| 116 | 116 | ||
| 117 | if (!pdata) { | ||
| 118 | dev_err(&i2c->dev, "No platform data found.\n"); | ||
| 119 | return -EINVAL; | ||
| 120 | } | ||
| 121 | |||
| 117 | max77693 = devm_kzalloc(&i2c->dev, | 122 | max77693 = devm_kzalloc(&i2c->dev, |
| 118 | sizeof(struct max77693_dev), GFP_KERNEL); | 123 | sizeof(struct max77693_dev), GFP_KERNEL); |
| 119 | if (max77693 == NULL) | 124 | if (max77693 == NULL) |
| 120 | return -ENOMEM; | 125 | return -ENOMEM; |
| 121 | 126 | ||
| 122 | max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); | ||
| 123 | if (IS_ERR(max77693->regmap)) { | ||
| 124 | ret = PTR_ERR(max77693->regmap); | ||
| 125 | dev_err(max77693->dev,"failed to allocate register map: %d\n", | ||
| 126 | ret); | ||
| 127 | goto err_regmap; | ||
| 128 | } | ||
| 129 | |||
| 130 | i2c_set_clientdata(i2c, max77693); | 127 | i2c_set_clientdata(i2c, max77693); |
| 131 | max77693->dev = &i2c->dev; | 128 | max77693->dev = &i2c->dev; |
| 132 | max77693->i2c = i2c; | 129 | max77693->i2c = i2c; |
| 133 | max77693->irq = i2c->irq; | 130 | max77693->irq = i2c->irq; |
| 134 | max77693->type = id->driver_data; | 131 | max77693->type = id->driver_data; |
| 135 | 132 | ||
| 136 | if (!pdata) | 133 | max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); |
| 137 | goto err_regmap; | 134 | if (IS_ERR(max77693->regmap)) { |
| 135 | ret = PTR_ERR(max77693->regmap); | ||
| 136 | dev_err(max77693->dev, "failed to allocate register map: %d\n", | ||
| 137 | ret); | ||
| 138 | return ret; | ||
| 139 | } | ||
| 138 | 140 | ||
| 139 | max77693->wakeup = pdata->wakeup; | 141 | max77693->wakeup = pdata->wakeup; |
| 140 | 142 | ||
| 141 | if (max77693_read_reg(max77693->regmap, | 143 | ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, |
| 142 | MAX77693_PMIC_REG_PMIC_ID2, ®_data) < 0) { | 144 | ®_data); |
| 145 | if (ret < 0) { | ||
| 143 | dev_err(max77693->dev, "device not found on this channel\n"); | 146 | dev_err(max77693->dev, "device not found on this channel\n"); |
| 144 | ret = -ENODEV; | 147 | return ret; |
| 145 | goto err_regmap; | ||
| 146 | } else | 148 | } else |
| 147 | dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); | 149 | dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); |
| 148 | 150 | ||
| @@ -163,7 +165,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
| 163 | ret = PTR_ERR(max77693->regmap_muic); | 165 | ret = PTR_ERR(max77693->regmap_muic); |
| 164 | dev_err(max77693->dev, | 166 | dev_err(max77693->dev, |
| 165 | "failed to allocate register map: %d\n", ret); | 167 | "failed to allocate register map: %d\n", ret); |
| 166 | goto err_regmap; | 168 | goto err_regmap_muic; |
| 167 | } | 169 | } |
| 168 | 170 | ||
| 169 | ret = max77693_irq_init(max77693); | 171 | ret = max77693_irq_init(max77693); |
| @@ -184,9 +186,9 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
| 184 | err_mfd: | 186 | err_mfd: |
| 185 | max77693_irq_exit(max77693); | 187 | max77693_irq_exit(max77693); |
| 186 | err_irq: | 188 | err_irq: |
| 189 | err_regmap_muic: | ||
| 187 | i2c_unregister_device(max77693->muic); | 190 | i2c_unregister_device(max77693->muic); |
| 188 | i2c_unregister_device(max77693->haptic); | 191 | i2c_unregister_device(max77693->haptic); |
| 189 | err_regmap: | ||
| 190 | return ret; | 192 | return ret; |
| 191 | } | 193 | } |
| 192 | 194 | ||
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index 64803f13bcec..d11567307fbe 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
| @@ -208,6 +208,8 @@ static int pcf50633_probe(struct i2c_client *client, | |||
| 208 | if (!pcf) | 208 | if (!pcf) |
| 209 | return -ENOMEM; | 209 | return -ENOMEM; |
| 210 | 210 | ||
| 211 | i2c_set_clientdata(client, pcf); | ||
| 212 | pcf->dev = &client->dev; | ||
| 211 | pcf->pdata = pdata; | 213 | pcf->pdata = pdata; |
| 212 | 214 | ||
| 213 | mutex_init(&pcf->lock); | 215 | mutex_init(&pcf->lock); |
| @@ -219,9 +221,6 @@ static int pcf50633_probe(struct i2c_client *client, | |||
| 219 | return ret; | 221 | return ret; |
| 220 | } | 222 | } |
| 221 | 223 | ||
| 222 | i2c_set_clientdata(client, pcf); | ||
| 223 | pcf->dev = &client->dev; | ||
| 224 | |||
| 225 | version = pcf50633_reg_read(pcf, 0); | 224 | version = pcf50633_reg_read(pcf, 0); |
| 226 | variant = pcf50633_reg_read(pcf, 1); | 225 | variant = pcf50633_reg_read(pcf, 1); |
| 227 | if (version < 0 || variant < 0) { | 226 | if (version < 0 || variant < 0) { |
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 89f046ca9e41..3d3b4addf81a 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c | |||
| @@ -112,6 +112,21 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card) | |||
| 112 | BPP_LDO_POWB, BPP_LDO_SUSPEND); | 112 | BPP_LDO_POWB, BPP_LDO_SUSPEND); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
| 116 | { | ||
| 117 | u8 mask, val; | ||
| 118 | |||
| 119 | mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK; | ||
| 120 | if (voltage == OUTPUT_3V3) | ||
| 121 | val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3; | ||
| 122 | else if (voltage == OUTPUT_1V8) | ||
| 123 | val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8; | ||
| 124 | else | ||
| 125 | return -EINVAL; | ||
| 126 | |||
| 127 | return rtsx_pci_write_register(pcr, LDO_CTL, mask, val); | ||
| 128 | } | ||
| 129 | |||
| 115 | static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) | 130 | static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) |
| 116 | { | 131 | { |
| 117 | unsigned int card_exist; | 132 | unsigned int card_exist; |
| @@ -163,6 +178,18 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) | |||
| 163 | return card_exist; | 178 | return card_exist; |
| 164 | } | 179 | } |
| 165 | 180 | ||
| 181 | static int rtl8411_conv_clk_and_div_n(int input, int dir) | ||
| 182 | { | ||
| 183 | int output; | ||
| 184 | |||
| 185 | if (dir == CLK_TO_DIV_N) | ||
| 186 | output = input * 4 / 5 - 2; | ||
| 187 | else | ||
| 188 | output = (input + 2) * 5 / 4; | ||
| 189 | |||
| 190 | return output; | ||
| 191 | } | ||
| 192 | |||
| 166 | static const struct pcr_ops rtl8411_pcr_ops = { | 193 | static const struct pcr_ops rtl8411_pcr_ops = { |
| 167 | .extra_init_hw = rtl8411_extra_init_hw, | 194 | .extra_init_hw = rtl8411_extra_init_hw, |
| 168 | .optimize_phy = NULL, | 195 | .optimize_phy = NULL, |
| @@ -172,7 +199,9 @@ static const struct pcr_ops rtl8411_pcr_ops = { | |||
| 172 | .disable_auto_blink = rtl8411_disable_auto_blink, | 199 | .disable_auto_blink = rtl8411_disable_auto_blink, |
| 173 | .card_power_on = rtl8411_card_power_on, | 200 | .card_power_on = rtl8411_card_power_on, |
| 174 | .card_power_off = rtl8411_card_power_off, | 201 | .card_power_off = rtl8411_card_power_off, |
| 202 | .switch_output_voltage = rtl8411_switch_output_voltage, | ||
| 175 | .cd_deglitch = rtl8411_cd_deglitch, | 203 | .cd_deglitch = rtl8411_cd_deglitch, |
| 204 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | ||
| 176 | }; | 205 | }; |
| 177 | 206 | ||
| 178 | /* SD Pull Control Enable: | 207 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c index 283a4f148084..98fe0f39463e 100644 --- a/drivers/mfd/rts5209.c +++ b/drivers/mfd/rts5209.c | |||
| @@ -144,6 +144,25 @@ static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card) | |||
| 144 | return rtsx_pci_send_cmd(pcr, 100); | 144 | return rtsx_pci_send_cmd(pcr, 100); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
| 148 | { | ||
| 149 | int err; | ||
| 150 | |||
| 151 | if (voltage == OUTPUT_3V3) { | ||
| 152 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); | ||
| 153 | if (err < 0) | ||
| 154 | return err; | ||
| 155 | } else if (voltage == OUTPUT_1V8) { | ||
| 156 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); | ||
| 157 | if (err < 0) | ||
| 158 | return err; | ||
| 159 | } else { | ||
| 160 | return -EINVAL; | ||
| 161 | } | ||
| 162 | |||
| 163 | return 0; | ||
| 164 | } | ||
| 165 | |||
| 147 | static const struct pcr_ops rts5209_pcr_ops = { | 166 | static const struct pcr_ops rts5209_pcr_ops = { |
| 148 | .extra_init_hw = rts5209_extra_init_hw, | 167 | .extra_init_hw = rts5209_extra_init_hw, |
| 149 | .optimize_phy = rts5209_optimize_phy, | 168 | .optimize_phy = rts5209_optimize_phy, |
| @@ -153,7 +172,9 @@ static const struct pcr_ops rts5209_pcr_ops = { | |||
| 153 | .disable_auto_blink = rts5209_disable_auto_blink, | 172 | .disable_auto_blink = rts5209_disable_auto_blink, |
| 154 | .card_power_on = rts5209_card_power_on, | 173 | .card_power_on = rts5209_card_power_on, |
| 155 | .card_power_off = rts5209_card_power_off, | 174 | .card_power_off = rts5209_card_power_off, |
| 175 | .switch_output_voltage = rts5209_switch_output_voltage, | ||
| 156 | .cd_deglitch = NULL, | 176 | .cd_deglitch = NULL, |
| 177 | .conv_clk_and_div_n = NULL, | ||
| 157 | }; | 178 | }; |
| 158 | 179 | ||
| 159 | /* SD Pull Control Enable: | 180 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c index b9dbab266fda..29d889cbb9c5 100644 --- a/drivers/mfd/rts5229.c +++ b/drivers/mfd/rts5229.c | |||
| @@ -114,6 +114,25 @@ static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card) | |||
| 114 | return rtsx_pci_send_cmd(pcr, 100); | 114 | return rtsx_pci_send_cmd(pcr, 100); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
| 118 | { | ||
| 119 | int err; | ||
| 120 | |||
| 121 | if (voltage == OUTPUT_3V3) { | ||
| 122 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); | ||
| 123 | if (err < 0) | ||
| 124 | return err; | ||
| 125 | } else if (voltage == OUTPUT_1V8) { | ||
| 126 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); | ||
| 127 | if (err < 0) | ||
| 128 | return err; | ||
| 129 | } else { | ||
| 130 | return -EINVAL; | ||
| 131 | } | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 117 | static const struct pcr_ops rts5229_pcr_ops = { | 136 | static const struct pcr_ops rts5229_pcr_ops = { |
| 118 | .extra_init_hw = rts5229_extra_init_hw, | 137 | .extra_init_hw = rts5229_extra_init_hw, |
| 119 | .optimize_phy = rts5229_optimize_phy, | 138 | .optimize_phy = rts5229_optimize_phy, |
| @@ -123,7 +142,9 @@ static const struct pcr_ops rts5229_pcr_ops = { | |||
| 123 | .disable_auto_blink = rts5229_disable_auto_blink, | 142 | .disable_auto_blink = rts5229_disable_auto_blink, |
| 124 | .card_power_on = rts5229_card_power_on, | 143 | .card_power_on = rts5229_card_power_on, |
| 125 | .card_power_off = rts5229_card_power_off, | 144 | .card_power_off = rts5229_card_power_off, |
| 145 | .switch_output_voltage = rts5229_switch_output_voltage, | ||
| 126 | .cd_deglitch = NULL, | 146 | .cd_deglitch = NULL, |
| 147 | .conv_clk_and_div_n = NULL, | ||
| 127 | }; | 148 | }; |
| 128 | 149 | ||
| 129 | /* SD Pull Control Enable: | 150 | /* SD Pull Control Enable: |
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 7a7b0bda4618..9fc57009e228 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
| @@ -630,7 +630,10 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, | |||
| 630 | if (clk == pcr->cur_clock) | 630 | if (clk == pcr->cur_clock) |
| 631 | return 0; | 631 | return 0; |
| 632 | 632 | ||
| 633 | N = (u8)(clk - 2); | 633 | if (pcr->ops->conv_clk_and_div_n) |
| 634 | N = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N); | ||
| 635 | else | ||
| 636 | N = (u8)(clk - 2); | ||
| 634 | if ((clk <= 2) || (N > max_N)) | 637 | if ((clk <= 2) || (N > max_N)) |
| 635 | return -EINVAL; | 638 | return -EINVAL; |
| 636 | 639 | ||
| @@ -641,7 +644,14 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, | |||
| 641 | /* Make sure that the SSC clock div_n is equal or greater than min_N */ | 644 | /* Make sure that the SSC clock div_n is equal or greater than min_N */ |
| 642 | div = CLK_DIV_1; | 645 | div = CLK_DIV_1; |
| 643 | while ((N < min_N) && (div < max_div)) { | 646 | while ((N < min_N) && (div < max_div)) { |
| 644 | N = (N + 2) * 2 - 2; | 647 | if (pcr->ops->conv_clk_and_div_n) { |
| 648 | int dbl_clk = pcr->ops->conv_clk_and_div_n(N, | ||
| 649 | DIV_N_TO_CLK) * 2; | ||
| 650 | N = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk, | ||
| 651 | CLK_TO_DIV_N); | ||
| 652 | } else { | ||
| 653 | N = (N + 2) * 2 - 2; | ||
| 654 | } | ||
| 645 | div++; | 655 | div++; |
| 646 | } | 656 | } |
| 647 | dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div); | 657 | dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div); |
| @@ -703,6 +713,15 @@ int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card) | |||
| 703 | } | 713 | } |
| 704 | EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off); | 714 | EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off); |
| 705 | 715 | ||
| 716 | int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
| 717 | { | ||
| 718 | if (pcr->ops->switch_output_voltage) | ||
| 719 | return pcr->ops->switch_output_voltage(pcr, voltage); | ||
| 720 | |||
| 721 | return 0; | ||
| 722 | } | ||
| 723 | EXPORT_SYMBOL_GPL(rtsx_pci_switch_output_voltage); | ||
| 724 | |||
| 706 | unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr) | 725 | unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr) |
| 707 | { | 726 | { |
| 708 | unsigned int val; | 727 | unsigned int val; |
| @@ -767,10 +786,10 @@ static void rtsx_pci_card_detect(struct work_struct *work) | |||
| 767 | 786 | ||
| 768 | spin_unlock_irqrestore(&pcr->lock, flags); | 787 | spin_unlock_irqrestore(&pcr->lock, flags); |
| 769 | 788 | ||
| 770 | if (card_detect & SD_EXIST) | 789 | if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event) |
| 771 | pcr->slots[RTSX_SD_CARD].card_event( | 790 | pcr->slots[RTSX_SD_CARD].card_event( |
| 772 | pcr->slots[RTSX_SD_CARD].p_dev); | 791 | pcr->slots[RTSX_SD_CARD].p_dev); |
| 773 | if (card_detect & MS_EXIST) | 792 | if ((card_detect & MS_EXIST) && pcr->slots[RTSX_MS_CARD].card_event) |
| 774 | pcr->slots[RTSX_MS_CARD].card_event( | 793 | pcr->slots[RTSX_MS_CARD].card_event( |
| 775 | pcr->slots[RTSX_MS_CARD].p_dev); | 794 | pcr->slots[RTSX_MS_CARD].p_dev); |
| 776 | } | 795 | } |
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index a06d66b929b1..ecc092c7f745 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c | |||
| @@ -219,25 +219,18 @@ static void tc3589x_irq_unmap(struct irq_domain *d, unsigned int virq) | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static struct irq_domain_ops tc3589x_irq_ops = { | 221 | static struct irq_domain_ops tc3589x_irq_ops = { |
| 222 | .map = tc3589x_irq_map, | 222 | .map = tc3589x_irq_map, |
| 223 | .unmap = tc3589x_irq_unmap, | 223 | .unmap = tc3589x_irq_unmap, |
| 224 | .xlate = irq_domain_xlate_twocell, | 224 | .xlate = irq_domain_xlate_twocell, |
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) | 227 | static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) |
| 228 | { | 228 | { |
| 229 | int base = tc3589x->irq_base; | 229 | int base = tc3589x->irq_base; |
| 230 | 230 | ||
| 231 | if (base) { | 231 | tc3589x->domain = irq_domain_add_simple( |
| 232 | tc3589x->domain = irq_domain_add_legacy( | 232 | np, TC3589x_NR_INTERNAL_IRQS, base, |
| 233 | NULL, TC3589x_NR_INTERNAL_IRQS, base, | 233 | &tc3589x_irq_ops, tc3589x); |
| 234 | 0, &tc3589x_irq_ops, tc3589x); | ||
| 235 | } | ||
| 236 | else { | ||
| 237 | tc3589x->domain = irq_domain_add_linear( | ||
| 238 | np, TC3589x_NR_INTERNAL_IRQS, | ||
| 239 | &tc3589x_irq_ops, tc3589x); | ||
| 240 | } | ||
| 241 | 234 | ||
| 242 | if (!tc3589x->domain) { | 235 | if (!tc3589x->domain) { |
| 243 | dev_err(tc3589x->dev, "Failed to create irqdomain\n"); | 236 | dev_err(tc3589x->dev, "Failed to create irqdomain\n"); |
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 4dae241e5017..dd362c1078e1 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
| @@ -159,7 +159,7 @@ out: | |||
| 159 | static int twl4030_write_script(u8 address, struct twl4030_ins *script, | 159 | static int twl4030_write_script(u8 address, struct twl4030_ins *script, |
| 160 | int len) | 160 | int len) |
| 161 | { | 161 | { |
| 162 | int err; | 162 | int err = -EINVAL; |
| 163 | 163 | ||
| 164 | for (; len; len--, address++, script++) { | 164 | for (; len; len--, address++, script++) { |
| 165 | if (len == 1) { | 165 | if (len == 1) { |
diff --git a/drivers/mfd/vexpress-config.c b/drivers/mfd/vexpress-config.c index fae15d880758..3c1723aa6225 100644 --- a/drivers/mfd/vexpress-config.c +++ b/drivers/mfd/vexpress-config.c | |||
| @@ -67,6 +67,7 @@ struct vexpress_config_bridge *vexpress_config_bridge_register( | |||
| 67 | 67 | ||
| 68 | return bridge; | 68 | return bridge; |
| 69 | } | 69 | } |
| 70 | EXPORT_SYMBOL(vexpress_config_bridge_register); | ||
| 70 | 71 | ||
| 71 | void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) | 72 | void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) |
| 72 | { | 73 | { |
| @@ -83,6 +84,7 @@ void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) | |||
| 83 | while (!list_empty(&__bridge.transactions)) | 84 | while (!list_empty(&__bridge.transactions)) |
| 84 | cpu_relax(); | 85 | cpu_relax(); |
| 85 | } | 86 | } |
| 87 | EXPORT_SYMBOL(vexpress_config_bridge_unregister); | ||
| 86 | 88 | ||
| 87 | 89 | ||
| 88 | struct vexpress_config_func { | 90 | struct vexpress_config_func { |
| @@ -142,6 +144,7 @@ struct vexpress_config_func *__vexpress_config_func_get(struct device *dev, | |||
| 142 | 144 | ||
| 143 | return func; | 145 | return func; |
| 144 | } | 146 | } |
| 147 | EXPORT_SYMBOL(__vexpress_config_func_get); | ||
| 145 | 148 | ||
| 146 | void vexpress_config_func_put(struct vexpress_config_func *func) | 149 | void vexpress_config_func_put(struct vexpress_config_func *func) |
| 147 | { | 150 | { |
| @@ -149,7 +152,7 @@ void vexpress_config_func_put(struct vexpress_config_func *func) | |||
| 149 | of_node_put(func->bridge->node); | 152 | of_node_put(func->bridge->node); |
| 150 | kfree(func); | 153 | kfree(func); |
| 151 | } | 154 | } |
| 152 | 155 | EXPORT_SYMBOL(vexpress_config_func_put); | |
| 153 | 156 | ||
| 154 | struct vexpress_config_trans { | 157 | struct vexpress_config_trans { |
| 155 | struct vexpress_config_func *func; | 158 | struct vexpress_config_func *func; |
| @@ -229,6 +232,7 @@ void vexpress_config_complete(struct vexpress_config_bridge *bridge, | |||
| 229 | 232 | ||
| 230 | complete(&trans->completion); | 233 | complete(&trans->completion); |
| 231 | } | 234 | } |
| 235 | EXPORT_SYMBOL(vexpress_config_complete); | ||
| 232 | 236 | ||
| 233 | int vexpress_config_wait(struct vexpress_config_trans *trans) | 237 | int vexpress_config_wait(struct vexpress_config_trans *trans) |
| 234 | { | 238 | { |
| @@ -236,7 +240,7 @@ int vexpress_config_wait(struct vexpress_config_trans *trans) | |||
| 236 | 240 | ||
| 237 | return trans->status; | 241 | return trans->status; |
| 238 | } | 242 | } |
| 239 | 243 | EXPORT_SYMBOL(vexpress_config_wait); | |
| 240 | 244 | ||
| 241 | int vexpress_config_read(struct vexpress_config_func *func, int offset, | 245 | int vexpress_config_read(struct vexpress_config_func *func, int offset, |
| 242 | u32 *data) | 246 | u32 *data) |
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c index 088872ab6338..1133a64c2dc9 100644 --- a/drivers/mfd/wm5102-tables.c +++ b/drivers/mfd/wm5102-tables.c | |||
| @@ -1882,7 +1882,7 @@ static bool wm5102_volatile_register(struct device *dev, unsigned int reg) | |||
| 1882 | } | 1882 | } |
| 1883 | } | 1883 | } |
| 1884 | 1884 | ||
| 1885 | #define WM5102_MAX_REGISTER 0x1a8fff | 1885 | #define WM5102_MAX_REGISTER 0x1a9800 |
| 1886 | 1886 | ||
| 1887 | const struct regmap_config wm5102_spi_regmap = { | 1887 | const struct regmap_config wm5102_spi_regmap = { |
| 1888 | .reg_bits = 32, | 1888 | .reg_bits = 32, |
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 571915dfb218..f74b5adca642 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c | |||
| @@ -1060,26 +1060,6 @@ static int sd_wait_voltage_stable_2(struct realtek_pci_sdmmc *host) | |||
| 1060 | return 0; | 1060 | return 0; |
| 1061 | } | 1061 | } |
| 1062 | 1062 | ||
| 1063 | static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage) | ||
| 1064 | { | ||
| 1065 | struct rtsx_pcr *pcr = host->pcr; | ||
| 1066 | int err; | ||
| 1067 | |||
| 1068 | if (voltage == SD_IO_3V3) { | ||
| 1069 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); | ||
| 1070 | if (err < 0) | ||
| 1071 | return err; | ||
| 1072 | } else if (voltage == SD_IO_1V8) { | ||
| 1073 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); | ||
| 1074 | if (err < 0) | ||
| 1075 | return err; | ||
| 1076 | } else { | ||
| 1077 | return -EINVAL; | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | return 0; | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | 1063 | static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) |
| 1084 | { | 1064 | { |
| 1085 | struct realtek_pci_sdmmc *host = mmc_priv(mmc); | 1065 | struct realtek_pci_sdmmc *host = mmc_priv(mmc); |
| @@ -1098,11 +1078,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 1098 | rtsx_pci_start_run(pcr); | 1078 | rtsx_pci_start_run(pcr); |
| 1099 | 1079 | ||
| 1100 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) | 1080 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) |
| 1101 | voltage = SD_IO_3V3; | 1081 | voltage = OUTPUT_3V3; |
| 1102 | else | 1082 | else |
| 1103 | voltage = SD_IO_1V8; | 1083 | voltage = OUTPUT_1V8; |
| 1104 | 1084 | ||
| 1105 | if (voltage == SD_IO_1V8) { | 1085 | if (voltage == OUTPUT_1V8) { |
| 1106 | err = rtsx_pci_write_register(pcr, | 1086 | err = rtsx_pci_write_register(pcr, |
| 1107 | SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); | 1087 | SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); |
| 1108 | if (err < 0) | 1088 | if (err < 0) |
| @@ -1113,11 +1093,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 1113 | goto out; | 1093 | goto out; |
| 1114 | } | 1094 | } |
| 1115 | 1095 | ||
| 1116 | err = sd_change_bank_voltage(host, voltage); | 1096 | err = rtsx_pci_switch_output_voltage(pcr, voltage); |
| 1117 | if (err < 0) | 1097 | if (err < 0) |
| 1118 | goto out; | 1098 | goto out; |
| 1119 | 1099 | ||
| 1120 | if (voltage == SD_IO_1V8) { | 1100 | if (voltage == OUTPUT_1V8) { |
| 1121 | err = sd_wait_voltage_stable_2(host); | 1101 | err = sd_wait_voltage_stable_2(host); |
| 1122 | if (err < 0) | 1102 | if (err < 0) |
| 1123 | goto out; | 1103 | goto out; |
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index 27f80cd8aef3..46dcb54c32ec 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig | |||
| @@ -272,6 +272,7 @@ config MTD_DOCG3 | |||
| 272 | tristate "M-Systems Disk-On-Chip G3" | 272 | tristate "M-Systems Disk-On-Chip G3" |
| 273 | select BCH | 273 | select BCH |
| 274 | select BCH_CONST_PARAMS | 274 | select BCH_CONST_PARAMS |
| 275 | select BITREVERSE | ||
| 275 | ---help--- | 276 | ---help--- |
| 276 | This provides an MTD device driver for the M-Systems DiskOnChip | 277 | This provides an MTD device driver for the M-Systems DiskOnChip |
| 277 | G3 devices. | 278 | G3 devices. |
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 67cc73c18ddd..7901d72c9242 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
| @@ -170,7 +170,7 @@ static int of_flash_probe(struct platform_device *dev) | |||
| 170 | resource_size_t res_size; | 170 | resource_size_t res_size; |
| 171 | struct mtd_part_parser_data ppdata; | 171 | struct mtd_part_parser_data ppdata; |
| 172 | bool map_indirect; | 172 | bool map_indirect; |
| 173 | const char *mtd_name; | 173 | const char *mtd_name = NULL; |
| 174 | 174 | ||
| 175 | match = of_match_device(of_flash_match, &dev->dev); | 175 | match = of_match_device(of_flash_match, &dev->dev); |
| 176 | if (!match) | 176 | if (!match) |
diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c index 86c9a79b89b3..595de4012e71 100644 --- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c +++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | #include "bcm47xxnflash.h" | 17 | #include "bcm47xxnflash.h" |
| 18 | 18 | ||
| 19 | /* Broadcom uses 1'000'000 but it seems to be too many. Tests on WNDR4500 has | 19 | /* Broadcom uses 1'000'000 but it seems to be too many. Tests on WNDR4500 has |
| 20 | * shown 164 retries as maxiumum. */ | 20 | * shown ~1000 retries as maxiumum. */ |
| 21 | #define NFLASH_READY_RETRIES 1000 | 21 | #define NFLASH_READY_RETRIES 10000 |
| 22 | 22 | ||
| 23 | #define NFLASH_SECTOR_SIZE 512 | 23 | #define NFLASH_SECTOR_SIZE 512 |
| 24 | 24 | ||
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c index 3502606f6480..feae55c7b880 100644 --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c | |||
| @@ -523,7 +523,7 @@ static struct nand_ecclayout hwecc4_2048 __initconst = { | |||
| 523 | static const struct of_device_id davinci_nand_of_match[] = { | 523 | static const struct of_device_id davinci_nand_of_match[] = { |
| 524 | {.compatible = "ti,davinci-nand", }, | 524 | {.compatible = "ti,davinci-nand", }, |
| 525 | {}, | 525 | {}, |
| 526 | } | 526 | }; |
| 527 | MODULE_DEVICE_TABLE(of, davinci_nand_of_match); | 527 | MODULE_DEVICE_TABLE(of, davinci_nand_of_match); |
| 528 | 528 | ||
| 529 | static struct davinci_nand_pdata | 529 | static struct davinci_nand_pdata |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 8323ac991ad1..3766682a0289 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -2857,8 +2857,11 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | |||
| 2857 | int i; | 2857 | int i; |
| 2858 | int val; | 2858 | int val; |
| 2859 | 2859 | ||
| 2860 | /* ONFI need to be probed in 8 bits mode */ | 2860 | /* ONFI need to be probed in 8 bits mode, and 16 bits should be selected with NAND_BUSWIDTH_AUTO */ |
| 2861 | WARN_ON(chip->options & NAND_BUSWIDTH_16); | 2861 | if (chip->options & NAND_BUSWIDTH_16) { |
| 2862 | pr_err("Trying ONFI probe in 16 bits mode, aborting !\n"); | ||
| 2863 | return 0; | ||
| 2864 | } | ||
| 2862 | /* Try ONFI for unknown chip or LP */ | 2865 | /* Try ONFI for unknown chip or LP */ |
| 2863 | chip->cmdfunc(mtd, NAND_CMD_READID, 0x20, -1); | 2866 | chip->cmdfunc(mtd, NAND_CMD_READID, 0x20, -1); |
| 2864 | if (chip->read_byte(mtd) != 'O' || chip->read_byte(mtd) != 'N' || | 2867 | if (chip->read_byte(mtd) != 'O' || chip->read_byte(mtd) != 'N' || |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1877ed7ca086..1c9e09fbdff8 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -1053,6 +1053,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
| 1053 | pr_info("%s: Setting primary slave to None.\n", | 1053 | pr_info("%s: Setting primary slave to None.\n", |
| 1054 | bond->dev->name); | 1054 | bond->dev->name); |
| 1055 | bond->primary_slave = NULL; | 1055 | bond->primary_slave = NULL; |
| 1056 | memset(bond->params.primary, 0, sizeof(bond->params.primary)); | ||
| 1056 | bond_select_active_slave(bond); | 1057 | bond_select_active_slave(bond); |
| 1057 | goto out; | 1058 | goto out; |
| 1058 | } | 1059 | } |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 5233b8f58d77..2282b1ae9765 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
| @@ -488,8 +488,12 @@ static void c_can_setup_receive_object(struct net_device *dev, int iface, | |||
| 488 | 488 | ||
| 489 | priv->write_reg(priv, C_CAN_IFACE(MASK1_REG, iface), | 489 | priv->write_reg(priv, C_CAN_IFACE(MASK1_REG, iface), |
| 490 | IFX_WRITE_LOW_16BIT(mask)); | 490 | IFX_WRITE_LOW_16BIT(mask)); |
| 491 | |||
| 492 | /* According to C_CAN documentation, the reserved bit | ||
| 493 | * in IFx_MASK2 register is fixed 1 | ||
| 494 | */ | ||
| 491 | priv->write_reg(priv, C_CAN_IFACE(MASK2_REG, iface), | 495 | priv->write_reg(priv, C_CAN_IFACE(MASK2_REG, iface), |
| 492 | IFX_WRITE_HIGH_16BIT(mask)); | 496 | IFX_WRITE_HIGH_16BIT(mask) | BIT(13)); |
| 493 | 497 | ||
| 494 | priv->write_reg(priv, C_CAN_IFACE(ARB1_REG, iface), | 498 | priv->write_reg(priv, C_CAN_IFACE(ARB1_REG, iface), |
| 495 | IFX_WRITE_LOW_16BIT(id)); | 499 | IFX_WRITE_LOW_16BIT(id)); |
| @@ -960,7 +964,7 @@ static int c_can_handle_bus_err(struct net_device *dev, | |||
| 960 | break; | 964 | break; |
| 961 | case LEC_ACK_ERROR: | 965 | case LEC_ACK_ERROR: |
| 962 | netdev_dbg(dev, "ack error\n"); | 966 | netdev_dbg(dev, "ack error\n"); |
| 963 | cf->data[2] |= (CAN_ERR_PROT_LOC_ACK | | 967 | cf->data[3] |= (CAN_ERR_PROT_LOC_ACK | |
| 964 | CAN_ERR_PROT_LOC_ACK_DEL); | 968 | CAN_ERR_PROT_LOC_ACK_DEL); |
| 965 | break; | 969 | break; |
| 966 | case LEC_BIT1_ERROR: | 970 | case LEC_BIT1_ERROR: |
| @@ -973,7 +977,7 @@ static int c_can_handle_bus_err(struct net_device *dev, | |||
| 973 | break; | 977 | break; |
| 974 | case LEC_CRC_ERROR: | 978 | case LEC_CRC_ERROR: |
| 975 | netdev_dbg(dev, "CRC error\n"); | 979 | netdev_dbg(dev, "CRC error\n"); |
| 976 | cf->data[2] |= (CAN_ERR_PROT_LOC_CRC_SEQ | | 980 | cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | |
| 977 | CAN_ERR_PROT_LOC_CRC_DEL); | 981 | CAN_ERR_PROT_LOC_CRC_DEL); |
| 978 | break; | 982 | break; |
| 979 | default: | 983 | default: |
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 7d1748575b1f..5c314a961970 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c | |||
| @@ -560,7 +560,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) | |||
| 560 | stats->rx_errors++; | 560 | stats->rx_errors++; |
| 561 | break; | 561 | break; |
| 562 | case PCH_CRC_ERR: | 562 | case PCH_CRC_ERR: |
| 563 | cf->data[2] |= CAN_ERR_PROT_LOC_CRC_SEQ | | 563 | cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ | |
| 564 | CAN_ERR_PROT_LOC_CRC_DEL; | 564 | CAN_ERR_PROT_LOC_CRC_DEL; |
| 565 | priv->can.can_stats.bus_error++; | 565 | priv->can.can_stats.bus_error++; |
| 566 | stats->rx_errors++; | 566 | stats->rx_errors++; |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index f898c6363729..300581b24ff3 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
| @@ -746,12 +746,12 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, | |||
| 746 | } | 746 | } |
| 747 | if (err_status & HECC_CANES_CRCE) { | 747 | if (err_status & HECC_CANES_CRCE) { |
| 748 | hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE); | 748 | hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE); |
| 749 | cf->data[2] |= CAN_ERR_PROT_LOC_CRC_SEQ | | 749 | cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ | |
| 750 | CAN_ERR_PROT_LOC_CRC_DEL; | 750 | CAN_ERR_PROT_LOC_CRC_DEL; |
| 751 | } | 751 | } |
| 752 | if (err_status & HECC_CANES_ACKE) { | 752 | if (err_status & HECC_CANES_ACKE) { |
| 753 | hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE); | 753 | hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE); |
| 754 | cf->data[2] |= CAN_ERR_PROT_LOC_ACK | | 754 | cf->data[3] |= CAN_ERR_PROT_LOC_ACK | |
| 755 | CAN_ERR_PROT_LOC_ACK_DEL; | 755 | CAN_ERR_PROT_LOC_ACK_DEL; |
| 756 | } | 756 | } |
| 757 | } | 757 | } |
diff --git a/drivers/net/ethernet/3com/3c574_cs.c b/drivers/net/ethernet/3com/3c574_cs.c index 66df93638085..ffd8de28a76a 100644 --- a/drivers/net/ethernet/3com/3c574_cs.c +++ b/drivers/net/ethernet/3com/3c574_cs.c | |||
| @@ -432,7 +432,7 @@ static int tc574_config(struct pcmcia_device *link) | |||
| 432 | netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n", | 432 | netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n", |
| 433 | cardname, dev->base_addr, dev->irq, dev->dev_addr); | 433 | cardname, dev->base_addr, dev->irq, dev->dev_addr); |
| 434 | netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n", | 434 | netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n", |
| 435 | 8 << config & Ram_size, | 435 | 8 << (config & Ram_size), |
| 436 | ram_split[(config & Ram_split) >> Ram_split_shift], | 436 | ram_split[(config & Ram_split) >> Ram_split_shift], |
| 437 | config & Autoselect ? "autoselect " : ""); | 437 | config & Autoselect ? "autoselect " : ""); |
| 438 | 438 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 78ea90c40e19..bdb086934cd9 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -1283,14 +1283,26 @@ static int tg3_phy_auxctl_write(struct tg3 *tp, int reg, u32 set) | |||
| 1283 | return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg); | 1283 | return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg); |
| 1284 | } | 1284 | } |
| 1285 | 1285 | ||
| 1286 | #define TG3_PHY_AUXCTL_SMDSP_ENABLE(tp) \ | 1286 | static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable) |
| 1287 | tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ | 1287 | { |
| 1288 | MII_TG3_AUXCTL_ACTL_SMDSP_ENA | \ | 1288 | u32 val; |
| 1289 | MII_TG3_AUXCTL_ACTL_TX_6DB) | 1289 | int err; |
| 1290 | 1290 | ||
| 1291 | #define TG3_PHY_AUXCTL_SMDSP_DISABLE(tp) \ | 1291 | err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val); |
| 1292 | tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ | 1292 | |
| 1293 | MII_TG3_AUXCTL_ACTL_TX_6DB); | 1293 | if (err) |
| 1294 | return err; | ||
| 1295 | if (enable) | ||
| 1296 | |||
| 1297 | val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA; | ||
| 1298 | else | ||
| 1299 | val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA; | ||
| 1300 | |||
| 1301 | err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, | ||
| 1302 | val | MII_TG3_AUXCTL_ACTL_TX_6DB); | ||
| 1303 | |||
| 1304 | return err; | ||
| 1305 | } | ||
| 1294 | 1306 | ||
| 1295 | static int tg3_bmcr_reset(struct tg3 *tp) | 1307 | static int tg3_bmcr_reset(struct tg3 *tp) |
| 1296 | { | 1308 | { |
| @@ -2223,7 +2235,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp) | |||
| 2223 | 2235 | ||
| 2224 | otp = tp->phy_otp; | 2236 | otp = tp->phy_otp; |
| 2225 | 2237 | ||
| 2226 | if (TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) | 2238 | if (tg3_phy_toggle_auxctl_smdsp(tp, true)) |
| 2227 | return; | 2239 | return; |
| 2228 | 2240 | ||
| 2229 | phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT); | 2241 | phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT); |
| @@ -2248,7 +2260,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp) | |||
| 2248 | ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT); | 2260 | ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT); |
| 2249 | tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy); | 2261 | tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy); |
| 2250 | 2262 | ||
| 2251 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2263 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2252 | } | 2264 | } |
| 2253 | 2265 | ||
| 2254 | static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) | 2266 | static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) |
| @@ -2284,9 +2296,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) | |||
| 2284 | 2296 | ||
| 2285 | if (!tp->setlpicnt) { | 2297 | if (!tp->setlpicnt) { |
| 2286 | if (current_link_up == 1 && | 2298 | if (current_link_up == 1 && |
| 2287 | !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | 2299 | !tg3_phy_toggle_auxctl_smdsp(tp, true)) { |
| 2288 | tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000); | 2300 | tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000); |
| 2289 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2301 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2290 | } | 2302 | } |
| 2291 | 2303 | ||
| 2292 | val = tr32(TG3_CPMU_EEE_MODE); | 2304 | val = tr32(TG3_CPMU_EEE_MODE); |
| @@ -2302,11 +2314,11 @@ static void tg3_phy_eee_enable(struct tg3 *tp) | |||
| 2302 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | 2314 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || |
| 2303 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || | 2315 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || |
| 2304 | tg3_flag(tp, 57765_CLASS)) && | 2316 | tg3_flag(tp, 57765_CLASS)) && |
| 2305 | !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | 2317 | !tg3_phy_toggle_auxctl_smdsp(tp, true)) { |
| 2306 | val = MII_TG3_DSP_TAP26_ALNOKO | | 2318 | val = MII_TG3_DSP_TAP26_ALNOKO | |
| 2307 | MII_TG3_DSP_TAP26_RMRXSTO; | 2319 | MII_TG3_DSP_TAP26_RMRXSTO; |
| 2308 | tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val); | 2320 | tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val); |
| 2309 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2321 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2310 | } | 2322 | } |
| 2311 | 2323 | ||
| 2312 | val = tr32(TG3_CPMU_EEE_MODE); | 2324 | val = tr32(TG3_CPMU_EEE_MODE); |
| @@ -2450,7 +2462,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) | |||
| 2450 | tg3_writephy(tp, MII_CTRL1000, | 2462 | tg3_writephy(tp, MII_CTRL1000, |
| 2451 | CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER); | 2463 | CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER); |
| 2452 | 2464 | ||
| 2453 | err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); | 2465 | err = tg3_phy_toggle_auxctl_smdsp(tp, true); |
| 2454 | if (err) | 2466 | if (err) |
| 2455 | return err; | 2467 | return err; |
| 2456 | 2468 | ||
| @@ -2471,7 +2483,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) | |||
| 2471 | tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); | 2483 | tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); |
| 2472 | tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000); | 2484 | tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000); |
| 2473 | 2485 | ||
| 2474 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2486 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2475 | 2487 | ||
| 2476 | tg3_writephy(tp, MII_CTRL1000, phy9_orig); | 2488 | tg3_writephy(tp, MII_CTRL1000, phy9_orig); |
| 2477 | 2489 | ||
| @@ -2572,10 +2584,10 @@ static int tg3_phy_reset(struct tg3 *tp) | |||
| 2572 | 2584 | ||
| 2573 | out: | 2585 | out: |
| 2574 | if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) && | 2586 | if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) && |
| 2575 | !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | 2587 | !tg3_phy_toggle_auxctl_smdsp(tp, true)) { |
| 2576 | tg3_phydsp_write(tp, 0x201f, 0x2aaa); | 2588 | tg3_phydsp_write(tp, 0x201f, 0x2aaa); |
| 2577 | tg3_phydsp_write(tp, 0x000a, 0x0323); | 2589 | tg3_phydsp_write(tp, 0x000a, 0x0323); |
| 2578 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2590 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2579 | } | 2591 | } |
| 2580 | 2592 | ||
| 2581 | if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) { | 2593 | if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) { |
| @@ -2584,14 +2596,14 @@ out: | |||
| 2584 | } | 2596 | } |
| 2585 | 2597 | ||
| 2586 | if (tp->phy_flags & TG3_PHYFLG_BER_BUG) { | 2598 | if (tp->phy_flags & TG3_PHYFLG_BER_BUG) { |
| 2587 | if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | 2599 | if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) { |
| 2588 | tg3_phydsp_write(tp, 0x000a, 0x310b); | 2600 | tg3_phydsp_write(tp, 0x000a, 0x310b); |
| 2589 | tg3_phydsp_write(tp, 0x201f, 0x9506); | 2601 | tg3_phydsp_write(tp, 0x201f, 0x9506); |
| 2590 | tg3_phydsp_write(tp, 0x401f, 0x14e2); | 2602 | tg3_phydsp_write(tp, 0x401f, 0x14e2); |
| 2591 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2603 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2592 | } | 2604 | } |
| 2593 | } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) { | 2605 | } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) { |
| 2594 | if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | 2606 | if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) { |
| 2595 | tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); | 2607 | tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); |
| 2596 | if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) { | 2608 | if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) { |
| 2597 | tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b); | 2609 | tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b); |
| @@ -2600,7 +2612,7 @@ out: | |||
| 2600 | } else | 2612 | } else |
| 2601 | tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b); | 2613 | tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b); |
| 2602 | 2614 | ||
| 2603 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 2615 | tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 2604 | } | 2616 | } |
| 2605 | } | 2617 | } |
| 2606 | 2618 | ||
| @@ -4009,7 +4021,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) | |||
| 4009 | tw32(TG3_CPMU_EEE_MODE, | 4021 | tw32(TG3_CPMU_EEE_MODE, |
| 4010 | tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE); | 4022 | tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE); |
| 4011 | 4023 | ||
| 4012 | err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); | 4024 | err = tg3_phy_toggle_auxctl_smdsp(tp, true); |
| 4013 | if (!err) { | 4025 | if (!err) { |
| 4014 | u32 err2; | 4026 | u32 err2; |
| 4015 | 4027 | ||
| @@ -4042,7 +4054,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) | |||
| 4042 | MII_TG3_DSP_CH34TP2_HIBW01); | 4054 | MII_TG3_DSP_CH34TP2_HIBW01); |
| 4043 | } | 4055 | } |
| 4044 | 4056 | ||
| 4045 | err2 = TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | 4057 | err2 = tg3_phy_toggle_auxctl_smdsp(tp, false); |
| 4046 | if (!err) | 4058 | if (!err) |
| 4047 | err = err2; | 4059 | err = err2; |
| 4048 | } | 4060 | } |
| @@ -6950,6 +6962,9 @@ static void tg3_poll_controller(struct net_device *dev) | |||
| 6950 | int i; | 6962 | int i; |
| 6951 | struct tg3 *tp = netdev_priv(dev); | 6963 | struct tg3 *tp = netdev_priv(dev); |
| 6952 | 6964 | ||
| 6965 | if (tg3_irq_sync(tp)) | ||
| 6966 | return; | ||
| 6967 | |||
| 6953 | for (i = 0; i < tp->irq_cnt; i++) | 6968 | for (i = 0; i < tp->irq_cnt; i++) |
| 6954 | tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); | 6969 | tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); |
| 6955 | } | 6970 | } |
| @@ -16367,6 +16382,7 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
| 16367 | tp->pm_cap = pm_cap; | 16382 | tp->pm_cap = pm_cap; |
| 16368 | tp->rx_mode = TG3_DEF_RX_MODE; | 16383 | tp->rx_mode = TG3_DEF_RX_MODE; |
| 16369 | tp->tx_mode = TG3_DEF_TX_MODE; | 16384 | tp->tx_mode = TG3_DEF_TX_MODE; |
| 16385 | tp->irq_sync = 1; | ||
| 16370 | 16386 | ||
| 16371 | if (tg3_debug > 0) | 16387 | if (tg3_debug > 0) |
| 16372 | tp->msg_enable = tg3_debug; | 16388 | tp->msg_enable = tg3_debug; |
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index b407043ce9b0..f7f02900f650 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
| @@ -548,6 +548,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, struct xgmac_dma_desc *p) | |||
| 548 | return -1; | 548 | return -1; |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | /* All frames should fit into a single buffer */ | ||
| 552 | if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG)) | ||
| 553 | return -1; | ||
| 554 | |||
| 551 | /* Check if packet has checksum already */ | 555 | /* Check if packet has checksum already */ |
| 552 | if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) && | 556 | if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) && |
| 553 | !(ext_status & RXDESC_IP_PAYLOAD_MASK)) | 557 | !(ext_status & RXDESC_IP_PAYLOAD_MASK)) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index f0718e1a8369..c306df7d4568 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
| @@ -1994,9 +1994,20 @@ static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c) | |||
| 1994 | { | 1994 | { |
| 1995 | const struct port_info *pi = netdev_priv(dev); | 1995 | const struct port_info *pi = netdev_priv(dev); |
| 1996 | struct adapter *adap = pi->adapter; | 1996 | struct adapter *adap = pi->adapter; |
| 1997 | 1997 | struct sge_rspq *q; | |
| 1998 | return set_rxq_intr_params(adap, &adap->sge.ethrxq[pi->first_qset].rspq, | 1998 | int i; |
| 1999 | c->rx_coalesce_usecs, c->rx_max_coalesced_frames); | 1999 | int r = 0; |
| 2000 | |||
| 2001 | for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) { | ||
| 2002 | q = &adap->sge.ethrxq[i].rspq; | ||
| 2003 | r = set_rxq_intr_params(adap, q, c->rx_coalesce_usecs, | ||
| 2004 | c->rx_max_coalesced_frames); | ||
| 2005 | if (r) { | ||
| 2006 | dev_err(&dev->dev, "failed to set coalesce %d\n", r); | ||
| 2007 | break; | ||
| 2008 | } | ||
| 2009 | } | ||
| 2010 | return r; | ||
| 2000 | } | 2011 | } |
| 2001 | 2012 | ||
| 2002 | static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) | 2013 | static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 4eba17b83ba8..f1b3df167ff2 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
| @@ -36,13 +36,13 @@ | |||
| 36 | 36 | ||
| 37 | #define DRV_VER "4.4.161.0u" | 37 | #define DRV_VER "4.4.161.0u" |
| 38 | #define DRV_NAME "be2net" | 38 | #define DRV_NAME "be2net" |
| 39 | #define BE_NAME "ServerEngines BladeEngine2 10Gbps NIC" | 39 | #define BE_NAME "Emulex BladeEngine2" |
| 40 | #define BE3_NAME "ServerEngines BladeEngine3 10Gbps NIC" | 40 | #define BE3_NAME "Emulex BladeEngine3" |
| 41 | #define OC_NAME "Emulex OneConnect 10Gbps NIC" | 41 | #define OC_NAME "Emulex OneConnect" |
| 42 | #define OC_NAME_BE OC_NAME "(be3)" | 42 | #define OC_NAME_BE OC_NAME "(be3)" |
| 43 | #define OC_NAME_LANCER OC_NAME "(Lancer)" | 43 | #define OC_NAME_LANCER OC_NAME "(Lancer)" |
| 44 | #define OC_NAME_SH OC_NAME "(Skyhawk)" | 44 | #define OC_NAME_SH OC_NAME "(Skyhawk)" |
| 45 | #define DRV_DESC "ServerEngines BladeEngine 10Gbps NIC Driver" | 45 | #define DRV_DESC "Emulex OneConnect 10Gbps NIC Driver" |
| 46 | 46 | ||
| 47 | #define BE_VENDOR_ID 0x19a2 | 47 | #define BE_VENDOR_ID 0x19a2 |
| 48 | #define EMULEX_VENDOR_ID 0x10df | 48 | #define EMULEX_VENDOR_ID 0x10df |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 5c995700e534..4d6f3c54427a 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | MODULE_VERSION(DRV_VER); | 25 | MODULE_VERSION(DRV_VER); |
| 26 | MODULE_DEVICE_TABLE(pci, be_dev_ids); | 26 | MODULE_DEVICE_TABLE(pci, be_dev_ids); |
| 27 | MODULE_DESCRIPTION(DRV_DESC " " DRV_VER); | 27 | MODULE_DESCRIPTION(DRV_DESC " " DRV_VER); |
| 28 | MODULE_AUTHOR("ServerEngines Corporation"); | 28 | MODULE_AUTHOR("Emulex Corporation"); |
| 29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
| 30 | 30 | ||
| 31 | static unsigned int num_vfs; | 31 | static unsigned int num_vfs; |
diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h index 02a12b69555f..4dab6fc265a2 100644 --- a/drivers/net/ethernet/intel/e1000e/defines.h +++ b/drivers/net/ethernet/intel/e1000e/defines.h | |||
| @@ -232,6 +232,7 @@ | |||
| 232 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ | 232 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ |
| 233 | #define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ | 233 | #define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ |
| 234 | #define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ | 234 | #define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ |
| 235 | #define E1000_CTRL_MEHE 0x00080000 /* Memory Error Handling Enable */ | ||
| 235 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ | 236 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ |
| 236 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ | 237 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ |
| 237 | #define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ | 238 | #define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ |
| @@ -389,6 +390,12 @@ | |||
| 389 | 390 | ||
| 390 | #define E1000_PBS_16K E1000_PBA_16K | 391 | #define E1000_PBS_16K E1000_PBA_16K |
| 391 | 392 | ||
| 393 | /* Uncorrectable/correctable ECC Error counts and enable bits */ | ||
| 394 | #define E1000_PBECCSTS_CORR_ERR_CNT_MASK 0x000000FF | ||
| 395 | #define E1000_PBECCSTS_UNCORR_ERR_CNT_MASK 0x0000FF00 | ||
| 396 | #define E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT 8 | ||
| 397 | #define E1000_PBECCSTS_ECC_ENABLE 0x00010000 | ||
| 398 | |||
| 392 | #define IFS_MAX 80 | 399 | #define IFS_MAX 80 |
| 393 | #define IFS_MIN 40 | 400 | #define IFS_MIN 40 |
| 394 | #define IFS_RATIO 4 | 401 | #define IFS_RATIO 4 |
| @@ -408,6 +415,7 @@ | |||
| 408 | #define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */ | 415 | #define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */ |
| 409 | #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ | 416 | #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ |
| 410 | #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ | 417 | #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ |
| 418 | #define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */ | ||
| 411 | #define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */ | 419 | #define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver should claim the interrupt */ |
| 412 | #define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */ | 420 | #define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */ |
| 413 | #define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */ | 421 | #define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */ |
| @@ -443,6 +451,7 @@ | |||
| 443 | #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ | 451 | #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ |
| 444 | #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ | 452 | #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ |
| 445 | #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ | 453 | #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ |
| 454 | #define E1000_IMS_ECCER E1000_ICR_ECCER /* Uncorrectable ECC Error */ | ||
| 446 | #define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */ | 455 | #define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */ |
| 447 | #define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */ | 456 | #define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */ |
| 448 | #define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */ | 457 | #define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */ |
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h index 6782a2eea1bc..7e95f221d60b 100644 --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | |||
| @@ -309,6 +309,8 @@ struct e1000_adapter { | |||
| 309 | 309 | ||
| 310 | struct napi_struct napi; | 310 | struct napi_struct napi; |
| 311 | 311 | ||
| 312 | unsigned int uncorr_errors; /* uncorrectable ECC errors */ | ||
| 313 | unsigned int corr_errors; /* correctable ECC errors */ | ||
| 312 | unsigned int restart_queue; | 314 | unsigned int restart_queue; |
| 313 | u32 txd_cmd; | 315 | u32 txd_cmd; |
| 314 | 316 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index f95bc6ee1c22..fd4772a2691c 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c | |||
| @@ -108,6 +108,8 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
| 108 | E1000_STAT("dropped_smbus", stats.mgpdc), | 108 | E1000_STAT("dropped_smbus", stats.mgpdc), |
| 109 | E1000_STAT("rx_dma_failed", rx_dma_failed), | 109 | E1000_STAT("rx_dma_failed", rx_dma_failed), |
| 110 | E1000_STAT("tx_dma_failed", tx_dma_failed), | 110 | E1000_STAT("tx_dma_failed", tx_dma_failed), |
| 111 | E1000_STAT("uncorr_ecc_errors", uncorr_errors), | ||
| 112 | E1000_STAT("corr_ecc_errors", corr_errors), | ||
| 111 | }; | 113 | }; |
| 112 | 114 | ||
| 113 | #define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats) | 115 | #define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats) |
diff --git a/drivers/net/ethernet/intel/e1000e/hw.h b/drivers/net/ethernet/intel/e1000e/hw.h index cf217777586c..b88676ff3d86 100644 --- a/drivers/net/ethernet/intel/e1000e/hw.h +++ b/drivers/net/ethernet/intel/e1000e/hw.h | |||
| @@ -77,6 +77,7 @@ enum e1e_registers { | |||
| 77 | #define E1000_POEMB E1000_PHY_CTRL /* PHY OEM Bits */ | 77 | #define E1000_POEMB E1000_PHY_CTRL /* PHY OEM Bits */ |
| 78 | E1000_PBA = 0x01000, /* Packet Buffer Allocation - RW */ | 78 | E1000_PBA = 0x01000, /* Packet Buffer Allocation - RW */ |
| 79 | E1000_PBS = 0x01008, /* Packet Buffer Size */ | 79 | E1000_PBS = 0x01008, /* Packet Buffer Size */ |
| 80 | E1000_PBECCSTS = 0x0100C, /* Packet Buffer ECC Status - RW */ | ||
| 80 | E1000_EEMNGCTL = 0x01010, /* MNG EEprom Control */ | 81 | E1000_EEMNGCTL = 0x01010, /* MNG EEprom Control */ |
| 81 | E1000_EEWR = 0x0102C, /* EEPROM Write Register - RW */ | 82 | E1000_EEWR = 0x0102C, /* EEPROM Write Register - RW */ |
| 82 | E1000_FLOP = 0x0103C, /* FLASH Opcode Register */ | 83 | E1000_FLOP = 0x0103C, /* FLASH Opcode Register */ |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 976336547607..24d9f61956f0 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
| @@ -3624,6 +3624,17 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw) | |||
| 3624 | if (hw->mac.type == e1000_ich8lan) | 3624 | if (hw->mac.type == e1000_ich8lan) |
| 3625 | reg |= (E1000_RFCTL_IPV6_EX_DIS | E1000_RFCTL_NEW_IPV6_EXT_DIS); | 3625 | reg |= (E1000_RFCTL_IPV6_EX_DIS | E1000_RFCTL_NEW_IPV6_EXT_DIS); |
| 3626 | ew32(RFCTL, reg); | 3626 | ew32(RFCTL, reg); |
| 3627 | |||
| 3628 | /* Enable ECC on Lynxpoint */ | ||
| 3629 | if (hw->mac.type == e1000_pch_lpt) { | ||
| 3630 | reg = er32(PBECCSTS); | ||
| 3631 | reg |= E1000_PBECCSTS_ECC_ENABLE; | ||
| 3632 | ew32(PBECCSTS, reg); | ||
| 3633 | |||
| 3634 | reg = er32(CTRL); | ||
| 3635 | reg |= E1000_CTRL_MEHE; | ||
| 3636 | ew32(CTRL, reg); | ||
| 3637 | } | ||
| 3627 | } | 3638 | } |
| 3628 | 3639 | ||
| 3629 | /** | 3640 | /** |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index fbf75fdca994..643c883dd795 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -1678,6 +1678,23 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) | |||
| 1678 | mod_timer(&adapter->watchdog_timer, jiffies + 1); | 1678 | mod_timer(&adapter->watchdog_timer, jiffies + 1); |
| 1679 | } | 1679 | } |
| 1680 | 1680 | ||
| 1681 | /* Reset on uncorrectable ECC error */ | ||
| 1682 | if ((icr & E1000_ICR_ECCER) && (hw->mac.type == e1000_pch_lpt)) { | ||
| 1683 | u32 pbeccsts = er32(PBECCSTS); | ||
| 1684 | |||
| 1685 | adapter->corr_errors += | ||
| 1686 | pbeccsts & E1000_PBECCSTS_CORR_ERR_CNT_MASK; | ||
| 1687 | adapter->uncorr_errors += | ||
| 1688 | (pbeccsts & E1000_PBECCSTS_UNCORR_ERR_CNT_MASK) >> | ||
| 1689 | E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT; | ||
| 1690 | |||
| 1691 | /* Do the reset outside of interrupt context */ | ||
| 1692 | schedule_work(&adapter->reset_task); | ||
| 1693 | |||
| 1694 | /* return immediately since reset is imminent */ | ||
| 1695 | return IRQ_HANDLED; | ||
| 1696 | } | ||
| 1697 | |||
| 1681 | if (napi_schedule_prep(&adapter->napi)) { | 1698 | if (napi_schedule_prep(&adapter->napi)) { |
| 1682 | adapter->total_tx_bytes = 0; | 1699 | adapter->total_tx_bytes = 0; |
| 1683 | adapter->total_tx_packets = 0; | 1700 | adapter->total_tx_packets = 0; |
| @@ -1741,6 +1758,23 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
| 1741 | mod_timer(&adapter->watchdog_timer, jiffies + 1); | 1758 | mod_timer(&adapter->watchdog_timer, jiffies + 1); |
| 1742 | } | 1759 | } |
| 1743 | 1760 | ||
| 1761 | /* Reset on uncorrectable ECC error */ | ||
| 1762 | if ((icr & E1000_ICR_ECCER) && (hw->mac.type == e1000_pch_lpt)) { | ||
| 1763 | u32 pbeccsts = er32(PBECCSTS); | ||
| 1764 | |||
| 1765 | adapter->corr_errors += | ||
| 1766 | pbeccsts & E1000_PBECCSTS_CORR_ERR_CNT_MASK; | ||
| 1767 | adapter->uncorr_errors += | ||
| 1768 | (pbeccsts & E1000_PBECCSTS_UNCORR_ERR_CNT_MASK) >> | ||
| 1769 | E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT; | ||
| 1770 | |||
| 1771 | /* Do the reset outside of interrupt context */ | ||
| 1772 | schedule_work(&adapter->reset_task); | ||
| 1773 | |||
| 1774 | /* return immediately since reset is imminent */ | ||
| 1775 | return IRQ_HANDLED; | ||
| 1776 | } | ||
| 1777 | |||
| 1744 | if (napi_schedule_prep(&adapter->napi)) { | 1778 | if (napi_schedule_prep(&adapter->napi)) { |
| 1745 | adapter->total_tx_bytes = 0; | 1779 | adapter->total_tx_bytes = 0; |
| 1746 | adapter->total_tx_packets = 0; | 1780 | adapter->total_tx_packets = 0; |
| @@ -2104,6 +2138,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter) | |||
| 2104 | if (adapter->msix_entries) { | 2138 | if (adapter->msix_entries) { |
| 2105 | ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574); | 2139 | ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574); |
| 2106 | ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC); | 2140 | ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC); |
| 2141 | } else if (hw->mac.type == e1000_pch_lpt) { | ||
| 2142 | ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER); | ||
| 2107 | } else { | 2143 | } else { |
| 2108 | ew32(IMS, IMS_ENABLE_MASK); | 2144 | ew32(IMS, IMS_ENABLE_MASK); |
| 2109 | } | 2145 | } |
| @@ -4251,6 +4287,16 @@ static void e1000e_update_stats(struct e1000_adapter *adapter) | |||
| 4251 | adapter->stats.mgptc += er32(MGTPTC); | 4287 | adapter->stats.mgptc += er32(MGTPTC); |
| 4252 | adapter->stats.mgprc += er32(MGTPRC); | 4288 | adapter->stats.mgprc += er32(MGTPRC); |
| 4253 | adapter->stats.mgpdc += er32(MGTPDC); | 4289 | adapter->stats.mgpdc += er32(MGTPDC); |
| 4290 | |||
| 4291 | /* Correctable ECC Errors */ | ||
| 4292 | if (hw->mac.type == e1000_pch_lpt) { | ||
| 4293 | u32 pbeccsts = er32(PBECCSTS); | ||
| 4294 | adapter->corr_errors += | ||
| 4295 | pbeccsts & E1000_PBECCSTS_CORR_ERR_CNT_MASK; | ||
| 4296 | adapter->uncorr_errors += | ||
| 4297 | (pbeccsts & E1000_PBECCSTS_UNCORR_ERR_CNT_MASK) >> | ||
| 4298 | E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT; | ||
| 4299 | } | ||
| 4254 | } | 4300 | } |
| 4255 | 4301 | ||
| 4256 | /** | 4302 | /** |
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile b/drivers/net/ethernet/intel/ixgbe/Makefile index f3a632bf8d96..687c83d1bdab 100644 --- a/drivers/net/ethernet/intel/ixgbe/Makefile +++ b/drivers/net/ethernet/intel/ixgbe/Makefile | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | obj-$(CONFIG_IXGBE) += ixgbe.o | 33 | obj-$(CONFIG_IXGBE) += ixgbe.o |
| 34 | 34 | ||
| 35 | ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\ | 35 | ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \ |
| 36 | ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ | 36 | ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ |
| 37 | ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o | 37 | ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o |
| 38 | 38 | ||
| @@ -40,4 +40,5 @@ ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \ | |||
| 40 | ixgbe_dcb_82599.o ixgbe_dcb_nl.o | 40 | ixgbe_dcb_82599.o ixgbe_dcb_nl.o |
| 41 | 41 | ||
| 42 | ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o | 42 | ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o |
| 43 | ixgbe-$(CONFIG_DEBUG_FS) += ixgbe_debugfs.o | ||
| 43 | ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o | 44 | ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c index 50aa546b8c7a..3504686d3af5 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c | |||
| @@ -24,9 +24,6 @@ | |||
| 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 25 | 25 | ||
| 26 | *******************************************************************************/ | 26 | *******************************************************************************/ |
| 27 | |||
| 28 | #ifdef CONFIG_DEBUG_FS | ||
| 29 | |||
| 30 | #include <linux/debugfs.h> | 27 | #include <linux/debugfs.h> |
| 31 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 32 | 29 | ||
| @@ -277,5 +274,3 @@ void ixgbe_dbg_exit(void) | |||
| 277 | { | 274 | { |
| 278 | debugfs_remove_recursive(ixgbe_dbg_root); | 275 | debugfs_remove_recursive(ixgbe_dbg_root); |
| 279 | } | 276 | } |
| 280 | |||
| 281 | #endif /* CONFIG_DEBUG_FS */ | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index 1a751c9d09c4..bb9256a1b0a9 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
| @@ -660,11 +660,11 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | |||
| 660 | break; | 660 | break; |
| 661 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: | 661 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: |
| 662 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; | 662 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; |
| 663 | tsync_rx_mtrl = IXGBE_RXMTRL_V1_SYNC_MSG; | 663 | tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG; |
| 664 | break; | 664 | break; |
| 665 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: | 665 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: |
| 666 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; | 666 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; |
| 667 | tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG; | 667 | tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG; |
| 668 | break; | 668 | break; |
| 669 | case HWTSTAMP_FILTER_PTP_V2_EVENT: | 669 | case HWTSTAMP_FILTER_PTP_V2_EVENT: |
| 670 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: | 670 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 2b799f4f1c37..6771b69f40d5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
| @@ -630,10 +630,15 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 630 | ring->tx_csum++; | 630 | ring->tx_csum++; |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | /* Copy dst mac address to wqe */ | 633 | if (mlx4_is_mfunc(mdev->dev) || priv->validate_loopback) { |
| 634 | ethh = (struct ethhdr *)skb->data; | 634 | /* Copy dst mac address to wqe. This allows loopback in eSwitch, |
| 635 | tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest); | 635 | * so that VFs and PF can communicate with each other |
| 636 | tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2)); | 636 | */ |
| 637 | ethh = (struct ethhdr *)skb->data; | ||
| 638 | tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest); | ||
| 639 | tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2)); | ||
| 640 | } | ||
| 641 | |||
| 637 | /* Handle LSO (TSO) packets */ | 642 | /* Handle LSO (TSO) packets */ |
| 638 | if (lso_header_size) { | 643 | if (lso_header_size) { |
| 639 | /* Mark opcode as LSO */ | 644 | /* Mark opcode as LSO */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index e1bafffbc3b1..5163af314990 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
| @@ -380,7 +380,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
| 380 | } | 380 | } |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | if ((dev_cap->flags & | 383 | if ((dev->caps.flags & |
| 384 | (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) && | 384 | (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) && |
| 385 | mlx4_is_master(dev)) | 385 | mlx4_is_master(dev)) |
| 386 | dev->caps.function_caps |= MLX4_FUNC_CAP_64B_EQE_CQE; | 386 | dev->caps.function_caps |= MLX4_FUNC_CAP_64B_EQE_CQE; |
| @@ -1790,15 +1790,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) | |||
| 1790 | int i; | 1790 | int i; |
| 1791 | 1791 | ||
| 1792 | if (msi_x) { | 1792 | if (msi_x) { |
| 1793 | /* In multifunction mode each function gets 2 msi-X vectors | 1793 | nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, |
| 1794 | * one for data path completions anf the other for asynch events | 1794 | nreq); |
| 1795 | * or command completions */ | ||
| 1796 | if (mlx4_is_mfunc(dev)) { | ||
| 1797 | nreq = 2; | ||
| 1798 | } else { | ||
| 1799 | nreq = min_t(int, dev->caps.num_eqs - | ||
| 1800 | dev->caps.reserved_eqs, nreq); | ||
| 1801 | } | ||
| 1802 | 1795 | ||
| 1803 | entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); | 1796 | entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); |
| 1804 | if (!entries) | 1797 | if (!entries) |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index bc165f4d0f65..695667d471a1 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | |||
| @@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) | |||
| 144 | buffrag->length, PCI_DMA_TODEVICE); | 144 | buffrag->length, PCI_DMA_TODEVICE); |
| 145 | buffrag->dma = 0ULL; | 145 | buffrag->dma = 0ULL; |
| 146 | } | 146 | } |
| 147 | for (j = 0; j < cmd_buf->frag_count; j++) { | 147 | for (j = 1; j < cmd_buf->frag_count; j++) { |
| 148 | buffrag++; | 148 | buffrag++; |
| 149 | if (buffrag->dma) { | 149 | if (buffrag->dma) { |
| 150 | pci_unmap_page(adapter->pdev, buffrag->dma, | 150 | pci_unmap_page(adapter->pdev, buffrag->dma, |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 6098fd4adfeb..69e321a65077 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
| @@ -1963,10 +1963,12 @@ unwind: | |||
| 1963 | while (--i >= 0) { | 1963 | while (--i >= 0) { |
| 1964 | nf = &pbuf->frag_array[i+1]; | 1964 | nf = &pbuf->frag_array[i+1]; |
| 1965 | pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE); | 1965 | pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE); |
| 1966 | nf->dma = 0ULL; | ||
| 1966 | } | 1967 | } |
| 1967 | 1968 | ||
| 1968 | nf = &pbuf->frag_array[0]; | 1969 | nf = &pbuf->frag_array[0]; |
| 1969 | pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); | 1970 | pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); |
| 1971 | nf->dma = 0ULL; | ||
| 1970 | 1972 | ||
| 1971 | out_err: | 1973 | out_err: |
| 1972 | return -ENOMEM; | 1974 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index ed96f309bca8..11702324a071 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -1826,8 +1826,6 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb) | |||
| 1826 | 1826 | ||
| 1827 | if (opts2 & RxVlanTag) | 1827 | if (opts2 & RxVlanTag) |
| 1828 | __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); | 1828 | __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); |
| 1829 | |||
| 1830 | desc->opts2 = 0; | ||
| 1831 | } | 1829 | } |
| 1832 | 1830 | ||
| 1833 | static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) | 1831 | static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) |
| @@ -6064,8 +6062,6 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget | |||
| 6064 | !(status & (RxRWT | RxFOVF)) && | 6062 | !(status & (RxRWT | RxFOVF)) && |
| 6065 | (dev->features & NETIF_F_RXALL)) | 6063 | (dev->features & NETIF_F_RXALL)) |
| 6066 | goto process_pkt; | 6064 | goto process_pkt; |
| 6067 | |||
| 6068 | rtl8169_mark_to_asic(desc, rx_buf_sz); | ||
| 6069 | } else { | 6065 | } else { |
| 6070 | struct sk_buff *skb; | 6066 | struct sk_buff *skb; |
| 6071 | dma_addr_t addr; | 6067 | dma_addr_t addr; |
| @@ -6086,16 +6082,14 @@ process_pkt: | |||
| 6086 | if (unlikely(rtl8169_fragmented_frame(status))) { | 6082 | if (unlikely(rtl8169_fragmented_frame(status))) { |
| 6087 | dev->stats.rx_dropped++; | 6083 | dev->stats.rx_dropped++; |
| 6088 | dev->stats.rx_length_errors++; | 6084 | dev->stats.rx_length_errors++; |
| 6089 | rtl8169_mark_to_asic(desc, rx_buf_sz); | 6085 | goto release_descriptor; |
| 6090 | continue; | ||
| 6091 | } | 6086 | } |
| 6092 | 6087 | ||
| 6093 | skb = rtl8169_try_rx_copy(tp->Rx_databuff[entry], | 6088 | skb = rtl8169_try_rx_copy(tp->Rx_databuff[entry], |
| 6094 | tp, pkt_size, addr); | 6089 | tp, pkt_size, addr); |
| 6095 | rtl8169_mark_to_asic(desc, rx_buf_sz); | ||
| 6096 | if (!skb) { | 6090 | if (!skb) { |
| 6097 | dev->stats.rx_dropped++; | 6091 | dev->stats.rx_dropped++; |
| 6098 | continue; | 6092 | goto release_descriptor; |
| 6099 | } | 6093 | } |
| 6100 | 6094 | ||
| 6101 | rtl8169_rx_csum(skb, status); | 6095 | rtl8169_rx_csum(skb, status); |
| @@ -6111,13 +6105,10 @@ process_pkt: | |||
| 6111 | tp->rx_stats.bytes += pkt_size; | 6105 | tp->rx_stats.bytes += pkt_size; |
| 6112 | u64_stats_update_end(&tp->rx_stats.syncp); | 6106 | u64_stats_update_end(&tp->rx_stats.syncp); |
| 6113 | } | 6107 | } |
| 6114 | 6108 | release_descriptor: | |
| 6115 | /* Work around for AMD plateform. */ | 6109 | desc->opts2 = 0; |
| 6116 | if ((desc->opts2 & cpu_to_le32(0xfffe000)) && | 6110 | wmb(); |
| 6117 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { | 6111 | rtl8169_mark_to_asic(desc, rx_buf_sz); |
| 6118 | desc->opts2 = 0; | ||
| 6119 | cur_rx++; | ||
| 6120 | } | ||
| 6121 | } | 6112 | } |
| 6122 | 6113 | ||
| 6123 | count = cur_rx - tp->cur_rx; | 6114 | count = cur_rx - tp->cur_rx; |
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 7992b3e05d3d..78ace59efd29 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c | |||
| @@ -1801,7 +1801,7 @@ static void rhine_tx(struct net_device *dev) | |||
| 1801 | rp->tx_skbuff[entry]->len, | 1801 | rp->tx_skbuff[entry]->len, |
| 1802 | PCI_DMA_TODEVICE); | 1802 | PCI_DMA_TODEVICE); |
| 1803 | } | 1803 | } |
| 1804 | dev_kfree_skb_irq(rp->tx_skbuff[entry]); | 1804 | dev_kfree_skb(rp->tx_skbuff[entry]); |
| 1805 | rp->tx_skbuff[entry] = NULL; | 1805 | rp->tx_skbuff[entry] = NULL; |
| 1806 | entry = (++rp->dirty_tx) % TX_RING_SIZE; | 1806 | entry = (++rp->dirty_tx) % TX_RING_SIZE; |
| 1807 | } | 1807 | } |
| @@ -2010,11 +2010,7 @@ static void rhine_slow_event_task(struct work_struct *work) | |||
| 2010 | if (intr_status & IntrPCIErr) | 2010 | if (intr_status & IntrPCIErr) |
| 2011 | netif_warn(rp, hw, dev, "PCI error\n"); | 2011 | netif_warn(rp, hw, dev, "PCI error\n"); |
| 2012 | 2012 | ||
| 2013 | napi_disable(&rp->napi); | 2013 | iowrite16(RHINE_EVENT & 0xffff, rp->base + IntrEnable); |
| 2014 | rhine_irq_disable(rp); | ||
| 2015 | /* Slow and safe. Consider __napi_schedule as a replacement ? */ | ||
| 2016 | napi_enable(&rp->napi); | ||
| 2017 | napi_schedule(&rp->napi); | ||
| 2018 | 2014 | ||
| 2019 | out_unlock: | 2015 | out_unlock: |
| 2020 | mutex_unlock(&rp->task_lock); | 2016 | mutex_unlock(&rp->task_lock); |
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 5fd6f4674326..e6fe0d80d612 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
| @@ -84,7 +84,7 @@ struct hv_netvsc_packet { | |||
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | struct netvsc_device_info { | 86 | struct netvsc_device_info { |
| 87 | unsigned char mac_adr[6]; | 87 | unsigned char mac_adr[ETH_ALEN]; |
| 88 | bool link_state; /* 0 - link up, 1 - link down */ | 88 | bool link_state; /* 0 - link up, 1 - link down */ |
| 89 | int ring_size; | 89 | int ring_size; |
| 90 | }; | 90 | }; |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index f825a629a699..8264f0ef7692 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
| @@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p) | |||
| 349 | struct net_device_context *ndevctx = netdev_priv(ndev); | 349 | struct net_device_context *ndevctx = netdev_priv(ndev); |
| 350 | struct hv_device *hdev = ndevctx->device_ctx; | 350 | struct hv_device *hdev = ndevctx->device_ctx; |
| 351 | struct sockaddr *addr = p; | 351 | struct sockaddr *addr = p; |
| 352 | char save_adr[14]; | 352 | char save_adr[ETH_ALEN]; |
| 353 | unsigned char save_aatype; | 353 | unsigned char save_aatype; |
| 354 | int err; | 354 | int err; |
| 355 | 355 | ||
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 81f8f9e31db5..fcbf680c3e62 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
| @@ -77,6 +77,11 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb, | |||
| 77 | 77 | ||
| 78 | skb_orphan(skb); | 78 | skb_orphan(skb); |
| 79 | 79 | ||
| 80 | /* Before queueing this packet to netif_rx(), | ||
| 81 | * make sure dst is refcounted. | ||
| 82 | */ | ||
| 83 | skb_dst_force(skb); | ||
| 84 | |||
| 80 | skb->protocol = eth_type_trans(skb, dev); | 85 | skb->protocol = eth_type_trans(skb, dev); |
| 81 | 86 | ||
| 82 | /* it's OK to use per_cpu_ptr() because BHs are off */ | 87 | /* it's OK to use per_cpu_ptr() because BHs are off */ |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 68a43fe602e7..d3fb97d97cbc 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
| @@ -822,7 +822,10 @@ static int macvlan_changelink(struct net_device *dev, | |||
| 822 | 822 | ||
| 823 | static size_t macvlan_get_size(const struct net_device *dev) | 823 | static size_t macvlan_get_size(const struct net_device *dev) |
| 824 | { | 824 | { |
| 825 | return nla_total_size(4); | 825 | return (0 |
| 826 | + nla_total_size(4) /* IFLA_MACVLAN_MODE */ | ||
| 827 | + nla_total_size(2) /* IFLA_MACVLAN_FLAGS */ | ||
| 828 | ); | ||
| 826 | } | 829 | } |
| 827 | 830 | ||
| 828 | static int macvlan_fill_info(struct sk_buff *skb, | 831 | static int macvlan_fill_info(struct sk_buff *skb, |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index d5199cb4caec..b5ddd5077a80 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
| @@ -36,8 +36,9 @@ MODULE_LICENSE("GPL"); | |||
| 36 | 36 | ||
| 37 | /* IP101A/G - IP1001 */ | 37 | /* IP101A/G - IP1001 */ |
| 38 | #define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ | 38 | #define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ |
| 39 | #define IP1001_RXPHASE_SEL (1<<0) /* Add delay on RX_CLK */ | ||
| 40 | #define IP1001_TXPHASE_SEL (1<<1) /* Add delay on TX_CLK */ | ||
| 39 | #define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ | 41 | #define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ |
| 40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | ||
| 41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | 42 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ |
| 42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ | 43 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ |
| 43 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ | 44 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ |
| @@ -138,19 +139,24 @@ static int ip1001_config_init(struct phy_device *phydev) | |||
| 138 | if (c < 0) | 139 | if (c < 0) |
| 139 | return c; | 140 | return c; |
| 140 | 141 | ||
| 141 | /* INTR pin used: speed/link/duplex will cause an interrupt */ | 142 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
| 142 | c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); | 143 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
| 143 | if (c < 0) | 144 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
| 144 | return c; | 145 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { |
| 145 | 146 | ||
| 146 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { | ||
| 147 | /* Additional delay (2ns) used to adjust RX clock phase | ||
| 148 | * at RGMII interface */ | ||
| 149 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); | 147 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
| 150 | if (c < 0) | 148 | if (c < 0) |
| 151 | return c; | 149 | return c; |
| 152 | 150 | ||
| 153 | c |= IP1001_PHASE_SEL_MASK; | 151 | c &= ~(IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL); |
| 152 | |||
| 153 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | ||
| 154 | c |= (IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL); | ||
| 155 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | ||
| 156 | c |= IP1001_RXPHASE_SEL; | ||
| 157 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | ||
| 158 | c |= IP1001_TXPHASE_SEL; | ||
| 159 | |||
| 154 | c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); | 160 | c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); |
| 155 | if (c < 0) | 161 | if (c < 0) |
| 156 | return c; | 162 | return c; |
| @@ -167,6 +173,11 @@ static int ip101a_g_config_init(struct phy_device *phydev) | |||
| 167 | if (c < 0) | 173 | if (c < 0) |
| 168 | return c; | 174 | return c; |
| 169 | 175 | ||
| 176 | /* INTR pin used: speed/link/duplex will cause an interrupt */ | ||
| 177 | c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); | ||
| 178 | if (c < 0) | ||
| 179 | return c; | ||
| 180 | |||
| 170 | /* Enable Auto Power Saving mode */ | 181 | /* Enable Auto Power Saving mode */ |
| 171 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); | 182 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
| 172 | c |= IP101A_G_APS_ON; | 183 | c |= IP101A_G_APS_ON; |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 5d2a3f215887..22dec9c7ef05 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -353,15 +353,6 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
| 353 | int err; | 353 | int err; |
| 354 | int temp; | 354 | int temp; |
| 355 | 355 | ||
| 356 | /* Enable Fiber/Copper auto selection */ | ||
| 357 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | ||
| 358 | temp &= ~MII_M1111_HWCFG_FIBER_COPPER_AUTO; | ||
| 359 | phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | ||
| 360 | |||
| 361 | temp = phy_read(phydev, MII_BMCR); | ||
| 362 | temp |= BMCR_RESET; | ||
| 363 | phy_write(phydev, MII_BMCR, temp); | ||
| 364 | |||
| 365 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || | 356 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
| 366 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || | 357 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
| 367 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || | 358 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index af372d0957fe..2917a86f4c43 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -109,11 +109,11 @@ struct tap_filter { | |||
| 109 | unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; | 109 | unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | /* 1024 is probably a high enough limit: modern hypervisors seem to support on | 112 | /* DEFAULT_MAX_NUM_RSS_QUEUES were choosed to let the rx/tx queues allocated for |
| 113 | * the order of 100-200 CPUs so this leaves us some breathing space if we want | 113 | * the netdevice to be fit in one page. So we can make sure the success of |
| 114 | * to match a queue per guest CPU. | 114 | * memory allocation. TODO: increase the limit. */ |
| 115 | */ | 115 | #define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES |
| 116 | #define MAX_TAP_QUEUES 1024 | 116 | #define MAX_TAP_FLOWS 4096 |
| 117 | 117 | ||
| 118 | #define TUN_FLOW_EXPIRE (3 * HZ) | 118 | #define TUN_FLOW_EXPIRE (3 * HZ) |
| 119 | 119 | ||
| @@ -185,6 +185,8 @@ struct tun_struct { | |||
| 185 | unsigned long ageing_time; | 185 | unsigned long ageing_time; |
| 186 | unsigned int numdisabled; | 186 | unsigned int numdisabled; |
| 187 | struct list_head disabled; | 187 | struct list_head disabled; |
| 188 | void *security; | ||
| 189 | u32 flow_count; | ||
| 188 | }; | 190 | }; |
| 189 | 191 | ||
| 190 | static inline u32 tun_hashfn(u32 rxhash) | 192 | static inline u32 tun_hashfn(u32 rxhash) |
| @@ -218,6 +220,7 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, | |||
| 218 | e->queue_index = queue_index; | 220 | e->queue_index = queue_index; |
| 219 | e->tun = tun; | 221 | e->tun = tun; |
| 220 | hlist_add_head_rcu(&e->hash_link, head); | 222 | hlist_add_head_rcu(&e->hash_link, head); |
| 223 | ++tun->flow_count; | ||
| 221 | } | 224 | } |
| 222 | return e; | 225 | return e; |
| 223 | } | 226 | } |
| @@ -228,6 +231,7 @@ static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) | |||
| 228 | e->rxhash, e->queue_index); | 231 | e->rxhash, e->queue_index); |
| 229 | hlist_del_rcu(&e->hash_link); | 232 | hlist_del_rcu(&e->hash_link); |
| 230 | kfree_rcu(e, rcu); | 233 | kfree_rcu(e, rcu); |
| 234 | --tun->flow_count; | ||
| 231 | } | 235 | } |
| 232 | 236 | ||
| 233 | static void tun_flow_flush(struct tun_struct *tun) | 237 | static void tun_flow_flush(struct tun_struct *tun) |
| @@ -294,11 +298,12 @@ static void tun_flow_cleanup(unsigned long data) | |||
| 294 | } | 298 | } |
| 295 | 299 | ||
| 296 | static void tun_flow_update(struct tun_struct *tun, u32 rxhash, | 300 | static void tun_flow_update(struct tun_struct *tun, u32 rxhash, |
| 297 | u16 queue_index) | 301 | struct tun_file *tfile) |
| 298 | { | 302 | { |
| 299 | struct hlist_head *head; | 303 | struct hlist_head *head; |
| 300 | struct tun_flow_entry *e; | 304 | struct tun_flow_entry *e; |
| 301 | unsigned long delay = tun->ageing_time; | 305 | unsigned long delay = tun->ageing_time; |
| 306 | u16 queue_index = tfile->queue_index; | ||
| 302 | 307 | ||
| 303 | if (!rxhash) | 308 | if (!rxhash) |
| 304 | return; | 309 | return; |
| @@ -307,7 +312,9 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, | |||
| 307 | 312 | ||
| 308 | rcu_read_lock(); | 313 | rcu_read_lock(); |
| 309 | 314 | ||
| 310 | if (tun->numqueues == 1) | 315 | /* We may get a very small possibility of OOO during switching, not |
| 316 | * worth to optimize.*/ | ||
| 317 | if (tun->numqueues == 1 || tfile->detached) | ||
| 311 | goto unlock; | 318 | goto unlock; |
| 312 | 319 | ||
| 313 | e = tun_flow_find(head, rxhash); | 320 | e = tun_flow_find(head, rxhash); |
| @@ -317,7 +324,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, | |||
| 317 | e->updated = jiffies; | 324 | e->updated = jiffies; |
| 318 | } else { | 325 | } else { |
| 319 | spin_lock_bh(&tun->lock); | 326 | spin_lock_bh(&tun->lock); |
| 320 | if (!tun_flow_find(head, rxhash)) | 327 | if (!tun_flow_find(head, rxhash) && |
| 328 | tun->flow_count < MAX_TAP_FLOWS) | ||
| 321 | tun_flow_create(tun, head, rxhash, queue_index); | 329 | tun_flow_create(tun, head, rxhash, queue_index); |
| 322 | 330 | ||
| 323 | if (!timer_pending(&tun->flow_gc_timer)) | 331 | if (!timer_pending(&tun->flow_gc_timer)) |
| @@ -406,21 +414,21 @@ static void __tun_detach(struct tun_file *tfile, bool clean) | |||
| 406 | 414 | ||
| 407 | tun = rtnl_dereference(tfile->tun); | 415 | tun = rtnl_dereference(tfile->tun); |
| 408 | 416 | ||
| 409 | if (tun) { | 417 | if (tun && !tfile->detached) { |
| 410 | u16 index = tfile->queue_index; | 418 | u16 index = tfile->queue_index; |
| 411 | BUG_ON(index >= tun->numqueues); | 419 | BUG_ON(index >= tun->numqueues); |
| 412 | dev = tun->dev; | 420 | dev = tun->dev; |
| 413 | 421 | ||
| 414 | rcu_assign_pointer(tun->tfiles[index], | 422 | rcu_assign_pointer(tun->tfiles[index], |
| 415 | tun->tfiles[tun->numqueues - 1]); | 423 | tun->tfiles[tun->numqueues - 1]); |
| 416 | rcu_assign_pointer(tfile->tun, NULL); | ||
| 417 | ntfile = rtnl_dereference(tun->tfiles[index]); | 424 | ntfile = rtnl_dereference(tun->tfiles[index]); |
| 418 | ntfile->queue_index = index; | 425 | ntfile->queue_index = index; |
| 419 | 426 | ||
| 420 | --tun->numqueues; | 427 | --tun->numqueues; |
| 421 | if (clean) | 428 | if (clean) { |
| 429 | rcu_assign_pointer(tfile->tun, NULL); | ||
| 422 | sock_put(&tfile->sk); | 430 | sock_put(&tfile->sk); |
| 423 | else | 431 | } else |
| 424 | tun_disable_queue(tun, tfile); | 432 | tun_disable_queue(tun, tfile); |
| 425 | 433 | ||
| 426 | synchronize_net(); | 434 | synchronize_net(); |
| @@ -434,10 +442,13 @@ static void __tun_detach(struct tun_file *tfile, bool clean) | |||
| 434 | } | 442 | } |
| 435 | 443 | ||
| 436 | if (clean) { | 444 | if (clean) { |
| 437 | if (tun && tun->numqueues == 0 && tun->numdisabled == 0 && | 445 | if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { |
| 438 | !(tun->flags & TUN_PERSIST)) | 446 | netif_carrier_off(tun->dev); |
| 439 | if (tun->dev->reg_state == NETREG_REGISTERED) | 447 | |
| 448 | if (!(tun->flags & TUN_PERSIST) && | ||
| 449 | tun->dev->reg_state == NETREG_REGISTERED) | ||
| 440 | unregister_netdevice(tun->dev); | 450 | unregister_netdevice(tun->dev); |
| 451 | } | ||
| 441 | 452 | ||
| 442 | BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, | 453 | BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, |
| 443 | &tfile->socket.flags)); | 454 | &tfile->socket.flags)); |
| @@ -465,6 +476,10 @@ static void tun_detach_all(struct net_device *dev) | |||
| 465 | rcu_assign_pointer(tfile->tun, NULL); | 476 | rcu_assign_pointer(tfile->tun, NULL); |
| 466 | --tun->numqueues; | 477 | --tun->numqueues; |
| 467 | } | 478 | } |
| 479 | list_for_each_entry(tfile, &tun->disabled, next) { | ||
| 480 | wake_up_all(&tfile->wq.wait); | ||
| 481 | rcu_assign_pointer(tfile->tun, NULL); | ||
| 482 | } | ||
| 468 | BUG_ON(tun->numqueues != 0); | 483 | BUG_ON(tun->numqueues != 0); |
| 469 | 484 | ||
| 470 | synchronize_net(); | 485 | synchronize_net(); |
| @@ -490,8 +505,12 @@ static int tun_attach(struct tun_struct *tun, struct file *file) | |||
| 490 | struct tun_file *tfile = file->private_data; | 505 | struct tun_file *tfile = file->private_data; |
| 491 | int err; | 506 | int err; |
| 492 | 507 | ||
| 508 | err = security_tun_dev_attach(tfile->socket.sk, tun->security); | ||
| 509 | if (err < 0) | ||
| 510 | goto out; | ||
| 511 | |||
| 493 | err = -EINVAL; | 512 | err = -EINVAL; |
| 494 | if (rtnl_dereference(tfile->tun)) | 513 | if (rtnl_dereference(tfile->tun) && !tfile->detached) |
| 495 | goto out; | 514 | goto out; |
| 496 | 515 | ||
| 497 | err = -EBUSY; | 516 | err = -EBUSY; |
| @@ -1190,7 +1209,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1190 | tun->dev->stats.rx_packets++; | 1209 | tun->dev->stats.rx_packets++; |
| 1191 | tun->dev->stats.rx_bytes += len; | 1210 | tun->dev->stats.rx_bytes += len; |
| 1192 | 1211 | ||
| 1193 | tun_flow_update(tun, rxhash, tfile->queue_index); | 1212 | tun_flow_update(tun, rxhash, tfile); |
| 1194 | return total_len; | 1213 | return total_len; |
| 1195 | } | 1214 | } |
| 1196 | 1215 | ||
| @@ -1373,6 +1392,7 @@ static void tun_free_netdev(struct net_device *dev) | |||
| 1373 | 1392 | ||
| 1374 | BUG_ON(!(list_empty(&tun->disabled))); | 1393 | BUG_ON(!(list_empty(&tun->disabled))); |
| 1375 | tun_flow_uninit(tun); | 1394 | tun_flow_uninit(tun); |
| 1395 | security_tun_dev_free_security(tun->security); | ||
| 1376 | free_netdev(dev); | 1396 | free_netdev(dev); |
| 1377 | } | 1397 | } |
| 1378 | 1398 | ||
| @@ -1562,7 +1582,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1562 | 1582 | ||
| 1563 | if (tun_not_capable(tun)) | 1583 | if (tun_not_capable(tun)) |
| 1564 | return -EPERM; | 1584 | return -EPERM; |
| 1565 | err = security_tun_dev_attach(tfile->socket.sk); | 1585 | err = security_tun_dev_open(tun->security); |
| 1566 | if (err < 0) | 1586 | if (err < 0) |
| 1567 | return err; | 1587 | return err; |
| 1568 | 1588 | ||
| @@ -1577,6 +1597,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1577 | else { | 1597 | else { |
| 1578 | char *name; | 1598 | char *name; |
| 1579 | unsigned long flags = 0; | 1599 | unsigned long flags = 0; |
| 1600 | int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ? | ||
| 1601 | MAX_TAP_QUEUES : 1; | ||
| 1580 | 1602 | ||
| 1581 | if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) | 1603 | if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) |
| 1582 | return -EPERM; | 1604 | return -EPERM; |
| @@ -1600,8 +1622,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1600 | name = ifr->ifr_name; | 1622 | name = ifr->ifr_name; |
| 1601 | 1623 | ||
| 1602 | dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, | 1624 | dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, |
| 1603 | tun_setup, | 1625 | tun_setup, queues, queues); |
| 1604 | MAX_TAP_QUEUES, MAX_TAP_QUEUES); | 1626 | |
| 1605 | if (!dev) | 1627 | if (!dev) |
| 1606 | return -ENOMEM; | 1628 | return -ENOMEM; |
| 1607 | 1629 | ||
| @@ -1619,7 +1641,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1619 | 1641 | ||
| 1620 | spin_lock_init(&tun->lock); | 1642 | spin_lock_init(&tun->lock); |
| 1621 | 1643 | ||
| 1622 | security_tun_dev_post_create(&tfile->sk); | 1644 | err = security_tun_dev_alloc_security(&tun->security); |
| 1645 | if (err < 0) | ||
| 1646 | goto err_free_dev; | ||
| 1623 | 1647 | ||
| 1624 | tun_net_init(dev); | 1648 | tun_net_init(dev); |
| 1625 | 1649 | ||
| @@ -1644,10 +1668,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1644 | device_create_file(&tun->dev->dev, &dev_attr_owner) || | 1668 | device_create_file(&tun->dev->dev, &dev_attr_owner) || |
| 1645 | device_create_file(&tun->dev->dev, &dev_attr_group)) | 1669 | device_create_file(&tun->dev->dev, &dev_attr_group)) |
| 1646 | pr_err("Failed to create tun sysfs files\n"); | 1670 | pr_err("Failed to create tun sysfs files\n"); |
| 1647 | |||
| 1648 | netif_carrier_on(tun->dev); | ||
| 1649 | } | 1671 | } |
| 1650 | 1672 | ||
| 1673 | netif_carrier_on(tun->dev); | ||
| 1674 | |||
| 1651 | tun_debug(KERN_INFO, tun, "tun_set_iff\n"); | 1675 | tun_debug(KERN_INFO, tun, "tun_set_iff\n"); |
| 1652 | 1676 | ||
| 1653 | if (ifr->ifr_flags & IFF_NO_PI) | 1677 | if (ifr->ifr_flags & IFF_NO_PI) |
| @@ -1789,19 +1813,24 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) | |||
| 1789 | 1813 | ||
| 1790 | if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { | 1814 | if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { |
| 1791 | tun = tfile->detached; | 1815 | tun = tfile->detached; |
| 1792 | if (!tun) | 1816 | if (!tun) { |
| 1793 | ret = -EINVAL; | 1817 | ret = -EINVAL; |
| 1794 | else | 1818 | goto unlock; |
| 1795 | ret = tun_attach(tun, file); | 1819 | } |
| 1820 | ret = security_tun_dev_attach_queue(tun->security); | ||
| 1821 | if (ret < 0) | ||
| 1822 | goto unlock; | ||
| 1823 | ret = tun_attach(tun, file); | ||
| 1796 | } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { | 1824 | } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { |
| 1797 | tun = rtnl_dereference(tfile->tun); | 1825 | tun = rtnl_dereference(tfile->tun); |
| 1798 | if (!tun || !(tun->flags & TUN_TAP_MQ)) | 1826 | if (!tun || !(tun->flags & TUN_TAP_MQ) || tfile->detached) |
| 1799 | ret = -EINVAL; | 1827 | ret = -EINVAL; |
| 1800 | else | 1828 | else |
| 1801 | __tun_detach(tfile, false); | 1829 | __tun_detach(tfile, false); |
| 1802 | } else | 1830 | } else |
| 1803 | ret = -EINVAL; | 1831 | ret = -EINVAL; |
| 1804 | 1832 | ||
| 1833 | unlock: | ||
| 1805 | rtnl_unlock(); | 1834 | rtnl_unlock(); |
| 1806 | return ret; | 1835 | return ret; |
| 1807 | } | 1836 | } |
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 42f51c71ec1f..248d2dc765a5 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
| @@ -374,6 +374,21 @@ static const struct driver_info cdc_mbim_info = { | |||
| 374 | .tx_fixup = cdc_mbim_tx_fixup, | 374 | .tx_fixup = cdc_mbim_tx_fixup, |
| 375 | }; | 375 | }; |
| 376 | 376 | ||
| 377 | /* MBIM and NCM devices should not need a ZLP after NTBs with | ||
| 378 | * dwNtbOutMaxSize length. This driver_info is for the exceptional | ||
| 379 | * devices requiring it anyway, allowing them to be supported without | ||
| 380 | * forcing the performance penalty on all the sane devices. | ||
| 381 | */ | ||
| 382 | static const struct driver_info cdc_mbim_info_zlp = { | ||
| 383 | .description = "CDC MBIM", | ||
| 384 | .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN | FLAG_SEND_ZLP, | ||
| 385 | .bind = cdc_mbim_bind, | ||
| 386 | .unbind = cdc_mbim_unbind, | ||
| 387 | .manage_power = cdc_mbim_manage_power, | ||
| 388 | .rx_fixup = cdc_mbim_rx_fixup, | ||
| 389 | .tx_fixup = cdc_mbim_tx_fixup, | ||
| 390 | }; | ||
| 391 | |||
| 377 | static const struct usb_device_id mbim_devs[] = { | 392 | static const struct usb_device_id mbim_devs[] = { |
| 378 | /* This duplicate NCM entry is intentional. MBIM devices can | 393 | /* This duplicate NCM entry is intentional. MBIM devices can |
| 379 | * be disguised as NCM by default, and this is necessary to | 394 | * be disguised as NCM by default, and this is necessary to |
| @@ -385,6 +400,10 @@ static const struct usb_device_id mbim_devs[] = { | |||
| 385 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), | 400 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), |
| 386 | .driver_info = (unsigned long)&cdc_mbim_info, | 401 | .driver_info = (unsigned long)&cdc_mbim_info, |
| 387 | }, | 402 | }, |
| 403 | /* Sierra Wireless MC7710 need ZLPs */ | ||
| 404 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68a2, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | ||
| 405 | .driver_info = (unsigned long)&cdc_mbim_info_zlp, | ||
| 406 | }, | ||
| 388 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | 407 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
| 389 | .driver_info = (unsigned long)&cdc_mbim_info, | 408 | .driver_info = (unsigned long)&cdc_mbim_info, |
| 390 | }, | 409 | }, |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92b8e9b..00d3b2d37828 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
| @@ -435,6 +435,13 @@ advance: | |||
| 435 | len -= temp; | 435 | len -= temp; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | /* some buggy devices have an IAD but no CDC Union */ | ||
| 439 | if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) { | ||
| 440 | ctx->control = intf; | ||
| 441 | ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1); | ||
| 442 | dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n"); | ||
| 443 | } | ||
| 444 | |||
| 438 | /* check if we got everything */ | 445 | /* check if we got everything */ |
| 439 | if ((ctx->control == NULL) || (ctx->data == NULL) || | 446 | if ((ctx->control == NULL) || (ctx->data == NULL) || |
| 440 | ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf)))) | 447 | ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf)))) |
| @@ -497,7 +504,8 @@ advance: | |||
| 497 | error2: | 504 | error2: |
| 498 | usb_set_intfdata(ctx->control, NULL); | 505 | usb_set_intfdata(ctx->control, NULL); |
| 499 | usb_set_intfdata(ctx->data, NULL); | 506 | usb_set_intfdata(ctx->data, NULL); |
| 500 | usb_driver_release_interface(driver, ctx->data); | 507 | if (ctx->data != ctx->control) |
| 508 | usb_driver_release_interface(driver, ctx->data); | ||
| 501 | error: | 509 | error: |
| 502 | cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); | 510 | cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); |
| 503 | dev->data[0] = 0; | 511 | dev->data[0] = 0; |
| @@ -1155,6 +1163,20 @@ static const struct driver_info wwan_info = { | |||
| 1155 | .tx_fixup = cdc_ncm_tx_fixup, | 1163 | .tx_fixup = cdc_ncm_tx_fixup, |
| 1156 | }; | 1164 | }; |
| 1157 | 1165 | ||
| 1166 | /* Same as wwan_info, but with FLAG_NOARP */ | ||
| 1167 | static const struct driver_info wwan_noarp_info = { | ||
| 1168 | .description = "Mobile Broadband Network Device (NO ARP)", | ||
| 1169 | .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET | ||
| 1170 | | FLAG_WWAN | FLAG_NOARP, | ||
| 1171 | .bind = cdc_ncm_bind, | ||
| 1172 | .unbind = cdc_ncm_unbind, | ||
| 1173 | .check_connect = cdc_ncm_check_connect, | ||
| 1174 | .manage_power = usbnet_manage_power, | ||
| 1175 | .status = cdc_ncm_status, | ||
| 1176 | .rx_fixup = cdc_ncm_rx_fixup, | ||
| 1177 | .tx_fixup = cdc_ncm_tx_fixup, | ||
| 1178 | }; | ||
| 1179 | |||
| 1158 | static const struct usb_device_id cdc_devs[] = { | 1180 | static const struct usb_device_id cdc_devs[] = { |
| 1159 | /* Ericsson MBM devices like F5521gw */ | 1181 | /* Ericsson MBM devices like F5521gw */ |
| 1160 | { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | 1182 | { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
| @@ -1193,6 +1215,16 @@ static const struct usb_device_id cdc_devs[] = { | |||
| 1193 | { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46), | 1215 | { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46), |
| 1194 | .driver_info = (unsigned long)&wwan_info, | 1216 | .driver_info = (unsigned long)&wwan_info, |
| 1195 | }, | 1217 | }, |
| 1218 | { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76), | ||
| 1219 | .driver_info = (unsigned long)&wwan_info, | ||
| 1220 | }, | ||
| 1221 | |||
| 1222 | /* Infineon(now Intel) HSPA Modem platform */ | ||
| 1223 | { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, | ||
| 1224 | USB_CLASS_COMM, | ||
| 1225 | USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), | ||
| 1226 | .driver_info = (unsigned long)&wwan_noarp_info, | ||
| 1227 | }, | ||
| 1196 | 1228 | ||
| 1197 | /* Generic CDC-NCM devices */ | 1229 | /* Generic CDC-NCM devices */ |
| 1198 | { USB_INTERFACE_INFO(USB_CLASS_COMM, | 1230 | { USB_INTERFACE_INFO(USB_CLASS_COMM, |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 3f554c1149f3..d7e99445518e 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
| @@ -45,6 +45,12 @@ | |||
| 45 | #define DM_MCAST_ADDR 0x16 /* 8 bytes */ | 45 | #define DM_MCAST_ADDR 0x16 /* 8 bytes */ |
| 46 | #define DM_GPR_CTRL 0x1e | 46 | #define DM_GPR_CTRL 0x1e |
| 47 | #define DM_GPR_DATA 0x1f | 47 | #define DM_GPR_DATA 0x1f |
| 48 | #define DM_CHIP_ID 0x2c | ||
| 49 | #define DM_MODE_CTRL 0x91 /* only on dm9620 */ | ||
| 50 | |||
| 51 | /* chip id values */ | ||
| 52 | #define ID_DM9601 0 | ||
| 53 | #define ID_DM9620 1 | ||
| 48 | 54 | ||
| 49 | #define DM_MAX_MCAST 64 | 55 | #define DM_MAX_MCAST 64 |
| 50 | #define DM_MCAST_SIZE 8 | 56 | #define DM_MCAST_SIZE 8 |
| @@ -53,7 +59,6 @@ | |||
| 53 | #define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */ | 59 | #define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */ |
| 54 | #define DM_TIMEOUT 1000 | 60 | #define DM_TIMEOUT 1000 |
| 55 | 61 | ||
| 56 | |||
| 57 | static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) | 62 | static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) |
| 58 | { | 63 | { |
| 59 | int err; | 64 | int err; |
| @@ -84,32 +89,23 @@ static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data) | |||
| 84 | 89 | ||
| 85 | static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) | 90 | static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) |
| 86 | { | 91 | { |
| 87 | return usbnet_write_cmd(dev, DM_WRITE_REGS, | 92 | return usbnet_write_cmd(dev, DM_WRITE_REG, |
| 88 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 93 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 89 | value, reg, NULL, 0); | 94 | value, reg, NULL, 0); |
| 90 | } | 95 | } |
| 91 | 96 | ||
| 92 | static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value, | 97 | static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) |
| 93 | u16 length, void *data) | ||
| 94 | { | 98 | { |
| 95 | usbnet_write_cmd_async(dev, DM_WRITE_REGS, | 99 | usbnet_write_cmd_async(dev, DM_WRITE_REGS, |
| 96 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 100 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 97 | value, reg, data, length); | 101 | 0, reg, data, length); |
| 98 | } | ||
| 99 | |||
| 100 | static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) | ||
| 101 | { | ||
| 102 | netdev_dbg(dev->net, "dm_write_async() reg=0x%02x length=%d\n", reg, length); | ||
| 103 | |||
| 104 | dm_write_async_helper(dev, reg, 0, length, data); | ||
| 105 | } | 102 | } |
| 106 | 103 | ||
| 107 | static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) | 104 | static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) |
| 108 | { | 105 | { |
| 109 | netdev_dbg(dev->net, "dm_write_reg_async() reg=0x%02x value=0x%02x\n", | 106 | usbnet_write_cmd_async(dev, DM_WRITE_REG, |
| 110 | reg, value); | 107 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 111 | 108 | value, reg, NULL, 0); | |
| 112 | dm_write_async_helper(dev, reg, value, 0, NULL); | ||
| 113 | } | 109 | } |
| 114 | 110 | ||
| 115 | static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value) | 111 | static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value) |
| @@ -358,7 +354,7 @@ static const struct net_device_ops dm9601_netdev_ops = { | |||
| 358 | static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) | 354 | static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) |
| 359 | { | 355 | { |
| 360 | int ret; | 356 | int ret; |
| 361 | u8 mac[ETH_ALEN]; | 357 | u8 mac[ETH_ALEN], id; |
| 362 | 358 | ||
| 363 | ret = usbnet_get_endpoints(dev, intf); | 359 | ret = usbnet_get_endpoints(dev, intf); |
| 364 | if (ret) | 360 | if (ret) |
| @@ -399,6 +395,24 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 399 | __dm9601_set_mac_address(dev); | 395 | __dm9601_set_mac_address(dev); |
| 400 | } | 396 | } |
| 401 | 397 | ||
| 398 | if (dm_read_reg(dev, DM_CHIP_ID, &id) < 0) { | ||
| 399 | netdev_err(dev->net, "Error reading chip ID\n"); | ||
| 400 | ret = -ENODEV; | ||
| 401 | goto out; | ||
| 402 | } | ||
| 403 | |||
| 404 | /* put dm9620 devices in dm9601 mode */ | ||
| 405 | if (id == ID_DM9620) { | ||
| 406 | u8 mode; | ||
| 407 | |||
| 408 | if (dm_read_reg(dev, DM_MODE_CTRL, &mode) < 0) { | ||
| 409 | netdev_err(dev->net, "Error reading MODE_CTRL\n"); | ||
| 410 | ret = -ENODEV; | ||
| 411 | goto out; | ||
| 412 | } | ||
| 413 | dm_write_reg(dev, DM_MODE_CTRL, mode & 0x7f); | ||
| 414 | } | ||
| 415 | |||
| 402 | /* power up phy */ | 416 | /* power up phy */ |
| 403 | dm_write_reg(dev, DM_GPR_CTRL, 1); | 417 | dm_write_reg(dev, DM_GPR_CTRL, 1); |
| 404 | dm_write_reg(dev, DM_GPR_DATA, 0); | 418 | dm_write_reg(dev, DM_GPR_DATA, 0); |
| @@ -581,6 +595,10 @@ static const struct usb_device_id products[] = { | |||
| 581 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ | 595 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ |
| 582 | .driver_info = (unsigned long)&dm9601_info, | 596 | .driver_info = (unsigned long)&dm9601_info, |
| 583 | }, | 597 | }, |
| 598 | { | ||
| 599 | USB_DEVICE(0x0a46, 0x9620), /* DM9620 USB to Fast Ethernet Adapter */ | ||
| 600 | .driver_info = (unsigned long)&dm9601_info, | ||
| 601 | }, | ||
| 584 | {}, // END | 602 | {}, // END |
| 585 | }; | 603 | }; |
| 586 | 604 | ||
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 6a1ca500e612..c8e05e27f38c 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -351,6 +351,10 @@ static const struct usb_device_id products[] = { | |||
| 351 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57), | 351 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57), |
| 352 | .driver_info = (unsigned long)&qmi_wwan_info, | 352 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 353 | }, | 353 | }, |
| 354 | { /* HUAWEI_INTERFACE_NDIS_CONTROL_QUALCOMM */ | ||
| 355 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x69), | ||
| 356 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
| 357 | }, | ||
| 354 | 358 | ||
| 355 | /* 2. Combined interface devices matching on class+protocol */ | 359 | /* 2. Combined interface devices matching on class+protocol */ |
| 356 | { /* Huawei E367 and possibly others in "Windows mode" */ | 360 | { /* Huawei E367 and possibly others in "Windows mode" */ |
| @@ -361,6 +365,14 @@ static const struct usb_device_id products[] = { | |||
| 361 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), | 365 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), |
| 362 | .driver_info = (unsigned long)&qmi_wwan_info, | 366 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 363 | }, | 367 | }, |
| 368 | { /* HUAWEI_NDIS_SINGLE_INTERFACE_VDF */ | ||
| 369 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x37), | ||
| 370 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
| 371 | }, | ||
| 372 | { /* HUAWEI_INTERFACE_NDIS_HW_QUALCOMM */ | ||
| 373 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x67), | ||
| 374 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
| 375 | }, | ||
| 364 | { /* Pantech UML290, P4200 and more */ | 376 | { /* Pantech UML290, P4200 and more */ |
| 365 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), | 377 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), |
| 366 | .driver_info = (unsigned long)&qmi_wwan_info, | 378 | .driver_info = (unsigned long)&qmi_wwan_info, |
| @@ -433,6 +445,7 @@ static const struct usb_device_id products[] = { | |||
| 433 | {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ | 445 | {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ |
| 434 | {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, | 446 | {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, |
| 435 | {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ | 447 | {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ |
| 448 | {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */ | ||
| 436 | {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ | 449 | {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ |
| 437 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ | 450 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
| 438 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ | 451 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
| @@ -459,6 +472,8 @@ static const struct usb_device_id products[] = { | |||
| 459 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ | 472 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ |
| 460 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ | 473 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ |
| 461 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 474 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
| 475 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | ||
| 476 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | ||
| 462 | 477 | ||
| 463 | /* 4. Gobi 1000 devices */ | 478 | /* 4. Gobi 1000 devices */ |
| 464 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 479 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01641b4..5e33606c1366 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -380,6 +380,12 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
| 380 | unsigned long lockflags; | 380 | unsigned long lockflags; |
| 381 | size_t size = dev->rx_urb_size; | 381 | size_t size = dev->rx_urb_size; |
| 382 | 382 | ||
| 383 | /* prevent rx skb allocation when error ratio is high */ | ||
| 384 | if (test_bit(EVENT_RX_KILL, &dev->flags)) { | ||
| 385 | usb_free_urb(urb); | ||
| 386 | return -ENOLINK; | ||
| 387 | } | ||
| 388 | |||
| 383 | skb = __netdev_alloc_skb_ip_align(dev->net, size, flags); | 389 | skb = __netdev_alloc_skb_ip_align(dev->net, size, flags); |
| 384 | if (!skb) { | 390 | if (!skb) { |
| 385 | netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); | 391 | netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); |
| @@ -539,6 +545,17 @@ block: | |||
| 539 | break; | 545 | break; |
| 540 | } | 546 | } |
| 541 | 547 | ||
| 548 | /* stop rx if packet error rate is high */ | ||
| 549 | if (++dev->pkt_cnt > 30) { | ||
| 550 | dev->pkt_cnt = 0; | ||
| 551 | dev->pkt_err = 0; | ||
| 552 | } else { | ||
| 553 | if (state == rx_cleanup) | ||
| 554 | dev->pkt_err++; | ||
| 555 | if (dev->pkt_err > 20) | ||
| 556 | set_bit(EVENT_RX_KILL, &dev->flags); | ||
| 557 | } | ||
| 558 | |||
| 542 | state = defer_bh(dev, skb, &dev->rxq, state); | 559 | state = defer_bh(dev, skb, &dev->rxq, state); |
| 543 | 560 | ||
| 544 | if (urb) { | 561 | if (urb) { |
| @@ -791,6 +808,11 @@ int usbnet_open (struct net_device *net) | |||
| 791 | (dev->driver_info->flags & FLAG_FRAMING_AX) ? "ASIX" : | 808 | (dev->driver_info->flags & FLAG_FRAMING_AX) ? "ASIX" : |
| 792 | "simple"); | 809 | "simple"); |
| 793 | 810 | ||
| 811 | /* reset rx error state */ | ||
| 812 | dev->pkt_cnt = 0; | ||
| 813 | dev->pkt_err = 0; | ||
| 814 | clear_bit(EVENT_RX_KILL, &dev->flags); | ||
| 815 | |||
| 794 | // delay posting reads until we're fully open | 816 | // delay posting reads until we're fully open |
| 795 | tasklet_schedule (&dev->bh); | 817 | tasklet_schedule (&dev->bh); |
| 796 | if (info->manage_power) { | 818 | if (info->manage_power) { |
| @@ -1103,13 +1125,11 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
| 1103 | if (info->tx_fixup) { | 1125 | if (info->tx_fixup) { |
| 1104 | skb = info->tx_fixup (dev, skb, GFP_ATOMIC); | 1126 | skb = info->tx_fixup (dev, skb, GFP_ATOMIC); |
| 1105 | if (!skb) { | 1127 | if (!skb) { |
| 1106 | if (netif_msg_tx_err(dev)) { | 1128 | /* packet collected; minidriver waiting for more */ |
| 1107 | netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n"); | 1129 | if (info->flags & FLAG_MULTI_PACKET) |
| 1108 | goto drop; | ||
| 1109 | } else { | ||
| 1110 | /* cdc_ncm collected packet; waits for more */ | ||
| 1111 | goto not_drop; | 1130 | goto not_drop; |
| 1112 | } | 1131 | netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n"); |
| 1132 | goto drop; | ||
| 1113 | } | 1133 | } |
| 1114 | } | 1134 | } |
| 1115 | length = skb->len; | 1135 | length = skb->len; |
| @@ -1254,6 +1274,9 @@ static void usbnet_bh (unsigned long param) | |||
| 1254 | } | 1274 | } |
| 1255 | } | 1275 | } |
| 1256 | 1276 | ||
| 1277 | /* restart RX again after disabling due to high error rate */ | ||
| 1278 | clear_bit(EVENT_RX_KILL, &dev->flags); | ||
| 1279 | |||
| 1257 | // waiting for all pending urbs to complete? | 1280 | // waiting for all pending urbs to complete? |
| 1258 | if (dev->wait) { | 1281 | if (dev->wait) { |
| 1259 | if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { | 1282 | if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { |
| @@ -1448,6 +1471,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
| 1448 | if ((dev->driver_info->flags & FLAG_WWAN) != 0) | 1471 | if ((dev->driver_info->flags & FLAG_WWAN) != 0) |
| 1449 | strcpy(net->name, "wwan%d"); | 1472 | strcpy(net->name, "wwan%d"); |
| 1450 | 1473 | ||
| 1474 | /* devices that cannot do ARP */ | ||
| 1475 | if ((dev->driver_info->flags & FLAG_NOARP) != 0) | ||
| 1476 | net->flags |= IFF_NOARP; | ||
| 1477 | |||
| 1451 | /* maybe the remote can't receive an Ethernet MTU */ | 1478 | /* maybe the remote can't receive an Ethernet MTU */ |
| 1452 | if (net->mtu > (dev->hard_mtu - net->hard_header_len)) | 1479 | if (net->mtu > (dev->hard_mtu - net->hard_header_len)) |
| 1453 | net->mtu = dev->hard_mtu - net->hard_header_len; | 1480 | net->mtu = dev->hard_mtu - net->hard_header_len; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a6fcf15adc4f..35c00c5ea02a 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/scatterlist.h> | 26 | #include <linux/scatterlist.h> |
| 27 | #include <linux/if_vlan.h> | 27 | #include <linux/if_vlan.h> |
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/cpu.h> | ||
| 29 | 30 | ||
| 30 | static int napi_weight = 128; | 31 | static int napi_weight = 128; |
| 31 | module_param(napi_weight, int, 0444); | 32 | module_param(napi_weight, int, 0444); |
| @@ -123,6 +124,12 @@ struct virtnet_info { | |||
| 123 | 124 | ||
| 124 | /* Does the affinity hint is set for virtqueues? */ | 125 | /* Does the affinity hint is set for virtqueues? */ |
| 125 | bool affinity_hint_set; | 126 | bool affinity_hint_set; |
| 127 | |||
| 128 | /* Per-cpu variable to show the mapping from CPU to virtqueue */ | ||
| 129 | int __percpu *vq_index; | ||
| 130 | |||
| 131 | /* CPU hot plug notifier */ | ||
| 132 | struct notifier_block nb; | ||
| 126 | }; | 133 | }; |
| 127 | 134 | ||
| 128 | struct skb_vnet_hdr { | 135 | struct skb_vnet_hdr { |
| @@ -1013,32 +1020,75 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) | |||
| 1013 | return 0; | 1020 | return 0; |
| 1014 | } | 1021 | } |
| 1015 | 1022 | ||
| 1016 | static void virtnet_set_affinity(struct virtnet_info *vi, bool set) | 1023 | static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu) |
| 1017 | { | 1024 | { |
| 1018 | int i; | 1025 | int i; |
| 1026 | int cpu; | ||
| 1027 | |||
| 1028 | if (vi->affinity_hint_set) { | ||
| 1029 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 1030 | virtqueue_set_affinity(vi->rq[i].vq, -1); | ||
| 1031 | virtqueue_set_affinity(vi->sq[i].vq, -1); | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | vi->affinity_hint_set = false; | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | i = 0; | ||
| 1038 | for_each_online_cpu(cpu) { | ||
| 1039 | if (cpu == hcpu) { | ||
| 1040 | *per_cpu_ptr(vi->vq_index, cpu) = -1; | ||
| 1041 | } else { | ||
| 1042 | *per_cpu_ptr(vi->vq_index, cpu) = | ||
| 1043 | ++i % vi->curr_queue_pairs; | ||
| 1044 | } | ||
| 1045 | } | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | static void virtnet_set_affinity(struct virtnet_info *vi) | ||
| 1049 | { | ||
| 1050 | int i; | ||
| 1051 | int cpu; | ||
| 1019 | 1052 | ||
| 1020 | /* In multiqueue mode, when the number of cpu is equal to the number of | 1053 | /* In multiqueue mode, when the number of cpu is equal to the number of |
| 1021 | * queue pairs, we let the queue pairs to be private to one cpu by | 1054 | * queue pairs, we let the queue pairs to be private to one cpu by |
| 1022 | * setting the affinity hint to eliminate the contention. | 1055 | * setting the affinity hint to eliminate the contention. |
| 1023 | */ | 1056 | */ |
| 1024 | if ((vi->curr_queue_pairs == 1 || | 1057 | if (vi->curr_queue_pairs == 1 || |
| 1025 | vi->max_queue_pairs != num_online_cpus()) && set) { | 1058 | vi->max_queue_pairs != num_online_cpus()) { |
| 1026 | if (vi->affinity_hint_set) | 1059 | virtnet_clean_affinity(vi, -1); |
| 1027 | set = false; | 1060 | return; |
| 1028 | else | ||
| 1029 | return; | ||
| 1030 | } | 1061 | } |
| 1031 | 1062 | ||
| 1032 | for (i = 0; i < vi->max_queue_pairs; i++) { | 1063 | i = 0; |
| 1033 | int cpu = set ? i : -1; | 1064 | for_each_online_cpu(cpu) { |
| 1034 | virtqueue_set_affinity(vi->rq[i].vq, cpu); | 1065 | virtqueue_set_affinity(vi->rq[i].vq, cpu); |
| 1035 | virtqueue_set_affinity(vi->sq[i].vq, cpu); | 1066 | virtqueue_set_affinity(vi->sq[i].vq, cpu); |
| 1067 | *per_cpu_ptr(vi->vq_index, cpu) = i; | ||
| 1068 | i++; | ||
| 1036 | } | 1069 | } |
| 1037 | 1070 | ||
| 1038 | if (set) | 1071 | vi->affinity_hint_set = true; |
| 1039 | vi->affinity_hint_set = true; | 1072 | } |
| 1040 | else | 1073 | |
| 1041 | vi->affinity_hint_set = false; | 1074 | static int virtnet_cpu_callback(struct notifier_block *nfb, |
| 1075 | unsigned long action, void *hcpu) | ||
| 1076 | { | ||
| 1077 | struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb); | ||
| 1078 | |||
| 1079 | switch(action & ~CPU_TASKS_FROZEN) { | ||
| 1080 | case CPU_ONLINE: | ||
| 1081 | case CPU_DOWN_FAILED: | ||
| 1082 | case CPU_DEAD: | ||
| 1083 | virtnet_set_affinity(vi); | ||
| 1084 | break; | ||
| 1085 | case CPU_DOWN_PREPARE: | ||
| 1086 | virtnet_clean_affinity(vi, (long)hcpu); | ||
| 1087 | break; | ||
| 1088 | default: | ||
| 1089 | break; | ||
| 1090 | } | ||
| 1091 | return NOTIFY_OK; | ||
| 1042 | } | 1092 | } |
| 1043 | 1093 | ||
| 1044 | static void virtnet_get_ringparam(struct net_device *dev, | 1094 | static void virtnet_get_ringparam(struct net_device *dev, |
| @@ -1082,13 +1132,15 @@ static int virtnet_set_channels(struct net_device *dev, | |||
| 1082 | if (queue_pairs > vi->max_queue_pairs) | 1132 | if (queue_pairs > vi->max_queue_pairs) |
| 1083 | return -EINVAL; | 1133 | return -EINVAL; |
| 1084 | 1134 | ||
| 1135 | get_online_cpus(); | ||
| 1085 | err = virtnet_set_queues(vi, queue_pairs); | 1136 | err = virtnet_set_queues(vi, queue_pairs); |
| 1086 | if (!err) { | 1137 | if (!err) { |
| 1087 | netif_set_real_num_tx_queues(dev, queue_pairs); | 1138 | netif_set_real_num_tx_queues(dev, queue_pairs); |
| 1088 | netif_set_real_num_rx_queues(dev, queue_pairs); | 1139 | netif_set_real_num_rx_queues(dev, queue_pairs); |
| 1089 | 1140 | ||
| 1090 | virtnet_set_affinity(vi, true); | 1141 | virtnet_set_affinity(vi); |
| 1091 | } | 1142 | } |
| 1143 | put_online_cpus(); | ||
| 1092 | 1144 | ||
| 1093 | return err; | 1145 | return err; |
| 1094 | } | 1146 | } |
| @@ -1127,12 +1179,19 @@ static int virtnet_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1127 | 1179 | ||
| 1128 | /* To avoid contending a lock hold by a vcpu who would exit to host, select the | 1180 | /* To avoid contending a lock hold by a vcpu who would exit to host, select the |
| 1129 | * txq based on the processor id. | 1181 | * txq based on the processor id. |
| 1130 | * TODO: handle cpu hotplug. | ||
| 1131 | */ | 1182 | */ |
| 1132 | static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) | 1183 | static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) |
| 1133 | { | 1184 | { |
| 1134 | int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : | 1185 | int txq; |
| 1135 | smp_processor_id(); | 1186 | struct virtnet_info *vi = netdev_priv(dev); |
| 1187 | |||
| 1188 | if (skb_rx_queue_recorded(skb)) { | ||
| 1189 | txq = skb_get_rx_queue(skb); | ||
| 1190 | } else { | ||
| 1191 | txq = *__this_cpu_ptr(vi->vq_index); | ||
| 1192 | if (txq == -1) | ||
| 1193 | txq = 0; | ||
| 1194 | } | ||
| 1136 | 1195 | ||
| 1137 | while (unlikely(txq >= dev->real_num_tx_queues)) | 1196 | while (unlikely(txq >= dev->real_num_tx_queues)) |
| 1138 | txq -= dev->real_num_tx_queues; | 1197 | txq -= dev->real_num_tx_queues; |
| @@ -1248,7 +1307,7 @@ static void virtnet_del_vqs(struct virtnet_info *vi) | |||
| 1248 | { | 1307 | { |
| 1249 | struct virtio_device *vdev = vi->vdev; | 1308 | struct virtio_device *vdev = vi->vdev; |
| 1250 | 1309 | ||
| 1251 | virtnet_set_affinity(vi, false); | 1310 | virtnet_clean_affinity(vi, -1); |
| 1252 | 1311 | ||
| 1253 | vdev->config->del_vqs(vdev); | 1312 | vdev->config->del_vqs(vdev); |
| 1254 | 1313 | ||
| @@ -1371,7 +1430,10 @@ static int init_vqs(struct virtnet_info *vi) | |||
| 1371 | if (ret) | 1430 | if (ret) |
| 1372 | goto err_free; | 1431 | goto err_free; |
| 1373 | 1432 | ||
| 1374 | virtnet_set_affinity(vi, true); | 1433 | get_online_cpus(); |
| 1434 | virtnet_set_affinity(vi); | ||
| 1435 | put_online_cpus(); | ||
| 1436 | |||
| 1375 | return 0; | 1437 | return 0; |
| 1376 | 1438 | ||
| 1377 | err_free: | 1439 | err_free: |
| @@ -1453,6 +1515,10 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1453 | if (vi->stats == NULL) | 1515 | if (vi->stats == NULL) |
| 1454 | goto free; | 1516 | goto free; |
| 1455 | 1517 | ||
| 1518 | vi->vq_index = alloc_percpu(int); | ||
| 1519 | if (vi->vq_index == NULL) | ||
| 1520 | goto free_stats; | ||
| 1521 | |||
| 1456 | mutex_init(&vi->config_lock); | 1522 | mutex_init(&vi->config_lock); |
| 1457 | vi->config_enable = true; | 1523 | vi->config_enable = true; |
| 1458 | INIT_WORK(&vi->config_work, virtnet_config_changed_work); | 1524 | INIT_WORK(&vi->config_work, virtnet_config_changed_work); |
| @@ -1476,7 +1542,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1476 | /* Allocate/initialize the rx/tx queues, and invoke find_vqs */ | 1542 | /* Allocate/initialize the rx/tx queues, and invoke find_vqs */ |
| 1477 | err = init_vqs(vi); | 1543 | err = init_vqs(vi); |
| 1478 | if (err) | 1544 | if (err) |
| 1479 | goto free_stats; | 1545 | goto free_index; |
| 1480 | 1546 | ||
| 1481 | netif_set_real_num_tx_queues(dev, 1); | 1547 | netif_set_real_num_tx_queues(dev, 1); |
| 1482 | netif_set_real_num_rx_queues(dev, 1); | 1548 | netif_set_real_num_rx_queues(dev, 1); |
| @@ -1499,6 +1565,13 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1499 | } | 1565 | } |
| 1500 | } | 1566 | } |
| 1501 | 1567 | ||
| 1568 | vi->nb.notifier_call = &virtnet_cpu_callback; | ||
| 1569 | err = register_hotcpu_notifier(&vi->nb); | ||
| 1570 | if (err) { | ||
| 1571 | pr_debug("virtio_net: registering cpu notifier failed\n"); | ||
| 1572 | goto free_recv_bufs; | ||
| 1573 | } | ||
| 1574 | |||
| 1502 | /* Assume link up if device can't report link status, | 1575 | /* Assume link up if device can't report link status, |
| 1503 | otherwise get link status from config. */ | 1576 | otherwise get link status from config. */ |
| 1504 | if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) { | 1577 | if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) { |
| @@ -1520,6 +1593,8 @@ free_recv_bufs: | |||
| 1520 | free_vqs: | 1593 | free_vqs: |
| 1521 | cancel_delayed_work_sync(&vi->refill); | 1594 | cancel_delayed_work_sync(&vi->refill); |
| 1522 | virtnet_del_vqs(vi); | 1595 | virtnet_del_vqs(vi); |
| 1596 | free_index: | ||
| 1597 | free_percpu(vi->vq_index); | ||
| 1523 | free_stats: | 1598 | free_stats: |
| 1524 | free_percpu(vi->stats); | 1599 | free_percpu(vi->stats); |
| 1525 | free: | 1600 | free: |
| @@ -1543,6 +1618,8 @@ static void virtnet_remove(struct virtio_device *vdev) | |||
| 1543 | { | 1618 | { |
| 1544 | struct virtnet_info *vi = vdev->priv; | 1619 | struct virtnet_info *vi = vdev->priv; |
| 1545 | 1620 | ||
| 1621 | unregister_hotcpu_notifier(&vi->nb); | ||
| 1622 | |||
| 1546 | /* Prevent config work handler from accessing the device. */ | 1623 | /* Prevent config work handler from accessing the device. */ |
| 1547 | mutex_lock(&vi->config_lock); | 1624 | mutex_lock(&vi->config_lock); |
| 1548 | vi->config_enable = false; | 1625 | vi->config_enable = false; |
| @@ -1554,6 +1631,7 @@ static void virtnet_remove(struct virtio_device *vdev) | |||
| 1554 | 1631 | ||
| 1555 | flush_work(&vi->config_work); | 1632 | flush_work(&vi->config_work); |
| 1556 | 1633 | ||
| 1634 | free_percpu(vi->vq_index); | ||
| 1557 | free_percpu(vi->stats); | 1635 | free_percpu(vi->stats); |
| 1558 | free_netdev(vi->dev); | 1636 | free_netdev(vi->dev); |
| 1559 | } | 1637 | } |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index dc8913c6238c..12c6440d1649 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
| @@ -154,8 +154,7 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue) | |||
| 154 | if (ret & 1) { /* Link is up. */ | 154 | if (ret & 1) { /* Link is up. */ |
| 155 | printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n", | 155 | printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n", |
| 156 | adapter->netdev->name, adapter->link_speed); | 156 | adapter->netdev->name, adapter->link_speed); |
| 157 | if (!netif_carrier_ok(adapter->netdev)) | 157 | netif_carrier_on(adapter->netdev); |
| 158 | netif_carrier_on(adapter->netdev); | ||
| 159 | 158 | ||
| 160 | if (affectTxQueue) { | 159 | if (affectTxQueue) { |
| 161 | for (i = 0; i < adapter->num_tx_queues; i++) | 160 | for (i = 0; i < adapter->num_tx_queues; i++) |
| @@ -165,8 +164,7 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue) | |||
| 165 | } else { | 164 | } else { |
| 166 | printk(KERN_INFO "%s: NIC Link is Down\n", | 165 | printk(KERN_INFO "%s: NIC Link is Down\n", |
| 167 | adapter->netdev->name); | 166 | adapter->netdev->name); |
| 168 | if (netif_carrier_ok(adapter->netdev)) | 167 | netif_carrier_off(adapter->netdev); |
| 169 | netif_carrier_off(adapter->netdev); | ||
| 170 | 168 | ||
| 171 | if (affectTxQueue) { | 169 | if (affectTxQueue) { |
| 172 | for (i = 0; i < adapter->num_tx_queues; i++) | 170 | for (i = 0; i < adapter->num_tx_queues; i++) |
| @@ -3061,6 +3059,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
| 3061 | netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); | 3059 | netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); |
| 3062 | netif_set_real_num_rx_queues(adapter->netdev, adapter->num_rx_queues); | 3060 | netif_set_real_num_rx_queues(adapter->netdev, adapter->num_rx_queues); |
| 3063 | 3061 | ||
| 3062 | netif_carrier_off(netdev); | ||
| 3064 | err = register_netdev(netdev); | 3063 | err = register_netdev(netdev); |
| 3065 | 3064 | ||
| 3066 | if (err) { | 3065 | if (err) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 8b0d8dcd7625..56317b0fb6b6 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
| @@ -976,6 +976,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
| 976 | AR_PHY_CL_TAB_1, | 976 | AR_PHY_CL_TAB_1, |
| 977 | AR_PHY_CL_TAB_2 }; | 977 | AR_PHY_CL_TAB_2 }; |
| 978 | 978 | ||
| 979 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); | ||
| 980 | |||
| 979 | if (rtt) { | 981 | if (rtt) { |
| 980 | if (!ar9003_hw_rtt_restore(ah, chan)) | 982 | if (!ar9003_hw_rtt_restore(ah, chan)) |
| 981 | run_rtt_cal = true; | 983 | run_rtt_cal = true; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index ce19c09fa8e8..3afc24bde6d6 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
| @@ -586,32 +586,19 @@ static void ar9003_hw_init_bb(struct ath_hw *ah, | |||
| 586 | ath9k_hw_synth_delay(ah, chan, synthDelay); | 586 | ath9k_hw_synth_delay(ah, chan, synthDelay); |
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) | 589 | void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) |
| 590 | { | 590 | { |
| 591 | switch (rx) { | 591 | if (ah->caps.tx_chainmask == 5 || ah->caps.rx_chainmask == 5) |
| 592 | case 0x5: | ||
| 593 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, | 592 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, |
| 594 | AR_PHY_SWAP_ALT_CHAIN); | 593 | AR_PHY_SWAP_ALT_CHAIN); |
| 595 | case 0x3: | 594 | |
| 596 | case 0x1: | 595 | REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx); |
| 597 | case 0x2: | 596 | REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx); |
| 598 | case 0x7: | ||
| 599 | REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx); | ||
| 600 | REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx); | ||
| 601 | break; | ||
| 602 | default: | ||
| 603 | break; | ||
| 604 | } | ||
| 605 | 597 | ||
| 606 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) | 598 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) |
| 607 | REG_WRITE(ah, AR_SELFGEN_MASK, 0x3); | 599 | tx = 3; |
| 608 | else | ||
| 609 | REG_WRITE(ah, AR_SELFGEN_MASK, tx); | ||
| 610 | 600 | ||
| 611 | if (tx == 0x5) { | 601 | REG_WRITE(ah, AR_SELFGEN_MASK, tx); |
| 612 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, | ||
| 613 | AR_PHY_SWAP_ALT_CHAIN); | ||
| 614 | } | ||
| 615 | } | 602 | } |
| 616 | 603 | ||
| 617 | /* | 604 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 86e26a19efda..42794c546a40 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
| @@ -317,7 +317,6 @@ struct ath_rx { | |||
| 317 | u32 *rxlink; | 317 | u32 *rxlink; |
| 318 | u32 num_pkts; | 318 | u32 num_pkts; |
| 319 | unsigned int rxfilter; | 319 | unsigned int rxfilter; |
| 320 | spinlock_t rxbuflock; | ||
| 321 | struct list_head rxbuf; | 320 | struct list_head rxbuf; |
| 322 | struct ath_descdma rxdma; | 321 | struct ath_descdma rxdma; |
| 323 | struct ath_buf *rx_bufptr; | 322 | struct ath_buf *rx_bufptr; |
| @@ -328,7 +327,6 @@ struct ath_rx { | |||
| 328 | 327 | ||
| 329 | int ath_startrecv(struct ath_softc *sc); | 328 | int ath_startrecv(struct ath_softc *sc); |
| 330 | bool ath_stoprecv(struct ath_softc *sc); | 329 | bool ath_stoprecv(struct ath_softc *sc); |
| 331 | void ath_flushrecv(struct ath_softc *sc); | ||
| 332 | u32 ath_calcrxfilter(struct ath_softc *sc); | 330 | u32 ath_calcrxfilter(struct ath_softc *sc); |
| 333 | int ath_rx_init(struct ath_softc *sc, int nbufs); | 331 | int ath_rx_init(struct ath_softc *sc, int nbufs); |
| 334 | void ath_rx_cleanup(struct ath_softc *sc); | 332 | void ath_rx_cleanup(struct ath_softc *sc); |
| @@ -646,7 +644,6 @@ void ath_ant_comb_update(struct ath_softc *sc); | |||
| 646 | enum sc_op_flags { | 644 | enum sc_op_flags { |
| 647 | SC_OP_INVALID, | 645 | SC_OP_INVALID, |
| 648 | SC_OP_BEACONS, | 646 | SC_OP_BEACONS, |
| 649 | SC_OP_RXFLUSH, | ||
| 650 | SC_OP_ANI_RUN, | 647 | SC_OP_ANI_RUN, |
| 651 | SC_OP_PRIM_STA_VIF, | 648 | SC_OP_PRIM_STA_VIF, |
| 652 | SC_OP_HW_RESET, | 649 | SC_OP_HW_RESET, |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index 531fffd801a3..2ca355e94da6 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
| @@ -147,6 +147,7 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, | |||
| 147 | skb->len, DMA_TO_DEVICE); | 147 | skb->len, DMA_TO_DEVICE); |
| 148 | dev_kfree_skb_any(skb); | 148 | dev_kfree_skb_any(skb); |
| 149 | bf->bf_buf_addr = 0; | 149 | bf->bf_buf_addr = 0; |
| 150 | bf->bf_mpdu = NULL; | ||
| 150 | } | 151 | } |
| 151 | 152 | ||
| 152 | skb = ieee80211_beacon_get(hw, vif); | 153 | skb = ieee80211_beacon_get(hw, vif); |
| @@ -359,7 +360,6 @@ void ath9k_beacon_tasklet(unsigned long data) | |||
| 359 | return; | 360 | return; |
| 360 | 361 | ||
| 361 | bf = ath9k_beacon_generate(sc->hw, vif); | 362 | bf = ath9k_beacon_generate(sc->hw, vif); |
| 362 | WARN_ON(!bf); | ||
| 363 | 363 | ||
| 364 | if (sc->beacon.bmisscnt != 0) { | 364 | if (sc->beacon.bmisscnt != 0) { |
| 365 | ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n", | 365 | ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n", |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 13ff9edc2401..e585fc827c50 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
| @@ -861,7 +861,6 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
| 861 | RXS_ERR("RX-LENGTH-ERR", rx_len_err); | 861 | RXS_ERR("RX-LENGTH-ERR", rx_len_err); |
| 862 | RXS_ERR("RX-OOM-ERR", rx_oom_err); | 862 | RXS_ERR("RX-OOM-ERR", rx_oom_err); |
| 863 | RXS_ERR("RX-RATE-ERR", rx_rate_err); | 863 | RXS_ERR("RX-RATE-ERR", rx_rate_err); |
| 864 | RXS_ERR("RX-DROP-RXFLUSH", rx_drop_rxflush); | ||
| 865 | RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err); | 864 | RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err); |
| 866 | 865 | ||
| 867 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); | 866 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 375c3b46411e..6df2ab62dcb7 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
| @@ -216,7 +216,6 @@ struct ath_tx_stats { | |||
| 216 | * @rx_oom_err: No. of frames dropped due to OOM issues. | 216 | * @rx_oom_err: No. of frames dropped due to OOM issues. |
| 217 | * @rx_rate_err: No. of frames dropped due to rate errors. | 217 | * @rx_rate_err: No. of frames dropped due to rate errors. |
| 218 | * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. | 218 | * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. |
| 219 | * @rx_drop_rxflush: No. of frames dropped due to RX-FLUSH. | ||
| 220 | * @rx_beacons: No. of beacons received. | 219 | * @rx_beacons: No. of beacons received. |
| 221 | * @rx_frags: No. of rx-fragements received. | 220 | * @rx_frags: No. of rx-fragements received. |
| 222 | */ | 221 | */ |
| @@ -235,7 +234,6 @@ struct ath_rx_stats { | |||
| 235 | u32 rx_oom_err; | 234 | u32 rx_oom_err; |
| 236 | u32 rx_rate_err; | 235 | u32 rx_rate_err; |
| 237 | u32 rx_too_many_frags_err; | 236 | u32 rx_too_many_frags_err; |
| 238 | u32 rx_drop_rxflush; | ||
| 239 | u32 rx_beacons; | 237 | u32 rx_beacons; |
| 240 | u32 rx_frags; | 238 | u32 rx_frags; |
| 241 | }; | 239 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 4a9570dfba72..aac4a406a513 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c | |||
| @@ -344,6 +344,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, | |||
| 344 | endpoint->ep_callbacks.tx(endpoint->ep_callbacks.priv, | 344 | endpoint->ep_callbacks.tx(endpoint->ep_callbacks.priv, |
| 345 | skb, htc_hdr->endpoint_id, | 345 | skb, htc_hdr->endpoint_id, |
| 346 | txok); | 346 | txok); |
| 347 | } else { | ||
| 348 | kfree_skb(skb); | ||
| 347 | } | 349 | } |
| 348 | } | 350 | } |
| 349 | 351 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 7f1a8e91c908..9d26fc56ca56 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
| @@ -1066,6 +1066,7 @@ void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); | |||
| 1066 | int ar9003_paprd_init_table(struct ath_hw *ah); | 1066 | int ar9003_paprd_init_table(struct ath_hw *ah); |
| 1067 | bool ar9003_paprd_is_done(struct ath_hw *ah); | 1067 | bool ar9003_paprd_is_done(struct ath_hw *ah); |
| 1068 | bool ar9003_is_paprd_enabled(struct ath_hw *ah); | 1068 | bool ar9003_is_paprd_enabled(struct ath_hw *ah); |
| 1069 | void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx); | ||
| 1069 | 1070 | ||
| 1070 | /* Hardware family op attach helpers */ | 1071 | /* Hardware family op attach helpers */ |
| 1071 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah); | 1072 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index be30a9af1528..dd91f8fdc01c 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -182,7 +182,7 @@ static void ath_restart_work(struct ath_softc *sc) | |||
| 182 | ath_start_ani(sc); | 182 | ath_start_ani(sc); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush) | 185 | static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx) |
| 186 | { | 186 | { |
| 187 | struct ath_hw *ah = sc->sc_ah; | 187 | struct ath_hw *ah = sc->sc_ah; |
| 188 | bool ret = true; | 188 | bool ret = true; |
| @@ -202,14 +202,6 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush) | |||
| 202 | if (!ath_drain_all_txq(sc, retry_tx)) | 202 | if (!ath_drain_all_txq(sc, retry_tx)) |
| 203 | ret = false; | 203 | ret = false; |
| 204 | 204 | ||
| 205 | if (!flush) { | ||
| 206 | if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | ||
| 207 | ath_rx_tasklet(sc, 1, true); | ||
| 208 | ath_rx_tasklet(sc, 1, false); | ||
| 209 | } else { | ||
| 210 | ath_flushrecv(sc); | ||
| 211 | } | ||
| 212 | |||
| 213 | return ret; | 205 | return ret; |
| 214 | } | 206 | } |
| 215 | 207 | ||
| @@ -262,11 +254,11 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, | |||
| 262 | struct ath_common *common = ath9k_hw_common(ah); | 254 | struct ath_common *common = ath9k_hw_common(ah); |
| 263 | struct ath9k_hw_cal_data *caldata = NULL; | 255 | struct ath9k_hw_cal_data *caldata = NULL; |
| 264 | bool fastcc = true; | 256 | bool fastcc = true; |
| 265 | bool flush = false; | ||
| 266 | int r; | 257 | int r; |
| 267 | 258 | ||
| 268 | __ath_cancel_work(sc); | 259 | __ath_cancel_work(sc); |
| 269 | 260 | ||
| 261 | tasklet_disable(&sc->intr_tq); | ||
| 270 | spin_lock_bh(&sc->sc_pcu_lock); | 262 | spin_lock_bh(&sc->sc_pcu_lock); |
| 271 | 263 | ||
| 272 | if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { | 264 | if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { |
| @@ -276,11 +268,10 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, | |||
| 276 | 268 | ||
| 277 | if (!hchan) { | 269 | if (!hchan) { |
| 278 | fastcc = false; | 270 | fastcc = false; |
| 279 | flush = true; | ||
| 280 | hchan = ah->curchan; | 271 | hchan = ah->curchan; |
| 281 | } | 272 | } |
| 282 | 273 | ||
| 283 | if (!ath_prepare_reset(sc, retry_tx, flush)) | 274 | if (!ath_prepare_reset(sc, retry_tx)) |
| 284 | fastcc = false; | 275 | fastcc = false; |
| 285 | 276 | ||
| 286 | ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", | 277 | ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", |
| @@ -302,6 +293,8 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, | |||
| 302 | 293 | ||
| 303 | out: | 294 | out: |
| 304 | spin_unlock_bh(&sc->sc_pcu_lock); | 295 | spin_unlock_bh(&sc->sc_pcu_lock); |
| 296 | tasklet_enable(&sc->intr_tq); | ||
| 297 | |||
| 305 | return r; | 298 | return r; |
| 306 | } | 299 | } |
| 307 | 300 | ||
| @@ -804,7 +797,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
| 804 | ath9k_hw_cfg_gpio_input(ah, ah->led_pin); | 797 | ath9k_hw_cfg_gpio_input(ah, ah->led_pin); |
| 805 | } | 798 | } |
| 806 | 799 | ||
| 807 | ath_prepare_reset(sc, false, true); | 800 | ath_prepare_reset(sc, false); |
| 808 | 801 | ||
| 809 | if (sc->rx.frag) { | 802 | if (sc->rx.frag) { |
| 810 | dev_kfree_skb_any(sc->rx.frag); | 803 | dev_kfree_skb_any(sc->rx.frag); |
| @@ -1833,6 +1826,9 @@ static u32 fill_chainmask(u32 cap, u32 new) | |||
| 1833 | 1826 | ||
| 1834 | static bool validate_antenna_mask(struct ath_hw *ah, u32 val) | 1827 | static bool validate_antenna_mask(struct ath_hw *ah, u32 val) |
| 1835 | { | 1828 | { |
| 1829 | if (AR_SREV_9300_20_OR_LATER(ah)) | ||
| 1830 | return true; | ||
| 1831 | |||
| 1836 | switch (val & 0x7) { | 1832 | switch (val & 0x7) { |
| 1837 | case 0x1: | 1833 | case 0x1: |
| 1838 | case 0x3: | 1834 | case 0x3: |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index d4df98a938bf..90752f246970 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
| @@ -254,8 +254,6 @@ rx_init_fail: | |||
| 254 | 254 | ||
| 255 | static void ath_edma_start_recv(struct ath_softc *sc) | 255 | static void ath_edma_start_recv(struct ath_softc *sc) |
| 256 | { | 256 | { |
| 257 | spin_lock_bh(&sc->rx.rxbuflock); | ||
| 258 | |||
| 259 | ath9k_hw_rxena(sc->sc_ah); | 257 | ath9k_hw_rxena(sc->sc_ah); |
| 260 | 258 | ||
| 261 | ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP, | 259 | ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP, |
| @@ -267,8 +265,6 @@ static void ath_edma_start_recv(struct ath_softc *sc) | |||
| 267 | ath_opmode_init(sc); | 265 | ath_opmode_init(sc); |
| 268 | 266 | ||
| 269 | ath9k_hw_startpcureceive(sc->sc_ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); | 267 | ath9k_hw_startpcureceive(sc->sc_ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); |
| 270 | |||
| 271 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
| 272 | } | 268 | } |
| 273 | 269 | ||
| 274 | static void ath_edma_stop_recv(struct ath_softc *sc) | 270 | static void ath_edma_stop_recv(struct ath_softc *sc) |
| @@ -285,8 +281,6 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
| 285 | int error = 0; | 281 | int error = 0; |
| 286 | 282 | ||
| 287 | spin_lock_init(&sc->sc_pcu_lock); | 283 | spin_lock_init(&sc->sc_pcu_lock); |
| 288 | spin_lock_init(&sc->rx.rxbuflock); | ||
| 289 | clear_bit(SC_OP_RXFLUSH, &sc->sc_flags); | ||
| 290 | 284 | ||
| 291 | common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 + | 285 | common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 + |
| 292 | sc->sc_ah->caps.rx_status_len; | 286 | sc->sc_ah->caps.rx_status_len; |
| @@ -447,7 +441,6 @@ int ath_startrecv(struct ath_softc *sc) | |||
| 447 | return 0; | 441 | return 0; |
| 448 | } | 442 | } |
| 449 | 443 | ||
| 450 | spin_lock_bh(&sc->rx.rxbuflock); | ||
| 451 | if (list_empty(&sc->rx.rxbuf)) | 444 | if (list_empty(&sc->rx.rxbuf)) |
| 452 | goto start_recv; | 445 | goto start_recv; |
| 453 | 446 | ||
| @@ -468,26 +461,31 @@ start_recv: | |||
| 468 | ath_opmode_init(sc); | 461 | ath_opmode_init(sc); |
| 469 | ath9k_hw_startpcureceive(ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); | 462 | ath9k_hw_startpcureceive(ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); |
| 470 | 463 | ||
| 471 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
| 472 | |||
| 473 | return 0; | 464 | return 0; |
| 474 | } | 465 | } |
| 475 | 466 | ||
| 467 | static void ath_flushrecv(struct ath_softc *sc) | ||
| 468 | { | ||
| 469 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | ||
| 470 | ath_rx_tasklet(sc, 1, true); | ||
| 471 | ath_rx_tasklet(sc, 1, false); | ||
| 472 | } | ||
| 473 | |||
| 476 | bool ath_stoprecv(struct ath_softc *sc) | 474 | bool ath_stoprecv(struct ath_softc *sc) |
| 477 | { | 475 | { |
| 478 | struct ath_hw *ah = sc->sc_ah; | 476 | struct ath_hw *ah = sc->sc_ah; |
| 479 | bool stopped, reset = false; | 477 | bool stopped, reset = false; |
| 480 | 478 | ||
| 481 | spin_lock_bh(&sc->rx.rxbuflock); | ||
| 482 | ath9k_hw_abortpcurecv(ah); | 479 | ath9k_hw_abortpcurecv(ah); |
| 483 | ath9k_hw_setrxfilter(ah, 0); | 480 | ath9k_hw_setrxfilter(ah, 0); |
| 484 | stopped = ath9k_hw_stopdmarecv(ah, &reset); | 481 | stopped = ath9k_hw_stopdmarecv(ah, &reset); |
| 485 | 482 | ||
| 483 | ath_flushrecv(sc); | ||
| 484 | |||
| 486 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | 485 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) |
| 487 | ath_edma_stop_recv(sc); | 486 | ath_edma_stop_recv(sc); |
| 488 | else | 487 | else |
| 489 | sc->rx.rxlink = NULL; | 488 | sc->rx.rxlink = NULL; |
| 490 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
| 491 | 489 | ||
| 492 | if (!(ah->ah_flags & AH_UNPLUGGED) && | 490 | if (!(ah->ah_flags & AH_UNPLUGGED) && |
| 493 | unlikely(!stopped)) { | 491 | unlikely(!stopped)) { |
| @@ -499,15 +497,6 @@ bool ath_stoprecv(struct ath_softc *sc) | |||
| 499 | return stopped && !reset; | 497 | return stopped && !reset; |
| 500 | } | 498 | } |
| 501 | 499 | ||
| 502 | void ath_flushrecv(struct ath_softc *sc) | ||
| 503 | { | ||
| 504 | set_bit(SC_OP_RXFLUSH, &sc->sc_flags); | ||
| 505 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | ||
| 506 | ath_rx_tasklet(sc, 1, true); | ||
| 507 | ath_rx_tasklet(sc, 1, false); | ||
| 508 | clear_bit(SC_OP_RXFLUSH, &sc->sc_flags); | ||
| 509 | } | ||
| 510 | |||
| 511 | static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) | 500 | static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) |
| 512 | { | 501 | { |
| 513 | /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */ | 502 | /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */ |
| @@ -744,6 +733,7 @@ static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc, | |||
| 744 | return NULL; | 733 | return NULL; |
| 745 | } | 734 | } |
| 746 | 735 | ||
| 736 | list_del(&bf->list); | ||
| 747 | if (!bf->bf_mpdu) | 737 | if (!bf->bf_mpdu) |
| 748 | return bf; | 738 | return bf; |
| 749 | 739 | ||
| @@ -1059,16 +1049,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
| 1059 | dma_type = DMA_FROM_DEVICE; | 1049 | dma_type = DMA_FROM_DEVICE; |
| 1060 | 1050 | ||
| 1061 | qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; | 1051 | qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; |
| 1062 | spin_lock_bh(&sc->rx.rxbuflock); | ||
| 1063 | 1052 | ||
| 1064 | tsf = ath9k_hw_gettsf64(ah); | 1053 | tsf = ath9k_hw_gettsf64(ah); |
| 1065 | tsf_lower = tsf & 0xffffffff; | 1054 | tsf_lower = tsf & 0xffffffff; |
| 1066 | 1055 | ||
| 1067 | do { | 1056 | do { |
| 1068 | bool decrypt_error = false; | 1057 | bool decrypt_error = false; |
| 1069 | /* If handling rx interrupt and flush is in progress => exit */ | ||
| 1070 | if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0)) | ||
| 1071 | break; | ||
| 1072 | 1058 | ||
| 1073 | memset(&rs, 0, sizeof(rs)); | 1059 | memset(&rs, 0, sizeof(rs)); |
| 1074 | if (edma) | 1060 | if (edma) |
| @@ -1111,15 +1097,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
| 1111 | 1097 | ||
| 1112 | ath_debug_stat_rx(sc, &rs); | 1098 | ath_debug_stat_rx(sc, &rs); |
| 1113 | 1099 | ||
| 1114 | /* | ||
| 1115 | * If we're asked to flush receive queue, directly | ||
| 1116 | * chain it back at the queue without processing it. | ||
| 1117 | */ | ||
| 1118 | if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags)) { | ||
| 1119 | RX_STAT_INC(rx_drop_rxflush); | ||
| 1120 | goto requeue_drop_frag; | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | memset(rxs, 0, sizeof(struct ieee80211_rx_status)); | 1100 | memset(rxs, 0, sizeof(struct ieee80211_rx_status)); |
| 1124 | 1101 | ||
| 1125 | rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; | 1102 | rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; |
| @@ -1254,19 +1231,18 @@ requeue_drop_frag: | |||
| 1254 | sc->rx.frag = NULL; | 1231 | sc->rx.frag = NULL; |
| 1255 | } | 1232 | } |
| 1256 | requeue: | 1233 | requeue: |
| 1234 | list_add_tail(&bf->list, &sc->rx.rxbuf); | ||
| 1235 | if (flush) | ||
| 1236 | continue; | ||
| 1237 | |||
| 1257 | if (edma) { | 1238 | if (edma) { |
| 1258 | list_add_tail(&bf->list, &sc->rx.rxbuf); | ||
| 1259 | ath_rx_edma_buf_link(sc, qtype); | 1239 | ath_rx_edma_buf_link(sc, qtype); |
| 1260 | } else { | 1240 | } else { |
| 1261 | list_move_tail(&bf->list, &sc->rx.rxbuf); | ||
| 1262 | ath_rx_buf_link(sc, bf); | 1241 | ath_rx_buf_link(sc, bf); |
| 1263 | if (!flush) | 1242 | ath9k_hw_rxena(ah); |
| 1264 | ath9k_hw_rxena(ah); | ||
| 1265 | } | 1243 | } |
| 1266 | } while (1); | 1244 | } while (1); |
| 1267 | 1245 | ||
| 1268 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
| 1269 | |||
| 1270 | if (!(ah->imask & ATH9K_INT_RXEOL)) { | 1246 | if (!(ah->imask & ATH9K_INT_RXEOL)) { |
| 1271 | ah->imask |= (ATH9K_INT_RXEOL | ATH9K_INT_RXORN); | 1247 | ah->imask |= (ATH9K_INT_RXEOL | ATH9K_INT_RXORN); |
| 1272 | ath9k_hw_set_interrupts(ah); | 1248 | ath9k_hw_set_interrupts(ah); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 1fbd8ecbe2ea..e5fd20994bec 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include "debug.h" | 36 | #include "debug.h" |
| 37 | 37 | ||
| 38 | #define N_TX_QUEUES 4 /* #tx queues on mac80211<->driver interface */ | 38 | #define N_TX_QUEUES 4 /* #tx queues on mac80211<->driver interface */ |
| 39 | #define BRCMS_FLUSH_TIMEOUT 500 /* msec */ | ||
| 39 | 40 | ||
| 40 | /* Flags we support */ | 41 | /* Flags we support */ |
| 41 | #define MAC_FILTERS (FIF_PROMISC_IN_BSS | \ | 42 | #define MAC_FILTERS (FIF_PROMISC_IN_BSS | \ |
| @@ -708,16 +709,29 @@ static void brcms_ops_rfkill_poll(struct ieee80211_hw *hw) | |||
| 708 | wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, blocked); | 709 | wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, blocked); |
| 709 | } | 710 | } |
| 710 | 711 | ||
| 712 | static bool brcms_tx_flush_completed(struct brcms_info *wl) | ||
| 713 | { | ||
| 714 | bool result; | ||
| 715 | |||
| 716 | spin_lock_bh(&wl->lock); | ||
| 717 | result = brcms_c_tx_flush_completed(wl->wlc); | ||
| 718 | spin_unlock_bh(&wl->lock); | ||
| 719 | return result; | ||
| 720 | } | ||
| 721 | |||
| 711 | static void brcms_ops_flush(struct ieee80211_hw *hw, bool drop) | 722 | static void brcms_ops_flush(struct ieee80211_hw *hw, bool drop) |
| 712 | { | 723 | { |
| 713 | struct brcms_info *wl = hw->priv; | 724 | struct brcms_info *wl = hw->priv; |
| 725 | int ret; | ||
| 714 | 726 | ||
| 715 | no_printk("%s: drop = %s\n", __func__, drop ? "true" : "false"); | 727 | no_printk("%s: drop = %s\n", __func__, drop ? "true" : "false"); |
| 716 | 728 | ||
| 717 | /* wait for packet queue and dma fifos to run empty */ | 729 | ret = wait_event_timeout(wl->tx_flush_wq, |
| 718 | spin_lock_bh(&wl->lock); | 730 | brcms_tx_flush_completed(wl), |
| 719 | brcms_c_wait_for_tx_completion(wl->wlc, drop); | 731 | msecs_to_jiffies(BRCMS_FLUSH_TIMEOUT)); |
| 720 | spin_unlock_bh(&wl->lock); | 732 | |
| 733 | brcms_dbg_mac80211(wl->wlc->hw->d11core, | ||
| 734 | "ret=%d\n", jiffies_to_msecs(ret)); | ||
| 721 | } | 735 | } |
| 722 | 736 | ||
| 723 | static const struct ieee80211_ops brcms_ops = { | 737 | static const struct ieee80211_ops brcms_ops = { |
| @@ -772,6 +786,7 @@ void brcms_dpc(unsigned long data) | |||
| 772 | 786 | ||
| 773 | done: | 787 | done: |
| 774 | spin_unlock_bh(&wl->lock); | 788 | spin_unlock_bh(&wl->lock); |
| 789 | wake_up(&wl->tx_flush_wq); | ||
| 775 | } | 790 | } |
| 776 | 791 | ||
| 777 | /* | 792 | /* |
| @@ -1020,6 +1035,8 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev) | |||
| 1020 | 1035 | ||
| 1021 | atomic_set(&wl->callbacks, 0); | 1036 | atomic_set(&wl->callbacks, 0); |
| 1022 | 1037 | ||
| 1038 | init_waitqueue_head(&wl->tx_flush_wq); | ||
| 1039 | |||
| 1023 | /* setup the bottom half handler */ | 1040 | /* setup the bottom half handler */ |
| 1024 | tasklet_init(&wl->tasklet, brcms_dpc, (unsigned long) wl); | 1041 | tasklet_init(&wl->tasklet, brcms_dpc, (unsigned long) wl); |
| 1025 | 1042 | ||
| @@ -1407,9 +1424,10 @@ void brcms_add_timer(struct brcms_timer *t, uint ms, int periodic) | |||
| 1407 | #endif | 1424 | #endif |
| 1408 | t->ms = ms; | 1425 | t->ms = ms; |
| 1409 | t->periodic = (bool) periodic; | 1426 | t->periodic = (bool) periodic; |
| 1410 | t->set = true; | 1427 | if (!t->set) { |
| 1411 | 1428 | t->set = true; | |
| 1412 | atomic_inc(&t->wl->callbacks); | 1429 | atomic_inc(&t->wl->callbacks); |
| 1430 | } | ||
| 1413 | 1431 | ||
| 1414 | ieee80211_queue_delayed_work(hw, &t->dly_wrk, msecs_to_jiffies(ms)); | 1432 | ieee80211_queue_delayed_work(hw, &t->dly_wrk, msecs_to_jiffies(ms)); |
| 1415 | } | 1433 | } |
| @@ -1608,13 +1626,3 @@ bool brcms_rfkill_set_hw_state(struct brcms_info *wl) | |||
| 1608 | spin_lock_bh(&wl->lock); | 1626 | spin_lock_bh(&wl->lock); |
| 1609 | return blocked; | 1627 | return blocked; |
| 1610 | } | 1628 | } |
| 1611 | |||
| 1612 | /* | ||
| 1613 | * precondition: perimeter lock has been acquired | ||
| 1614 | */ | ||
| 1615 | void brcms_msleep(struct brcms_info *wl, uint ms) | ||
| 1616 | { | ||
| 1617 | spin_unlock_bh(&wl->lock); | ||
| 1618 | msleep(ms); | ||
| 1619 | spin_lock_bh(&wl->lock); | ||
| 1620 | } | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h index 9358bd5ebd35..947ccacf43e6 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h | |||
| @@ -68,6 +68,8 @@ struct brcms_info { | |||
| 68 | spinlock_t lock; /* per-device perimeter lock */ | 68 | spinlock_t lock; /* per-device perimeter lock */ |
| 69 | spinlock_t isr_lock; /* per-device ISR synchronization lock */ | 69 | spinlock_t isr_lock; /* per-device ISR synchronization lock */ |
| 70 | 70 | ||
| 71 | /* tx flush */ | ||
| 72 | wait_queue_head_t tx_flush_wq; | ||
| 71 | 73 | ||
| 72 | /* timer related fields */ | 74 | /* timer related fields */ |
| 73 | atomic_t callbacks; /* # outstanding callback functions */ | 75 | atomic_t callbacks; /* # outstanding callback functions */ |
| @@ -100,7 +102,6 @@ extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl, | |||
| 100 | extern void brcms_free_timer(struct brcms_timer *timer); | 102 | extern void brcms_free_timer(struct brcms_timer *timer); |
| 101 | extern void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic); | 103 | extern void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic); |
| 102 | extern bool brcms_del_timer(struct brcms_timer *timer); | 104 | extern bool brcms_del_timer(struct brcms_timer *timer); |
| 103 | extern void brcms_msleep(struct brcms_info *wl, uint ms); | ||
| 104 | extern void brcms_dpc(unsigned long data); | 105 | extern void brcms_dpc(unsigned long data); |
| 105 | extern void brcms_timer(struct brcms_timer *t); | 106 | extern void brcms_timer(struct brcms_timer *t); |
| 106 | extern void brcms_fatal_error(struct brcms_info *wl); | 107 | extern void brcms_fatal_error(struct brcms_info *wl); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 17594de4199e..8b5839008af3 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
| @@ -1027,7 +1027,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
| 1027 | static bool | 1027 | static bool |
| 1028 | brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | 1028 | brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) |
| 1029 | { | 1029 | { |
| 1030 | bool morepending = false; | ||
| 1031 | struct bcma_device *core; | 1030 | struct bcma_device *core; |
| 1032 | struct tx_status txstatus, *txs; | 1031 | struct tx_status txstatus, *txs; |
| 1033 | u32 s1, s2; | 1032 | u32 s1, s2; |
| @@ -1041,23 +1040,20 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | |||
| 1041 | txs = &txstatus; | 1040 | txs = &txstatus; |
| 1042 | core = wlc_hw->d11core; | 1041 | core = wlc_hw->d11core; |
| 1043 | *fatal = false; | 1042 | *fatal = false; |
| 1044 | s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); | ||
| 1045 | while (!(*fatal) | ||
| 1046 | && (s1 & TXS_V)) { | ||
| 1047 | /* !give others some time to run! */ | ||
| 1048 | if (n >= max_tx_num) { | ||
| 1049 | morepending = true; | ||
| 1050 | break; | ||
| 1051 | } | ||
| 1052 | 1043 | ||
| 1044 | while (n < max_tx_num) { | ||
| 1045 | s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); | ||
| 1053 | if (s1 == 0xffffffff) { | 1046 | if (s1 == 0xffffffff) { |
| 1054 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, | 1047 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, |
| 1055 | __func__); | 1048 | __func__); |
| 1056 | *fatal = true; | 1049 | *fatal = true; |
| 1057 | return false; | 1050 | return false; |
| 1058 | } | 1051 | } |
| 1059 | s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); | 1052 | /* only process when valid */ |
| 1053 | if (!(s1 & TXS_V)) | ||
| 1054 | break; | ||
| 1060 | 1055 | ||
| 1056 | s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); | ||
| 1061 | txs->status = s1 & TXS_STATUS_MASK; | 1057 | txs->status = s1 & TXS_STATUS_MASK; |
| 1062 | txs->frameid = (s1 & TXS_FID_MASK) >> TXS_FID_SHIFT; | 1058 | txs->frameid = (s1 & TXS_FID_MASK) >> TXS_FID_SHIFT; |
| 1063 | txs->sequence = s2 & TXS_SEQ_MASK; | 1059 | txs->sequence = s2 & TXS_SEQ_MASK; |
| @@ -1065,15 +1061,12 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | |||
| 1065 | txs->lasttxtime = 0; | 1061 | txs->lasttxtime = 0; |
| 1066 | 1062 | ||
| 1067 | *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); | 1063 | *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); |
| 1068 | 1064 | if (*fatal == true) | |
| 1069 | s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); | 1065 | return false; |
| 1070 | n++; | 1066 | n++; |
| 1071 | } | 1067 | } |
| 1072 | 1068 | ||
| 1073 | if (*fatal) | 1069 | return n >= max_tx_num; |
| 1074 | return false; | ||
| 1075 | |||
| 1076 | return morepending; | ||
| 1077 | } | 1070 | } |
| 1078 | 1071 | ||
| 1079 | static void brcms_c_tbtt(struct brcms_c_info *wlc) | 1072 | static void brcms_c_tbtt(struct brcms_c_info *wlc) |
| @@ -7518,25 +7511,16 @@ int brcms_c_get_curband(struct brcms_c_info *wlc) | |||
| 7518 | return wlc->band->bandunit; | 7511 | return wlc->band->bandunit; |
| 7519 | } | 7512 | } |
| 7520 | 7513 | ||
| 7521 | void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop) | 7514 | bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc) |
| 7522 | { | 7515 | { |
| 7523 | int timeout = 20; | ||
| 7524 | int i; | 7516 | int i; |
| 7525 | 7517 | ||
| 7526 | /* Kick DMA to send any pending AMPDU */ | 7518 | /* Kick DMA to send any pending AMPDU */ |
| 7527 | for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) | 7519 | for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) |
| 7528 | if (wlc->hw->di[i]) | 7520 | if (wlc->hw->di[i]) |
| 7529 | dma_txflush(wlc->hw->di[i]); | 7521 | dma_kick_tx(wlc->hw->di[i]); |
| 7530 | |||
| 7531 | /* wait for queue and DMA fifos to run dry */ | ||
| 7532 | while (brcms_txpktpendtot(wlc) > 0) { | ||
| 7533 | brcms_msleep(wlc->wl, 1); | ||
| 7534 | |||
| 7535 | if (--timeout == 0) | ||
| 7536 | break; | ||
| 7537 | } | ||
| 7538 | 7522 | ||
| 7539 | WARN_ON_ONCE(timeout == 0); | 7523 | return !brcms_txpktpendtot(wlc); |
| 7540 | } | 7524 | } |
| 7541 | 7525 | ||
| 7542 | void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval) | 7526 | void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval) |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h index 4fb2834f4e64..b0f14b7b8616 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h | |||
| @@ -314,8 +314,6 @@ extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state); | |||
| 314 | extern void brcms_c_scan_start(struct brcms_c_info *wlc); | 314 | extern void brcms_c_scan_start(struct brcms_c_info *wlc); |
| 315 | extern void brcms_c_scan_stop(struct brcms_c_info *wlc); | 315 | extern void brcms_c_scan_stop(struct brcms_c_info *wlc); |
| 316 | extern int brcms_c_get_curband(struct brcms_c_info *wlc); | 316 | extern int brcms_c_get_curband(struct brcms_c_info *wlc); |
| 317 | extern void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, | ||
| 318 | bool drop); | ||
| 319 | extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel); | 317 | extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel); |
| 320 | extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl); | 318 | extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl); |
| 321 | extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc, | 319 | extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc, |
| @@ -332,5 +330,6 @@ extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr); | |||
| 332 | extern int brcms_c_get_tx_power(struct brcms_c_info *wlc); | 330 | extern int brcms_c_get_tx_power(struct brcms_c_info *wlc); |
| 333 | extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); | 331 | extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); |
| 334 | extern void brcms_c_mute(struct brcms_c_info *wlc, bool on); | 332 | extern void brcms_c_mute(struct brcms_c_info *wlc, bool on); |
| 333 | extern bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc); | ||
| 335 | 334 | ||
| 336 | #endif /* _BRCM_PUB_H_ */ | 335 | #endif /* _BRCM_PUB_H_ */ |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 7e16d10a7f14..90b8970eadf0 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
| @@ -3958,17 +3958,21 @@ il_connection_init_rx_config(struct il_priv *il) | |||
| 3958 | 3958 | ||
| 3959 | memset(&il->staging, 0, sizeof(il->staging)); | 3959 | memset(&il->staging, 0, sizeof(il->staging)); |
| 3960 | 3960 | ||
| 3961 | if (!il->vif) { | 3961 | switch (il->iw_mode) { |
| 3962 | case NL80211_IFTYPE_UNSPECIFIED: | ||
| 3962 | il->staging.dev_type = RXON_DEV_TYPE_ESS; | 3963 | il->staging.dev_type = RXON_DEV_TYPE_ESS; |
| 3963 | } else if (il->vif->type == NL80211_IFTYPE_STATION) { | 3964 | break; |
| 3965 | case NL80211_IFTYPE_STATION: | ||
| 3964 | il->staging.dev_type = RXON_DEV_TYPE_ESS; | 3966 | il->staging.dev_type = RXON_DEV_TYPE_ESS; |
| 3965 | il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; | 3967 | il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; |
| 3966 | } else if (il->vif->type == NL80211_IFTYPE_ADHOC) { | 3968 | break; |
| 3969 | case NL80211_IFTYPE_ADHOC: | ||
| 3967 | il->staging.dev_type = RXON_DEV_TYPE_IBSS; | 3970 | il->staging.dev_type = RXON_DEV_TYPE_IBSS; |
| 3968 | il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; | 3971 | il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; |
| 3969 | il->staging.filter_flags = | 3972 | il->staging.filter_flags = |
| 3970 | RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 3973 | RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
| 3971 | } else { | 3974 | break; |
| 3975 | default: | ||
| 3972 | IL_ERR("Unsupported interface type %d\n", il->vif->type); | 3976 | IL_ERR("Unsupported interface type %d\n", il->vif->type); |
| 3973 | return; | 3977 | return; |
| 3974 | } | 3978 | } |
| @@ -4550,8 +4554,7 @@ out: | |||
| 4550 | EXPORT_SYMBOL(il_mac_add_interface); | 4554 | EXPORT_SYMBOL(il_mac_add_interface); |
| 4551 | 4555 | ||
| 4552 | static void | 4556 | static void |
| 4553 | il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, | 4557 | il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif) |
| 4554 | bool mode_change) | ||
| 4555 | { | 4558 | { |
| 4556 | lockdep_assert_held(&il->mutex); | 4559 | lockdep_assert_held(&il->mutex); |
| 4557 | 4560 | ||
| @@ -4560,9 +4563,7 @@ il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, | |||
| 4560 | il_force_scan_end(il); | 4563 | il_force_scan_end(il); |
| 4561 | } | 4564 | } |
| 4562 | 4565 | ||
| 4563 | if (!mode_change) | 4566 | il_set_mode(il); |
| 4564 | il_set_mode(il); | ||
| 4565 | |||
| 4566 | } | 4567 | } |
| 4567 | 4568 | ||
| 4568 | void | 4569 | void |
| @@ -4575,8 +4576,8 @@ il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
| 4575 | 4576 | ||
| 4576 | WARN_ON(il->vif != vif); | 4577 | WARN_ON(il->vif != vif); |
| 4577 | il->vif = NULL; | 4578 | il->vif = NULL; |
| 4578 | 4579 | il->iw_mode = NL80211_IFTYPE_UNSPECIFIED; | |
| 4579 | il_teardown_interface(il, vif, false); | 4580 | il_teardown_interface(il, vif); |
| 4580 | memset(il->bssid, 0, ETH_ALEN); | 4581 | memset(il->bssid, 0, ETH_ALEN); |
| 4581 | 4582 | ||
| 4582 | D_MAC80211("leave\n"); | 4583 | D_MAC80211("leave\n"); |
| @@ -4685,18 +4686,10 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 4685 | } | 4686 | } |
| 4686 | 4687 | ||
| 4687 | /* success */ | 4688 | /* success */ |
| 4688 | il_teardown_interface(il, vif, true); | ||
| 4689 | vif->type = newtype; | 4689 | vif->type = newtype; |
| 4690 | vif->p2p = false; | 4690 | vif->p2p = false; |
| 4691 | err = il_set_mode(il); | 4691 | il->iw_mode = newtype; |
| 4692 | WARN_ON(err); | 4692 | il_teardown_interface(il, vif); |
| 4693 | /* | ||
| 4694 | * We've switched internally, but submitting to the | ||
| 4695 | * device may have failed for some reason. Mask this | ||
| 4696 | * error, because otherwise mac80211 will not switch | ||
| 4697 | * (and set the interface type back) and we'll be | ||
| 4698 | * out of sync with it. | ||
| 4699 | */ | ||
| 4700 | err = 0; | 4693 | err = 0; |
| 4701 | 4694 | ||
| 4702 | out: | 4695 | out: |
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index a790599fe2c2..279796419ea0 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
| @@ -1079,6 +1079,8 @@ static void iwlagn_set_tx_status(struct iwl_priv *priv, | |||
| 1079 | { | 1079 | { |
| 1080 | u16 status = le16_to_cpu(tx_resp->status.status); | 1080 | u16 status = le16_to_cpu(tx_resp->status.status); |
| 1081 | 1081 | ||
| 1082 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | ||
| 1083 | |||
| 1082 | info->status.rates[0].count = tx_resp->failure_frame + 1; | 1084 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
| 1083 | info->flags |= iwl_tx_status_to_mac80211(status); | 1085 | info->flags |= iwl_tx_status_to_mac80211(status); |
| 1084 | iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), | 1086 | iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), |
| @@ -1151,6 +1153,13 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
| 1151 | next_reclaimed = ssn; | 1153 | next_reclaimed = ssn; |
| 1152 | } | 1154 | } |
| 1153 | 1155 | ||
| 1156 | if (tid != IWL_TID_NON_QOS) { | ||
| 1157 | priv->tid_data[sta_id][tid].next_reclaimed = | ||
| 1158 | next_reclaimed; | ||
| 1159 | IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", | ||
| 1160 | next_reclaimed); | ||
| 1161 | } | ||
| 1162 | |||
| 1154 | iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); | 1163 | iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); |
| 1155 | 1164 | ||
| 1156 | iwlagn_check_ratid_empty(priv, sta_id, tid); | 1165 | iwlagn_check_ratid_empty(priv, sta_id, tid); |
| @@ -1201,28 +1210,11 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
| 1201 | if (!is_agg) | 1210 | if (!is_agg) |
| 1202 | iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); | 1211 | iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); |
| 1203 | 1212 | ||
| 1204 | /* | ||
| 1205 | * W/A for FW bug - the seq_ctl isn't updated when the | ||
| 1206 | * queues are flushed. Fetch it from the packet itself | ||
| 1207 | */ | ||
| 1208 | if (!is_agg && status == TX_STATUS_FAIL_FIFO_FLUSHED) { | ||
| 1209 | next_reclaimed = le16_to_cpu(hdr->seq_ctrl); | ||
| 1210 | next_reclaimed = | ||
| 1211 | SEQ_TO_SN(next_reclaimed + 0x10); | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | is_offchannel_skb = | 1213 | is_offchannel_skb = |
| 1215 | (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN); | 1214 | (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN); |
| 1216 | freed++; | 1215 | freed++; |
| 1217 | } | 1216 | } |
| 1218 | 1217 | ||
| 1219 | if (tid != IWL_TID_NON_QOS) { | ||
| 1220 | priv->tid_data[sta_id][tid].next_reclaimed = | ||
| 1221 | next_reclaimed; | ||
| 1222 | IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", | ||
| 1223 | next_reclaimed); | ||
| 1224 | } | ||
| 1225 | |||
| 1226 | WARN_ON(!is_agg && freed != 1); | 1218 | WARN_ON(!is_agg && freed != 1); |
| 1227 | 1219 | ||
| 1228 | /* | 1220 | /* |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index efe525be27dd..cdb11b3964e2 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
| @@ -1459,7 +1459,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
| 1459 | struct cfg80211_ssid req_ssid; | 1459 | struct cfg80211_ssid req_ssid; |
| 1460 | int ret, auth_type = 0; | 1460 | int ret, auth_type = 0; |
| 1461 | struct cfg80211_bss *bss = NULL; | 1461 | struct cfg80211_bss *bss = NULL; |
| 1462 | u8 is_scanning_required = 0, config_bands = 0; | 1462 | u8 is_scanning_required = 0; |
| 1463 | 1463 | ||
| 1464 | memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); | 1464 | memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); |
| 1465 | 1465 | ||
| @@ -1478,19 +1478,6 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
| 1478 | /* disconnect before try to associate */ | 1478 | /* disconnect before try to associate */ |
| 1479 | mwifiex_deauthenticate(priv, NULL); | 1479 | mwifiex_deauthenticate(priv, NULL); |
| 1480 | 1480 | ||
| 1481 | if (channel) { | ||
| 1482 | if (mode == NL80211_IFTYPE_STATION) { | ||
| 1483 | if (channel->band == IEEE80211_BAND_2GHZ) | ||
| 1484 | config_bands = BAND_B | BAND_G | BAND_GN; | ||
| 1485 | else | ||
| 1486 | config_bands = BAND_A | BAND_AN; | ||
| 1487 | |||
| 1488 | if (!((config_bands | priv->adapter->fw_bands) & | ||
| 1489 | ~priv->adapter->fw_bands)) | ||
| 1490 | priv->adapter->config_bands = config_bands; | ||
| 1491 | } | ||
| 1492 | } | ||
| 1493 | |||
| 1494 | /* As this is new association, clear locally stored | 1481 | /* As this is new association, clear locally stored |
| 1495 | * keys and security related flags */ | 1482 | * keys and security related flags */ |
| 1496 | priv->sec_info.wpa_enabled = false; | 1483 | priv->sec_info.wpa_enabled = false; |
| @@ -1707,7 +1694,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, | |||
| 1707 | 1694 | ||
| 1708 | if (cfg80211_get_chandef_type(¶ms->chandef) != | 1695 | if (cfg80211_get_chandef_type(¶ms->chandef) != |
| 1709 | NL80211_CHAN_NO_HT) | 1696 | NL80211_CHAN_NO_HT) |
| 1710 | config_bands |= BAND_GN; | 1697 | config_bands |= BAND_G | BAND_GN; |
| 1711 | } else { | 1698 | } else { |
| 1712 | if (cfg80211_get_chandef_type(¶ms->chandef) == | 1699 | if (cfg80211_get_chandef_type(¶ms->chandef) == |
| 1713 | NL80211_CHAN_NO_HT) | 1700 | NL80211_CHAN_NO_HT) |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 13fbc4eb1595..b879e1338a54 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
| @@ -161,7 +161,7 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 161 | 161 | ||
| 162 | if (pdev) { | 162 | if (pdev) { |
| 163 | card = (struct pcie_service_card *) pci_get_drvdata(pdev); | 163 | card = (struct pcie_service_card *) pci_get_drvdata(pdev); |
| 164 | if (!card || card->adapter) { | 164 | if (!card || !card->adapter) { |
| 165 | pr_err("Card or adapter structure is not valid\n"); | 165 | pr_err("Card or adapter structure is not valid\n"); |
| 166 | return 0; | 166 | return 0; |
| 167 | } | 167 | } |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 9189a32b7844..973a9d90e9ea 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
| @@ -1563,7 +1563,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 1563 | dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n", | 1563 | dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n", |
| 1564 | scan_rsp->number_of_sets); | 1564 | scan_rsp->number_of_sets); |
| 1565 | ret = -1; | 1565 | ret = -1; |
| 1566 | goto done; | 1566 | goto check_next_scan; |
| 1567 | } | 1567 | } |
| 1568 | 1568 | ||
| 1569 | bytes_left = le16_to_cpu(scan_rsp->bss_descript_size); | 1569 | bytes_left = le16_to_cpu(scan_rsp->bss_descript_size); |
| @@ -1634,7 +1634,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 1634 | if (!beacon_size || beacon_size > bytes_left) { | 1634 | if (!beacon_size || beacon_size > bytes_left) { |
| 1635 | bss_info += bytes_left; | 1635 | bss_info += bytes_left; |
| 1636 | bytes_left = 0; | 1636 | bytes_left = 0; |
| 1637 | return -1; | 1637 | ret = -1; |
| 1638 | goto check_next_scan; | ||
| 1638 | } | 1639 | } |
| 1639 | 1640 | ||
| 1640 | /* Initialize the current working beacon pointer for this BSS | 1641 | /* Initialize the current working beacon pointer for this BSS |
| @@ -1690,7 +1691,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 1690 | dev_err(priv->adapter->dev, | 1691 | dev_err(priv->adapter->dev, |
| 1691 | "%s: bytes left < IE length\n", | 1692 | "%s: bytes left < IE length\n", |
| 1692 | __func__); | 1693 | __func__); |
| 1693 | goto done; | 1694 | goto check_next_scan; |
| 1694 | } | 1695 | } |
| 1695 | if (element_id == WLAN_EID_DS_PARAMS) { | 1696 | if (element_id == WLAN_EID_DS_PARAMS) { |
| 1696 | channel = *(current_ptr + sizeof(struct ieee_types_header)); | 1697 | channel = *(current_ptr + sizeof(struct ieee_types_header)); |
| @@ -1753,6 +1754,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 1753 | } | 1754 | } |
| 1754 | } | 1755 | } |
| 1755 | 1756 | ||
| 1757 | check_next_scan: | ||
| 1756 | spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); | 1758 | spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); |
| 1757 | if (list_empty(&adapter->scan_pending_q)) { | 1759 | if (list_empty(&adapter->scan_pending_q)) { |
| 1758 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); | 1760 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); |
| @@ -1813,7 +1815,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 1813 | } | 1815 | } |
| 1814 | } | 1816 | } |
| 1815 | 1817 | ||
| 1816 | done: | ||
| 1817 | return ret; | 1818 | return ret; |
| 1818 | } | 1819 | } |
| 1819 | 1820 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 60e88b58039d..f542bb8ccbc8 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
| @@ -283,6 +283,20 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
| 283 | if (ret) | 283 | if (ret) |
| 284 | goto done; | 284 | goto done; |
| 285 | 285 | ||
| 286 | if (bss_desc) { | ||
| 287 | u8 config_bands = 0; | ||
| 288 | |||
| 289 | if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band) | ||
| 290 | == HostCmd_SCAN_RADIO_TYPE_BG) | ||
| 291 | config_bands = BAND_B | BAND_G | BAND_GN; | ||
| 292 | else | ||
| 293 | config_bands = BAND_A | BAND_AN; | ||
| 294 | |||
| 295 | if (!((config_bands | adapter->fw_bands) & | ||
| 296 | ~adapter->fw_bands)) | ||
| 297 | adapter->config_bands = config_bands; | ||
| 298 | } | ||
| 299 | |||
| 286 | ret = mwifiex_check_network_compatibility(priv, bss_desc); | 300 | ret = mwifiex_check_network_compatibility(priv, bss_desc); |
| 287 | if (ret) | 301 | if (ret) |
| 288 | goto done; | 302 | goto done; |
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig index 21b1bbb93a7e..b80bc4612581 100644 --- a/drivers/net/wireless/rtlwifi/Kconfig +++ b/drivers/net/wireless/rtlwifi/Kconfig | |||
| @@ -57,12 +57,12 @@ config RTL8192CU | |||
| 57 | 57 | ||
| 58 | config RTLWIFI | 58 | config RTLWIFI |
| 59 | tristate | 59 | tristate |
| 60 | depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE | 60 | depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE || RTL8723AE |
| 61 | default m | 61 | default m |
| 62 | 62 | ||
| 63 | config RTLWIFI_DEBUG | 63 | config RTLWIFI_DEBUG |
| 64 | bool "Additional debugging output" | 64 | bool "Additional debugging output" |
| 65 | depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE | 65 | depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE || RTL8723AE |
| 66 | default y | 66 | default y |
| 67 | 67 | ||
| 68 | config RTL8192C_COMMON | 68 | config RTL8192C_COMMON |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 4494d130b37c..0f8b05185eda 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
| @@ -1004,7 +1004,8 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
| 1004 | is_tx ? "Tx" : "Rx"); | 1004 | is_tx ? "Tx" : "Rx"); |
| 1005 | 1005 | ||
| 1006 | if (is_tx) { | 1006 | if (is_tx) { |
| 1007 | rtl_lps_leave(hw); | 1007 | schedule_work(&rtlpriv-> |
| 1008 | works.lps_leave_work); | ||
| 1008 | ppsc->last_delaylps_stamp_jiffies = | 1009 | ppsc->last_delaylps_stamp_jiffies = |
| 1009 | jiffies; | 1010 | jiffies; |
| 1010 | } | 1011 | } |
| @@ -1014,7 +1015,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
| 1014 | } | 1015 | } |
| 1015 | } else if (ETH_P_ARP == ether_type) { | 1016 | } else if (ETH_P_ARP == ether_type) { |
| 1016 | if (is_tx) { | 1017 | if (is_tx) { |
| 1017 | rtl_lps_leave(hw); | 1018 | schedule_work(&rtlpriv->works.lps_leave_work); |
| 1018 | ppsc->last_delaylps_stamp_jiffies = jiffies; | 1019 | ppsc->last_delaylps_stamp_jiffies = jiffies; |
| 1019 | } | 1020 | } |
| 1020 | 1021 | ||
| @@ -1024,7 +1025,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
| 1024 | "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); | 1025 | "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); |
| 1025 | 1026 | ||
| 1026 | if (is_tx) { | 1027 | if (is_tx) { |
| 1027 | rtl_lps_leave(hw); | 1028 | schedule_work(&rtlpriv->works.lps_leave_work); |
| 1028 | ppsc->last_delaylps_stamp_jiffies = jiffies; | 1029 | ppsc->last_delaylps_stamp_jiffies = jiffies; |
| 1029 | } | 1030 | } |
| 1030 | 1031 | ||
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index f2ecdeb3a90d..1535efda3d52 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
| @@ -542,8 +542,8 @@ static void _rtl_rx_pre_process(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 542 | WARN_ON(skb_queue_empty(&rx_queue)); | 542 | WARN_ON(skb_queue_empty(&rx_queue)); |
| 543 | while (!skb_queue_empty(&rx_queue)) { | 543 | while (!skb_queue_empty(&rx_queue)) { |
| 544 | _skb = skb_dequeue(&rx_queue); | 544 | _skb = skb_dequeue(&rx_queue); |
| 545 | _rtl_usb_rx_process_agg(hw, skb); | 545 | _rtl_usb_rx_process_agg(hw, _skb); |
| 546 | ieee80211_rx_irqsafe(hw, skb); | 546 | ieee80211_rx_irqsafe(hw, _skb); |
| 547 | } | 547 | } |
| 548 | } | 548 | } |
| 549 | 549 | ||
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index 94b79c3338c4..9d7f1723dd8f 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
| @@ -151,6 +151,9 @@ void xen_netbk_queue_tx_skb(struct xenvif *vif, struct sk_buff *skb); | |||
| 151 | /* Notify xenvif that ring now has space to send an skb to the frontend */ | 151 | /* Notify xenvif that ring now has space to send an skb to the frontend */ |
| 152 | void xenvif_notify_tx_completion(struct xenvif *vif); | 152 | void xenvif_notify_tx_completion(struct xenvif *vif); |
| 153 | 153 | ||
| 154 | /* Prevent the device from generating any further traffic. */ | ||
| 155 | void xenvif_carrier_off(struct xenvif *vif); | ||
| 156 | |||
| 154 | /* Returns number of ring slots required to send an skb to the frontend */ | 157 | /* Returns number of ring slots required to send an skb to the frontend */ |
| 155 | unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb); | 158 | unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb); |
| 156 | 159 | ||
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index b7d41f8c338a..b8c5193bd420 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
| @@ -343,17 +343,22 @@ err: | |||
| 343 | return err; | 343 | return err; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | void xenvif_disconnect(struct xenvif *vif) | 346 | void xenvif_carrier_off(struct xenvif *vif) |
| 347 | { | 347 | { |
| 348 | struct net_device *dev = vif->dev; | 348 | struct net_device *dev = vif->dev; |
| 349 | if (netif_carrier_ok(dev)) { | 349 | |
| 350 | rtnl_lock(); | 350 | rtnl_lock(); |
| 351 | netif_carrier_off(dev); /* discard queued packets */ | 351 | netif_carrier_off(dev); /* discard queued packets */ |
| 352 | if (netif_running(dev)) | 352 | if (netif_running(dev)) |
| 353 | xenvif_down(vif); | 353 | xenvif_down(vif); |
| 354 | rtnl_unlock(); | 354 | rtnl_unlock(); |
| 355 | xenvif_put(vif); | 355 | xenvif_put(vif); |
| 356 | } | 356 | } |
| 357 | |||
| 358 | void xenvif_disconnect(struct xenvif *vif) | ||
| 359 | { | ||
| 360 | if (netif_carrier_ok(vif->dev)) | ||
| 361 | xenvif_carrier_off(vif); | ||
| 357 | 362 | ||
| 358 | atomic_dec(&vif->refcnt); | 363 | atomic_dec(&vif->refcnt); |
| 359 | wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0); | 364 | wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0); |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index f2d6b78d901d..2b9520c46e97 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -147,7 +147,8 @@ void xen_netbk_remove_xenvif(struct xenvif *vif) | |||
| 147 | atomic_dec(&netbk->netfront_count); | 147 | atomic_dec(&netbk->netfront_count); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx); | 150 | static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx, |
| 151 | u8 status); | ||
| 151 | static void make_tx_response(struct xenvif *vif, | 152 | static void make_tx_response(struct xenvif *vif, |
| 152 | struct xen_netif_tx_request *txp, | 153 | struct xen_netif_tx_request *txp, |
| 153 | s8 st); | 154 | s8 st); |
| @@ -879,7 +880,7 @@ static void netbk_tx_err(struct xenvif *vif, | |||
| 879 | 880 | ||
| 880 | do { | 881 | do { |
| 881 | make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR); | 882 | make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR); |
| 882 | if (cons >= end) | 883 | if (cons == end) |
| 883 | break; | 884 | break; |
| 884 | txp = RING_GET_REQUEST(&vif->tx, cons++); | 885 | txp = RING_GET_REQUEST(&vif->tx, cons++); |
| 885 | } while (1); | 886 | } while (1); |
| @@ -888,6 +889,13 @@ static void netbk_tx_err(struct xenvif *vif, | |||
| 888 | xenvif_put(vif); | 889 | xenvif_put(vif); |
| 889 | } | 890 | } |
| 890 | 891 | ||
| 892 | static void netbk_fatal_tx_err(struct xenvif *vif) | ||
| 893 | { | ||
| 894 | netdev_err(vif->dev, "fatal error; disabling device\n"); | ||
| 895 | xenvif_carrier_off(vif); | ||
| 896 | xenvif_put(vif); | ||
| 897 | } | ||
| 898 | |||
| 891 | static int netbk_count_requests(struct xenvif *vif, | 899 | static int netbk_count_requests(struct xenvif *vif, |
| 892 | struct xen_netif_tx_request *first, | 900 | struct xen_netif_tx_request *first, |
| 893 | struct xen_netif_tx_request *txp, | 901 | struct xen_netif_tx_request *txp, |
| @@ -901,19 +909,22 @@ static int netbk_count_requests(struct xenvif *vif, | |||
| 901 | 909 | ||
| 902 | do { | 910 | do { |
| 903 | if (frags >= work_to_do) { | 911 | if (frags >= work_to_do) { |
| 904 | netdev_dbg(vif->dev, "Need more frags\n"); | 912 | netdev_err(vif->dev, "Need more frags\n"); |
| 913 | netbk_fatal_tx_err(vif); | ||
| 905 | return -frags; | 914 | return -frags; |
| 906 | } | 915 | } |
| 907 | 916 | ||
| 908 | if (unlikely(frags >= MAX_SKB_FRAGS)) { | 917 | if (unlikely(frags >= MAX_SKB_FRAGS)) { |
| 909 | netdev_dbg(vif->dev, "Too many frags\n"); | 918 | netdev_err(vif->dev, "Too many frags\n"); |
| 919 | netbk_fatal_tx_err(vif); | ||
| 910 | return -frags; | 920 | return -frags; |
| 911 | } | 921 | } |
| 912 | 922 | ||
| 913 | memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags), | 923 | memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags), |
| 914 | sizeof(*txp)); | 924 | sizeof(*txp)); |
| 915 | if (txp->size > first->size) { | 925 | if (txp->size > first->size) { |
| 916 | netdev_dbg(vif->dev, "Frags galore\n"); | 926 | netdev_err(vif->dev, "Frag is bigger than frame.\n"); |
| 927 | netbk_fatal_tx_err(vif); | ||
| 917 | return -frags; | 928 | return -frags; |
| 918 | } | 929 | } |
| 919 | 930 | ||
| @@ -921,8 +932,9 @@ static int netbk_count_requests(struct xenvif *vif, | |||
| 921 | frags++; | 932 | frags++; |
| 922 | 933 | ||
| 923 | if (unlikely((txp->offset + txp->size) > PAGE_SIZE)) { | 934 | if (unlikely((txp->offset + txp->size) > PAGE_SIZE)) { |
| 924 | netdev_dbg(vif->dev, "txp->offset: %x, size: %u\n", | 935 | netdev_err(vif->dev, "txp->offset: %x, size: %u\n", |
| 925 | txp->offset, txp->size); | 936 | txp->offset, txp->size); |
| 937 | netbk_fatal_tx_err(vif); | ||
| 926 | return -frags; | 938 | return -frags; |
| 927 | } | 939 | } |
| 928 | } while ((txp++)->flags & XEN_NETTXF_more_data); | 940 | } while ((txp++)->flags & XEN_NETTXF_more_data); |
| @@ -966,7 +978,7 @@ static struct gnttab_copy *xen_netbk_get_requests(struct xen_netbk *netbk, | |||
| 966 | pending_idx = netbk->pending_ring[index]; | 978 | pending_idx = netbk->pending_ring[index]; |
| 967 | page = xen_netbk_alloc_page(netbk, skb, pending_idx); | 979 | page = xen_netbk_alloc_page(netbk, skb, pending_idx); |
| 968 | if (!page) | 980 | if (!page) |
| 969 | return NULL; | 981 | goto err; |
| 970 | 982 | ||
| 971 | gop->source.u.ref = txp->gref; | 983 | gop->source.u.ref = txp->gref; |
| 972 | gop->source.domid = vif->domid; | 984 | gop->source.domid = vif->domid; |
| @@ -988,6 +1000,17 @@ static struct gnttab_copy *xen_netbk_get_requests(struct xen_netbk *netbk, | |||
| 988 | } | 1000 | } |
| 989 | 1001 | ||
| 990 | return gop; | 1002 | return gop; |
| 1003 | err: | ||
| 1004 | /* Unwind, freeing all pages and sending error responses. */ | ||
| 1005 | while (i-- > start) { | ||
| 1006 | xen_netbk_idx_release(netbk, frag_get_pending_idx(&frags[i]), | ||
| 1007 | XEN_NETIF_RSP_ERROR); | ||
| 1008 | } | ||
| 1009 | /* The head too, if necessary. */ | ||
| 1010 | if (start) | ||
| 1011 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR); | ||
| 1012 | |||
| 1013 | return NULL; | ||
| 991 | } | 1014 | } |
| 992 | 1015 | ||
| 993 | static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, | 1016 | static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, |
| @@ -996,30 +1019,20 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, | |||
| 996 | { | 1019 | { |
| 997 | struct gnttab_copy *gop = *gopp; | 1020 | struct gnttab_copy *gop = *gopp; |
| 998 | u16 pending_idx = *((u16 *)skb->data); | 1021 | u16 pending_idx = *((u16 *)skb->data); |
| 999 | struct pending_tx_info *pending_tx_info = netbk->pending_tx_info; | ||
| 1000 | struct xenvif *vif = pending_tx_info[pending_idx].vif; | ||
| 1001 | struct xen_netif_tx_request *txp; | ||
| 1002 | struct skb_shared_info *shinfo = skb_shinfo(skb); | 1022 | struct skb_shared_info *shinfo = skb_shinfo(skb); |
| 1003 | int nr_frags = shinfo->nr_frags; | 1023 | int nr_frags = shinfo->nr_frags; |
| 1004 | int i, err, start; | 1024 | int i, err, start; |
| 1005 | 1025 | ||
| 1006 | /* Check status of header. */ | 1026 | /* Check status of header. */ |
| 1007 | err = gop->status; | 1027 | err = gop->status; |
| 1008 | if (unlikely(err)) { | 1028 | if (unlikely(err)) |
| 1009 | pending_ring_idx_t index; | 1029 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR); |
| 1010 | index = pending_index(netbk->pending_prod++); | ||
| 1011 | txp = &pending_tx_info[pending_idx].req; | ||
| 1012 | make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR); | ||
| 1013 | netbk->pending_ring[index] = pending_idx; | ||
| 1014 | xenvif_put(vif); | ||
| 1015 | } | ||
| 1016 | 1030 | ||
| 1017 | /* Skip first skb fragment if it is on same page as header fragment. */ | 1031 | /* Skip first skb fragment if it is on same page as header fragment. */ |
| 1018 | start = (frag_get_pending_idx(&shinfo->frags[0]) == pending_idx); | 1032 | start = (frag_get_pending_idx(&shinfo->frags[0]) == pending_idx); |
| 1019 | 1033 | ||
| 1020 | for (i = start; i < nr_frags; i++) { | 1034 | for (i = start; i < nr_frags; i++) { |
| 1021 | int j, newerr; | 1035 | int j, newerr; |
| 1022 | pending_ring_idx_t index; | ||
| 1023 | 1036 | ||
| 1024 | pending_idx = frag_get_pending_idx(&shinfo->frags[i]); | 1037 | pending_idx = frag_get_pending_idx(&shinfo->frags[i]); |
| 1025 | 1038 | ||
| @@ -1028,16 +1041,12 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, | |||
| 1028 | if (likely(!newerr)) { | 1041 | if (likely(!newerr)) { |
| 1029 | /* Had a previous error? Invalidate this fragment. */ | 1042 | /* Had a previous error? Invalidate this fragment. */ |
| 1030 | if (unlikely(err)) | 1043 | if (unlikely(err)) |
| 1031 | xen_netbk_idx_release(netbk, pending_idx); | 1044 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY); |
| 1032 | continue; | 1045 | continue; |
| 1033 | } | 1046 | } |
| 1034 | 1047 | ||
| 1035 | /* Error on this fragment: respond to client with an error. */ | 1048 | /* Error on this fragment: respond to client with an error. */ |
| 1036 | txp = &netbk->pending_tx_info[pending_idx].req; | 1049 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR); |
| 1037 | make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR); | ||
| 1038 | index = pending_index(netbk->pending_prod++); | ||
| 1039 | netbk->pending_ring[index] = pending_idx; | ||
| 1040 | xenvif_put(vif); | ||
| 1041 | 1050 | ||
| 1042 | /* Not the first error? Preceding frags already invalidated. */ | 1051 | /* Not the first error? Preceding frags already invalidated. */ |
| 1043 | if (err) | 1052 | if (err) |
| @@ -1045,10 +1054,10 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, | |||
| 1045 | 1054 | ||
| 1046 | /* First error: invalidate header and preceding fragments. */ | 1055 | /* First error: invalidate header and preceding fragments. */ |
| 1047 | pending_idx = *((u16 *)skb->data); | 1056 | pending_idx = *((u16 *)skb->data); |
| 1048 | xen_netbk_idx_release(netbk, pending_idx); | 1057 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY); |
| 1049 | for (j = start; j < i; j++) { | 1058 | for (j = start; j < i; j++) { |
| 1050 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); | 1059 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); |
| 1051 | xen_netbk_idx_release(netbk, pending_idx); | 1060 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY); |
| 1052 | } | 1061 | } |
| 1053 | 1062 | ||
| 1054 | /* Remember the error: invalidate all subsequent fragments. */ | 1063 | /* Remember the error: invalidate all subsequent fragments. */ |
| @@ -1082,7 +1091,7 @@ static void xen_netbk_fill_frags(struct xen_netbk *netbk, struct sk_buff *skb) | |||
| 1082 | 1091 | ||
| 1083 | /* Take an extra reference to offset xen_netbk_idx_release */ | 1092 | /* Take an extra reference to offset xen_netbk_idx_release */ |
| 1084 | get_page(netbk->mmap_pages[pending_idx]); | 1093 | get_page(netbk->mmap_pages[pending_idx]); |
| 1085 | xen_netbk_idx_release(netbk, pending_idx); | 1094 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY); |
| 1086 | } | 1095 | } |
| 1087 | } | 1096 | } |
| 1088 | 1097 | ||
| @@ -1095,7 +1104,8 @@ static int xen_netbk_get_extras(struct xenvif *vif, | |||
| 1095 | 1104 | ||
| 1096 | do { | 1105 | do { |
| 1097 | if (unlikely(work_to_do-- <= 0)) { | 1106 | if (unlikely(work_to_do-- <= 0)) { |
| 1098 | netdev_dbg(vif->dev, "Missing extra info\n"); | 1107 | netdev_err(vif->dev, "Missing extra info\n"); |
| 1108 | netbk_fatal_tx_err(vif); | ||
| 1099 | return -EBADR; | 1109 | return -EBADR; |
| 1100 | } | 1110 | } |
| 1101 | 1111 | ||
| @@ -1104,8 +1114,9 @@ static int xen_netbk_get_extras(struct xenvif *vif, | |||
| 1104 | if (unlikely(!extra.type || | 1114 | if (unlikely(!extra.type || |
| 1105 | extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) { | 1115 | extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) { |
| 1106 | vif->tx.req_cons = ++cons; | 1116 | vif->tx.req_cons = ++cons; |
| 1107 | netdev_dbg(vif->dev, | 1117 | netdev_err(vif->dev, |
| 1108 | "Invalid extra type: %d\n", extra.type); | 1118 | "Invalid extra type: %d\n", extra.type); |
| 1119 | netbk_fatal_tx_err(vif); | ||
| 1109 | return -EINVAL; | 1120 | return -EINVAL; |
| 1110 | } | 1121 | } |
| 1111 | 1122 | ||
| @@ -1121,13 +1132,15 @@ static int netbk_set_skb_gso(struct xenvif *vif, | |||
| 1121 | struct xen_netif_extra_info *gso) | 1132 | struct xen_netif_extra_info *gso) |
| 1122 | { | 1133 | { |
| 1123 | if (!gso->u.gso.size) { | 1134 | if (!gso->u.gso.size) { |
| 1124 | netdev_dbg(vif->dev, "GSO size must not be zero.\n"); | 1135 | netdev_err(vif->dev, "GSO size must not be zero.\n"); |
| 1136 | netbk_fatal_tx_err(vif); | ||
| 1125 | return -EINVAL; | 1137 | return -EINVAL; |
| 1126 | } | 1138 | } |
| 1127 | 1139 | ||
| 1128 | /* Currently only TCPv4 S.O. is supported. */ | 1140 | /* Currently only TCPv4 S.O. is supported. */ |
| 1129 | if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) { | 1141 | if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) { |
| 1130 | netdev_dbg(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type); | 1142 | netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type); |
| 1143 | netbk_fatal_tx_err(vif); | ||
| 1131 | return -EINVAL; | 1144 | return -EINVAL; |
| 1132 | } | 1145 | } |
| 1133 | 1146 | ||
| @@ -1264,9 +1277,25 @@ static unsigned xen_netbk_tx_build_gops(struct xen_netbk *netbk) | |||
| 1264 | 1277 | ||
| 1265 | /* Get a netif from the list with work to do. */ | 1278 | /* Get a netif from the list with work to do. */ |
| 1266 | vif = poll_net_schedule_list(netbk); | 1279 | vif = poll_net_schedule_list(netbk); |
| 1280 | /* This can sometimes happen because the test of | ||
| 1281 | * list_empty(net_schedule_list) at the top of the | ||
| 1282 | * loop is unlocked. Just go back and have another | ||
| 1283 | * look. | ||
| 1284 | */ | ||
| 1267 | if (!vif) | 1285 | if (!vif) |
| 1268 | continue; | 1286 | continue; |
| 1269 | 1287 | ||
| 1288 | if (vif->tx.sring->req_prod - vif->tx.req_cons > | ||
| 1289 | XEN_NETIF_TX_RING_SIZE) { | ||
| 1290 | netdev_err(vif->dev, | ||
| 1291 | "Impossible number of requests. " | ||
| 1292 | "req_prod %d, req_cons %d, size %ld\n", | ||
| 1293 | vif->tx.sring->req_prod, vif->tx.req_cons, | ||
| 1294 | XEN_NETIF_TX_RING_SIZE); | ||
| 1295 | netbk_fatal_tx_err(vif); | ||
| 1296 | continue; | ||
| 1297 | } | ||
| 1298 | |||
| 1270 | RING_FINAL_CHECK_FOR_REQUESTS(&vif->tx, work_to_do); | 1299 | RING_FINAL_CHECK_FOR_REQUESTS(&vif->tx, work_to_do); |
| 1271 | if (!work_to_do) { | 1300 | if (!work_to_do) { |
| 1272 | xenvif_put(vif); | 1301 | xenvif_put(vif); |
| @@ -1294,17 +1323,14 @@ static unsigned xen_netbk_tx_build_gops(struct xen_netbk *netbk) | |||
| 1294 | work_to_do = xen_netbk_get_extras(vif, extras, | 1323 | work_to_do = xen_netbk_get_extras(vif, extras, |
| 1295 | work_to_do); | 1324 | work_to_do); |
| 1296 | idx = vif->tx.req_cons; | 1325 | idx = vif->tx.req_cons; |
| 1297 | if (unlikely(work_to_do < 0)) { | 1326 | if (unlikely(work_to_do < 0)) |
| 1298 | netbk_tx_err(vif, &txreq, idx); | ||
| 1299 | continue; | 1327 | continue; |
| 1300 | } | ||
| 1301 | } | 1328 | } |
| 1302 | 1329 | ||
| 1303 | ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do); | 1330 | ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do); |
| 1304 | if (unlikely(ret < 0)) { | 1331 | if (unlikely(ret < 0)) |
| 1305 | netbk_tx_err(vif, &txreq, idx - ret); | ||
| 1306 | continue; | 1332 | continue; |
| 1307 | } | 1333 | |
| 1308 | idx += ret; | 1334 | idx += ret; |
| 1309 | 1335 | ||
| 1310 | if (unlikely(txreq.size < ETH_HLEN)) { | 1336 | if (unlikely(txreq.size < ETH_HLEN)) { |
| @@ -1316,11 +1342,11 @@ static unsigned xen_netbk_tx_build_gops(struct xen_netbk *netbk) | |||
| 1316 | 1342 | ||
| 1317 | /* No crossing a page as the payload mustn't fragment. */ | 1343 | /* No crossing a page as the payload mustn't fragment. */ |
| 1318 | if (unlikely((txreq.offset + txreq.size) > PAGE_SIZE)) { | 1344 | if (unlikely((txreq.offset + txreq.size) > PAGE_SIZE)) { |
| 1319 | netdev_dbg(vif->dev, | 1345 | netdev_err(vif->dev, |
| 1320 | "txreq.offset: %x, size: %u, end: %lu\n", | 1346 | "txreq.offset: %x, size: %u, end: %lu\n", |
| 1321 | txreq.offset, txreq.size, | 1347 | txreq.offset, txreq.size, |
| 1322 | (txreq.offset&~PAGE_MASK) + txreq.size); | 1348 | (txreq.offset&~PAGE_MASK) + txreq.size); |
| 1323 | netbk_tx_err(vif, &txreq, idx); | 1349 | netbk_fatal_tx_err(vif); |
| 1324 | continue; | 1350 | continue; |
| 1325 | } | 1351 | } |
| 1326 | 1352 | ||
| @@ -1348,8 +1374,8 @@ static unsigned xen_netbk_tx_build_gops(struct xen_netbk *netbk) | |||
| 1348 | gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; | 1374 | gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; |
| 1349 | 1375 | ||
| 1350 | if (netbk_set_skb_gso(vif, skb, gso)) { | 1376 | if (netbk_set_skb_gso(vif, skb, gso)) { |
| 1377 | /* Failure in netbk_set_skb_gso is fatal. */ | ||
| 1351 | kfree_skb(skb); | 1378 | kfree_skb(skb); |
| 1352 | netbk_tx_err(vif, &txreq, idx); | ||
| 1353 | continue; | 1379 | continue; |
| 1354 | } | 1380 | } |
| 1355 | } | 1381 | } |
| @@ -1448,7 +1474,7 @@ static void xen_netbk_tx_submit(struct xen_netbk *netbk) | |||
| 1448 | txp->size -= data_len; | 1474 | txp->size -= data_len; |
| 1449 | } else { | 1475 | } else { |
| 1450 | /* Schedule a response immediately. */ | 1476 | /* Schedule a response immediately. */ |
| 1451 | xen_netbk_idx_release(netbk, pending_idx); | 1477 | xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY); |
| 1452 | } | 1478 | } |
| 1453 | 1479 | ||
| 1454 | if (txp->flags & XEN_NETTXF_csum_blank) | 1480 | if (txp->flags & XEN_NETTXF_csum_blank) |
| @@ -1500,7 +1526,8 @@ static void xen_netbk_tx_action(struct xen_netbk *netbk) | |||
| 1500 | xen_netbk_tx_submit(netbk); | 1526 | xen_netbk_tx_submit(netbk); |
| 1501 | } | 1527 | } |
| 1502 | 1528 | ||
| 1503 | static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx) | 1529 | static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx, |
| 1530 | u8 status) | ||
| 1504 | { | 1531 | { |
| 1505 | struct xenvif *vif; | 1532 | struct xenvif *vif; |
| 1506 | struct pending_tx_info *pending_tx_info; | 1533 | struct pending_tx_info *pending_tx_info; |
| @@ -1514,7 +1541,7 @@ static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx) | |||
| 1514 | 1541 | ||
| 1515 | vif = pending_tx_info->vif; | 1542 | vif = pending_tx_info->vif; |
| 1516 | 1543 | ||
| 1517 | make_tx_response(vif, &pending_tx_info->req, XEN_NETIF_RSP_OKAY); | 1544 | make_tx_response(vif, &pending_tx_info->req, status); |
| 1518 | 1545 | ||
| 1519 | index = pending_index(netbk->pending_prod++); | 1546 | index = pending_index(netbk->pending_prod++); |
| 1520 | netbk->pending_ring[index] = pending_idx; | 1547 | netbk->pending_ring[index] = pending_idx; |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index c31aeb01bb00..a5f3c8ca480e 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
| @@ -181,12 +181,11 @@ config PINCTRL_COH901 | |||
| 181 | 181 | ||
| 182 | config PINCTRL_SAMSUNG | 182 | config PINCTRL_SAMSUNG |
| 183 | bool | 183 | bool |
| 184 | depends on OF && GPIOLIB | ||
| 185 | select PINMUX | 184 | select PINMUX |
| 186 | select PINCONF | 185 | select PINCONF |
| 187 | 186 | ||
| 188 | config PINCTRL_EXYNOS4 | 187 | config PINCTRL_EXYNOS |
| 189 | bool "Pinctrl driver data for Exynos4 SoC" | 188 | bool "Pinctrl driver data for Samsung EXYNOS SoCs" |
| 190 | depends on OF && GPIOLIB | 189 | depends on OF && GPIOLIB |
| 191 | select PINCTRL_SAMSUNG | 190 | select PINCTRL_SAMSUNG |
| 192 | 191 | ||
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index fc4606f27dc7..6e87e52eab5d 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
| @@ -36,7 +36,7 @@ obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o | |||
| 36 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o | 36 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o |
| 37 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o | 37 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o |
| 38 | obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o | 38 | obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o |
| 39 | obj-$(CONFIG_PINCTRL_EXYNOS4) += pinctrl-exynos.o | 39 | obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o |
| 40 | obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o | 40 | obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o |
| 41 | obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o | 41 | obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o |
| 42 | obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o | 42 | obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o |
diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 69aba3697287..428ea96a94d3 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c | |||
| @@ -588,7 +588,7 @@ static int dove_pinctrl_probe(struct platform_device *pdev) | |||
| 588 | { | 588 | { |
| 589 | const struct of_device_id *match = | 589 | const struct of_device_id *match = |
| 590 | of_match_device(dove_pinctrl_of_match, &pdev->dev); | 590 | of_match_device(dove_pinctrl_of_match, &pdev->dev); |
| 591 | pdev->dev.platform_data = match->data; | 591 | pdev->dev.platform_data = (void *)match->data; |
| 592 | 592 | ||
| 593 | /* | 593 | /* |
| 594 | * General MPP Configuration Register is part of pdma registers. | 594 | * General MPP Configuration Register is part of pdma registers. |
diff --git a/drivers/pinctrl/mvebu/pinctrl-kirkwood.c b/drivers/pinctrl/mvebu/pinctrl-kirkwood.c index f12084e18057..cdd483df673e 100644 --- a/drivers/pinctrl/mvebu/pinctrl-kirkwood.c +++ b/drivers/pinctrl/mvebu/pinctrl-kirkwood.c | |||
| @@ -66,9 +66,9 @@ static struct mvebu_mpp_mode mv88f6xxx_mpp_modes[] = { | |||
| 66 | MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1, 0)), | 66 | MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1, 0)), |
| 67 | MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1, 0))), | 67 | MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1, 0))), |
| 68 | MPP_MODE(6, | 68 | MPP_MODE(6, |
| 69 | MPP_VAR_FUNCTION(0x0, "sysrst", "out", V(1, 1, 1, 1, 1, 1)), | 69 | MPP_VAR_FUNCTION(0x1, "sysrst", "out", V(1, 1, 1, 1, 1, 1)), |
| 70 | MPP_VAR_FUNCTION(0x1, "spi", "mosi", V(1, 1, 1, 1, 1, 1)), | 70 | MPP_VAR_FUNCTION(0x2, "spi", "mosi", V(1, 1, 1, 1, 1, 1)), |
| 71 | MPP_VAR_FUNCTION(0x2, "ptp", "trig", V(1, 1, 1, 1, 0, 0))), | 71 | MPP_VAR_FUNCTION(0x3, "ptp", "trig", V(1, 1, 1, 1, 0, 0))), |
| 72 | MPP_MODE(7, | 72 | MPP_MODE(7, |
| 73 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1, 1)), | 73 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1, 1)), |
| 74 | MPP_VAR_FUNCTION(0x1, "pex", "rsto", V(1, 1, 1, 1, 0, 1)), | 74 | MPP_VAR_FUNCTION(0x1, "pex", "rsto", V(1, 1, 1, 1, 0, 1)), |
| @@ -458,7 +458,7 @@ static int kirkwood_pinctrl_probe(struct platform_device *pdev) | |||
| 458 | { | 458 | { |
| 459 | const struct of_device_id *match = | 459 | const struct of_device_id *match = |
| 460 | of_match_device(kirkwood_pinctrl_of_match, &pdev->dev); | 460 | of_match_device(kirkwood_pinctrl_of_match, &pdev->dev); |
| 461 | pdev->dev.platform_data = match->data; | 461 | pdev->dev.platform_data = (void *)match->data; |
| 462 | return mvebu_pinctrl_probe(pdev); | 462 | return mvebu_pinctrl_probe(pdev); |
| 463 | } | 463 | } |
| 464 | 464 | ||
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c index de05b64f0da6..142729914c34 100644 --- a/drivers/pinctrl/pinctrl-exynos5440.c +++ b/drivers/pinctrl/pinctrl-exynos5440.c | |||
| @@ -599,7 +599,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse | |||
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | /* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */ | 601 | /* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */ |
| 602 | static int __init exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev, | 602 | static int exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev, |
| 603 | struct device_node *cfg_np, unsigned int **pin_list, | 603 | struct device_node *cfg_np, unsigned int **pin_list, |
| 604 | unsigned int *npins) | 604 | unsigned int *npins) |
| 605 | { | 605 | { |
| @@ -630,7 +630,7 @@ static int __init exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev, | |||
| 630 | * Parse the information about all the available pin groups and pin functions | 630 | * Parse the information about all the available pin groups and pin functions |
| 631 | * from device node of the pin-controller. | 631 | * from device node of the pin-controller. |
| 632 | */ | 632 | */ |
| 633 | static int __init exynos5440_pinctrl_parse_dt(struct platform_device *pdev, | 633 | static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev, |
| 634 | struct exynos5440_pinctrl_priv_data *priv) | 634 | struct exynos5440_pinctrl_priv_data *priv) |
| 635 | { | 635 | { |
| 636 | struct device *dev = &pdev->dev; | 636 | struct device *dev = &pdev->dev; |
| @@ -723,7 +723,7 @@ static int __init exynos5440_pinctrl_parse_dt(struct platform_device *pdev, | |||
| 723 | } | 723 | } |
| 724 | 724 | ||
| 725 | /* register the pinctrl interface with the pinctrl subsystem */ | 725 | /* register the pinctrl interface with the pinctrl subsystem */ |
| 726 | static int __init exynos5440_pinctrl_register(struct platform_device *pdev, | 726 | static int exynos5440_pinctrl_register(struct platform_device *pdev, |
| 727 | struct exynos5440_pinctrl_priv_data *priv) | 727 | struct exynos5440_pinctrl_priv_data *priv) |
| 728 | { | 728 | { |
| 729 | struct device *dev = &pdev->dev; | 729 | struct device *dev = &pdev->dev; |
| @@ -798,7 +798,7 @@ static int __init exynos5440_pinctrl_register(struct platform_device *pdev, | |||
| 798 | } | 798 | } |
| 799 | 799 | ||
| 800 | /* register the gpiolib interface with the gpiolib subsystem */ | 800 | /* register the gpiolib interface with the gpiolib subsystem */ |
| 801 | static int __init exynos5440_gpiolib_register(struct platform_device *pdev, | 801 | static int exynos5440_gpiolib_register(struct platform_device *pdev, |
| 802 | struct exynos5440_pinctrl_priv_data *priv) | 802 | struct exynos5440_pinctrl_priv_data *priv) |
| 803 | { | 803 | { |
| 804 | struct gpio_chip *gc; | 804 | struct gpio_chip *gc; |
| @@ -831,7 +831,7 @@ static int __init exynos5440_gpiolib_register(struct platform_device *pdev, | |||
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | /* unregister the gpiolib interface with the gpiolib subsystem */ | 833 | /* unregister the gpiolib interface with the gpiolib subsystem */ |
| 834 | static int __init exynos5440_gpiolib_unregister(struct platform_device *pdev, | 834 | static int exynos5440_gpiolib_unregister(struct platform_device *pdev, |
| 835 | struct exynos5440_pinctrl_priv_data *priv) | 835 | struct exynos5440_pinctrl_priv_data *priv) |
| 836 | { | 836 | { |
| 837 | int ret = gpiochip_remove(priv->gc); | 837 | int ret = gpiochip_remove(priv->gc); |
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c index dd227d21dcf2..23af9f1f9c35 100644 --- a/drivers/pinctrl/pinctrl-mxs.c +++ b/drivers/pinctrl/pinctrl-mxs.c | |||
| @@ -146,7 +146,7 @@ free: | |||
| 146 | static void mxs_dt_free_map(struct pinctrl_dev *pctldev, | 146 | static void mxs_dt_free_map(struct pinctrl_dev *pctldev, |
| 147 | struct pinctrl_map *map, unsigned num_maps) | 147 | struct pinctrl_map *map, unsigned num_maps) |
| 148 | { | 148 | { |
| 149 | int i; | 149 | u32 i; |
| 150 | 150 | ||
| 151 | for (i = 0; i < num_maps; i++) { | 151 | for (i = 0; i < num_maps; i++) { |
| 152 | if (map[i].type == PIN_MAP_TYPE_MUX_GROUP) | 152 | if (map[i].type == PIN_MAP_TYPE_MUX_GROUP) |
| @@ -203,7 +203,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector, | |||
| 203 | void __iomem *reg; | 203 | void __iomem *reg; |
| 204 | u8 bank, shift; | 204 | u8 bank, shift; |
| 205 | u16 pin; | 205 | u16 pin; |
| 206 | int i; | 206 | u32 i; |
| 207 | 207 | ||
| 208 | for (i = 0; i < g->npins; i++) { | 208 | for (i = 0; i < g->npins; i++) { |
| 209 | bank = PINID_TO_BANK(g->pins[i]); | 209 | bank = PINID_TO_BANK(g->pins[i]); |
| @@ -256,7 +256,7 @@ static int mxs_pinconf_group_set(struct pinctrl_dev *pctldev, | |||
| 256 | void __iomem *reg; | 256 | void __iomem *reg; |
| 257 | u8 ma, vol, pull, bank, shift; | 257 | u8 ma, vol, pull, bank, shift; |
| 258 | u16 pin; | 258 | u16 pin; |
| 259 | int i; | 259 | u32 i; |
| 260 | 260 | ||
| 261 | ma = CONFIG_TO_MA(config); | 261 | ma = CONFIG_TO_MA(config); |
| 262 | vol = CONFIG_TO_VOL(config); | 262 | vol = CONFIG_TO_VOL(config); |
| @@ -345,8 +345,7 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev, | |||
| 345 | const char *propname = "fsl,pinmux-ids"; | 345 | const char *propname = "fsl,pinmux-ids"; |
| 346 | char *group; | 346 | char *group; |
| 347 | int length = strlen(np->name) + SUFFIX_LEN; | 347 | int length = strlen(np->name) + SUFFIX_LEN; |
| 348 | int i; | 348 | u32 val, i; |
| 349 | u32 val; | ||
| 350 | 349 | ||
| 351 | group = devm_kzalloc(&pdev->dev, length, GFP_KERNEL); | 350 | group = devm_kzalloc(&pdev->dev, length, GFP_KERNEL); |
| 352 | if (!group) | 351 | if (!group) |
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 1bb16ffb4e41..5767b18ebdff 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
| @@ -676,7 +676,7 @@ int nmk_gpio_set_mode(int gpio, int gpio_mode) | |||
| 676 | } | 676 | } |
| 677 | EXPORT_SYMBOL(nmk_gpio_set_mode); | 677 | EXPORT_SYMBOL(nmk_gpio_set_mode); |
| 678 | 678 | ||
| 679 | static int nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio) | 679 | static int __maybe_unused nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio) |
| 680 | { | 680 | { |
| 681 | int i; | 681 | int i; |
| 682 | u16 reg; | 682 | u16 reg; |
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index f6a360b86eb6..5c32e880bcb2 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #define PCS_MUX_BITS_NAME "pinctrl-single,bits" | 30 | #define PCS_MUX_BITS_NAME "pinctrl-single,bits" |
| 31 | #define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1) | 31 | #define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1) |
| 32 | #define PCS_OFF_DISABLED ~0U | 32 | #define PCS_OFF_DISABLED ~0U |
| 33 | #define PCS_MAX_GPIO_VALUES 2 | ||
| 34 | 33 | ||
| 35 | /** | 34 | /** |
| 36 | * struct pcs_pingroup - pingroups for a function | 35 | * struct pcs_pingroup - pingroups for a function |
| @@ -78,16 +77,6 @@ struct pcs_function { | |||
| 78 | }; | 77 | }; |
| 79 | 78 | ||
| 80 | /** | 79 | /** |
| 81 | * struct pcs_gpio_range - pinctrl gpio range | ||
| 82 | * @range: subrange of the GPIO number space | ||
| 83 | * @gpio_func: gpio function value in the pinmux register | ||
| 84 | */ | ||
| 85 | struct pcs_gpio_range { | ||
| 86 | struct pinctrl_gpio_range range; | ||
| 87 | int gpio_func; | ||
| 88 | }; | ||
| 89 | |||
| 90 | /** | ||
| 91 | * struct pcs_data - wrapper for data needed by pinctrl framework | 80 | * struct pcs_data - wrapper for data needed by pinctrl framework |
| 92 | * @pa: pindesc array | 81 | * @pa: pindesc array |
| 93 | * @cur: index to current element | 82 | * @cur: index to current element |
| @@ -414,26 +403,9 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector, | |||
| 414 | } | 403 | } |
| 415 | 404 | ||
| 416 | static int pcs_request_gpio(struct pinctrl_dev *pctldev, | 405 | static int pcs_request_gpio(struct pinctrl_dev *pctldev, |
| 417 | struct pinctrl_gpio_range *range, unsigned pin) | 406 | struct pinctrl_gpio_range *range, unsigned offset) |
| 418 | { | 407 | { |
| 419 | struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); | 408 | return -ENOTSUPP; |
| 420 | struct pcs_gpio_range *gpio = NULL; | ||
| 421 | int end, mux_bytes; | ||
| 422 | unsigned data; | ||
| 423 | |||
| 424 | gpio = container_of(range, struct pcs_gpio_range, range); | ||
| 425 | end = range->pin_base + range->npins - 1; | ||
| 426 | if (pin < range->pin_base || pin > end) { | ||
| 427 | dev_err(pctldev->dev, | ||
| 428 | "pin %d isn't in the range of %d to %d\n", | ||
| 429 | pin, range->pin_base, end); | ||
| 430 | return -EINVAL; | ||
| 431 | } | ||
| 432 | mux_bytes = pcs->width / BITS_PER_BYTE; | ||
| 433 | data = pcs->read(pcs->base + pin * mux_bytes) & ~pcs->fmask; | ||
| 434 | data |= gpio->gpio_func; | ||
| 435 | pcs->write(data, pcs->base + pin * mux_bytes); | ||
| 436 | return 0; | ||
| 437 | } | 409 | } |
| 438 | 410 | ||
| 439 | static struct pinmux_ops pcs_pinmux_ops = { | 411 | static struct pinmux_ops pcs_pinmux_ops = { |
| @@ -907,49 +879,6 @@ static void pcs_free_resources(struct pcs_device *pcs) | |||
| 907 | 879 | ||
| 908 | static struct of_device_id pcs_of_match[]; | 880 | static struct of_device_id pcs_of_match[]; |
| 909 | 881 | ||
| 910 | static int pcs_add_gpio_range(struct device_node *node, struct pcs_device *pcs) | ||
| 911 | { | ||
| 912 | struct pcs_gpio_range *gpio; | ||
| 913 | struct device_node *child; | ||
| 914 | struct resource r; | ||
| 915 | const char name[] = "pinctrl-single"; | ||
| 916 | u32 gpiores[PCS_MAX_GPIO_VALUES]; | ||
| 917 | int ret, i = 0, mux_bytes = 0; | ||
| 918 | |||
| 919 | for_each_child_of_node(node, child) { | ||
| 920 | ret = of_address_to_resource(child, 0, &r); | ||
| 921 | if (ret < 0) | ||
| 922 | continue; | ||
| 923 | memset(gpiores, 0, sizeof(u32) * PCS_MAX_GPIO_VALUES); | ||
| 924 | ret = of_property_read_u32_array(child, "pinctrl-single,gpio", | ||
| 925 | gpiores, PCS_MAX_GPIO_VALUES); | ||
| 926 | if (ret < 0) | ||
| 927 | continue; | ||
| 928 | gpio = devm_kzalloc(pcs->dev, sizeof(*gpio), GFP_KERNEL); | ||
| 929 | if (!gpio) { | ||
| 930 | dev_err(pcs->dev, "failed to allocate pcs gpio\n"); | ||
| 931 | return -ENOMEM; | ||
| 932 | } | ||
| 933 | gpio->range.name = devm_kzalloc(pcs->dev, sizeof(name), | ||
| 934 | GFP_KERNEL); | ||
| 935 | if (!gpio->range.name) { | ||
| 936 | dev_err(pcs->dev, "failed to allocate range name\n"); | ||
| 937 | return -ENOMEM; | ||
| 938 | } | ||
| 939 | memcpy((char *)gpio->range.name, name, sizeof(name)); | ||
| 940 | |||
| 941 | gpio->range.id = i++; | ||
| 942 | gpio->range.base = gpiores[0]; | ||
| 943 | gpio->gpio_func = gpiores[1]; | ||
| 944 | mux_bytes = pcs->width / BITS_PER_BYTE; | ||
| 945 | gpio->range.pin_base = (r.start - pcs->res->start) / mux_bytes; | ||
| 946 | gpio->range.npins = (r.end - r.start) / mux_bytes + 1; | ||
| 947 | |||
| 948 | pinctrl_add_gpio_range(pcs->pctl, &gpio->range); | ||
| 949 | } | ||
| 950 | return 0; | ||
| 951 | } | ||
| 952 | |||
| 953 | static int pcs_probe(struct platform_device *pdev) | 882 | static int pcs_probe(struct platform_device *pdev) |
| 954 | { | 883 | { |
| 955 | struct device_node *np = pdev->dev.of_node; | 884 | struct device_node *np = pdev->dev.of_node; |
| @@ -1046,10 +975,6 @@ static int pcs_probe(struct platform_device *pdev) | |||
| 1046 | goto free; | 975 | goto free; |
| 1047 | } | 976 | } |
| 1048 | 977 | ||
| 1049 | ret = pcs_add_gpio_range(np, pcs); | ||
| 1050 | if (ret < 0) | ||
| 1051 | goto free; | ||
| 1052 | |||
| 1053 | dev_info(pcs->dev, "%i pins at pa %p size %u\n", | 978 | dev_info(pcs->dev, "%i pins at pa %p size %u\n", |
| 1054 | pcs->desc.npins, pcs->base, pcs->size); | 979 | pcs->desc.npins, pcs->base, pcs->size); |
| 1055 | 980 | ||
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c index 498b2ba905de..d02498b30c6e 100644 --- a/drivers/pinctrl/pinctrl-sirf.c +++ b/drivers/pinctrl/pinctrl-sirf.c | |||
| @@ -1246,6 +1246,22 @@ static void __iomem *sirfsoc_rsc_of_iomap(void) | |||
| 1246 | return of_iomap(np, 0); | 1246 | return of_iomap(np, 0); |
| 1247 | } | 1247 | } |
| 1248 | 1248 | ||
| 1249 | static int sirfsoc_gpio_of_xlate(struct gpio_chip *gc, | ||
| 1250 | const struct of_phandle_args *gpiospec, | ||
| 1251 | u32 *flags) | ||
| 1252 | { | ||
| 1253 | if (gpiospec->args[0] > SIRFSOC_GPIO_NO_OF_BANKS * SIRFSOC_GPIO_BANK_SIZE) | ||
| 1254 | return -EINVAL; | ||
| 1255 | |||
| 1256 | if (gc != &sgpio_bank[gpiospec->args[0] / SIRFSOC_GPIO_BANK_SIZE].chip.gc) | ||
| 1257 | return -EINVAL; | ||
| 1258 | |||
| 1259 | if (flags) | ||
| 1260 | *flags = gpiospec->args[1]; | ||
| 1261 | |||
| 1262 | return gpiospec->args[0] % SIRFSOC_GPIO_BANK_SIZE; | ||
| 1263 | } | ||
| 1264 | |||
| 1249 | static int sirfsoc_pinmux_probe(struct platform_device *pdev) | 1265 | static int sirfsoc_pinmux_probe(struct platform_device *pdev) |
| 1250 | { | 1266 | { |
| 1251 | int ret; | 1267 | int ret; |
| @@ -1736,6 +1752,8 @@ static int sirfsoc_gpio_probe(struct device_node *np) | |||
| 1736 | bank->chip.gc.ngpio = SIRFSOC_GPIO_BANK_SIZE; | 1752 | bank->chip.gc.ngpio = SIRFSOC_GPIO_BANK_SIZE; |
| 1737 | bank->chip.gc.label = kstrdup(np->full_name, GFP_KERNEL); | 1753 | bank->chip.gc.label = kstrdup(np->full_name, GFP_KERNEL); |
| 1738 | bank->chip.gc.of_node = np; | 1754 | bank->chip.gc.of_node = np; |
| 1755 | bank->chip.gc.of_xlate = sirfsoc_gpio_of_xlate; | ||
| 1756 | bank->chip.gc.of_gpio_n_cells = 2; | ||
| 1739 | bank->chip.regs = regs; | 1757 | bank->chip.regs = regs; |
| 1740 | bank->id = i; | 1758 | bank->id = i; |
| 1741 | bank->is_marco = is_marco; | 1759 | bank->is_marco = is_marco; |
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c index 7481146a5b47..97c2be195efc 100644 --- a/drivers/platform/x86/ibm_rtl.c +++ b/drivers/platform/x86/ibm_rtl.c | |||
| @@ -244,7 +244,7 @@ static int __init ibm_rtl_init(void) { | |||
| 244 | if (force) | 244 | if (force) |
| 245 | pr_warn("module loaded by force\n"); | 245 | pr_warn("module loaded by force\n"); |
| 246 | /* first ensure that we are running on IBM HW */ | 246 | /* first ensure that we are running on IBM HW */ |
| 247 | else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table)) | 247 | else if (efi_enabled(EFI_BOOT) || !dmi_check_system(ibm_rtl_dmi_table)) |
| 248 | return -ENODEV; | 248 | return -ENODEV; |
| 249 | 249 | ||
| 250 | /* Get the address for the Extended BIOS Data Area */ | 250 | /* Get the address for the Extended BIOS Data Area */ |
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index 71623a2ff3e8..d1f030053176 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/seq_file.h> | 26 | #include <linux/seq_file.h> |
| 27 | #include <linux/debugfs.h> | 27 | #include <linux/debugfs.h> |
| 28 | #include <linux/ctype.h> | 28 | #include <linux/ctype.h> |
| 29 | #include <linux/efi.h> | ||
| 29 | #include <acpi/video.h> | 30 | #include <acpi/video.h> |
| 30 | 31 | ||
| 31 | /* | 32 | /* |
| @@ -1544,6 +1545,9 @@ static int __init samsung_init(void) | |||
| 1544 | struct samsung_laptop *samsung; | 1545 | struct samsung_laptop *samsung; |
| 1545 | int ret; | 1546 | int ret; |
| 1546 | 1547 | ||
| 1548 | if (efi_enabled(EFI_BOOT)) | ||
| 1549 | return -ENODEV; | ||
| 1550 | |||
| 1547 | quirks = &samsung_unknown; | 1551 | quirks = &samsung_unknown; |
| 1548 | if (!force && !dmi_check_system(samsung_dmi_table)) | 1552 | if (!force && !dmi_check_system(samsung_dmi_table)) |
| 1549 | return -ENODEV; | 1553 | return -ENODEV; |
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c index 261f3d2299bc..89bd2faaef8c 100644 --- a/drivers/regulator/dbx500-prcmu.c +++ b/drivers/regulator/dbx500-prcmu.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/debugfs.h> | 14 | #include <linux/debugfs.h> |
| 15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #include <linux/module.h> | ||
| 17 | 18 | ||
| 18 | #include "dbx500-prcmu.h" | 19 | #include "dbx500-prcmu.h" |
| 19 | 20 | ||
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index b85040caaea3..cca18a3c0294 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
| @@ -379,9 +379,10 @@ static struct regulator_desc regulators[] = { | |||
| 379 | }; | 379 | }; |
| 380 | 380 | ||
| 381 | #ifdef CONFIG_OF | 381 | #ifdef CONFIG_OF |
| 382 | static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | 382 | static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, |
| 383 | struct max77686_platform_data *pdata) | 383 | struct max77686_platform_data *pdata) |
| 384 | { | 384 | { |
| 385 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); | ||
| 385 | struct device_node *pmic_np, *regulators_np; | 386 | struct device_node *pmic_np, *regulators_np; |
| 386 | struct max77686_regulator_data *rdata; | 387 | struct max77686_regulator_data *rdata; |
| 387 | struct of_regulator_match rmatch; | 388 | struct of_regulator_match rmatch; |
| @@ -390,15 +391,15 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
| 390 | pmic_np = iodev->dev->of_node; | 391 | pmic_np = iodev->dev->of_node; |
| 391 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); | 392 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); |
| 392 | if (!regulators_np) { | 393 | if (!regulators_np) { |
| 393 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | 394 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
| 394 | return -EINVAL; | 395 | return -EINVAL; |
| 395 | } | 396 | } |
| 396 | 397 | ||
| 397 | pdata->num_regulators = ARRAY_SIZE(regulators); | 398 | pdata->num_regulators = ARRAY_SIZE(regulators); |
| 398 | rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * | 399 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
| 399 | pdata->num_regulators, GFP_KERNEL); | 400 | pdata->num_regulators, GFP_KERNEL); |
| 400 | if (!rdata) { | 401 | if (!rdata) { |
| 401 | dev_err(iodev->dev, | 402 | dev_err(&pdev->dev, |
| 402 | "could not allocate memory for regulator data\n"); | 403 | "could not allocate memory for regulator data\n"); |
| 403 | return -ENOMEM; | 404 | return -ENOMEM; |
| 404 | } | 405 | } |
| @@ -407,7 +408,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
| 407 | rmatch.name = regulators[i].name; | 408 | rmatch.name = regulators[i].name; |
| 408 | rmatch.init_data = NULL; | 409 | rmatch.init_data = NULL; |
| 409 | rmatch.of_node = NULL; | 410 | rmatch.of_node = NULL; |
| 410 | of_regulator_match(iodev->dev, regulators_np, &rmatch, 1); | 411 | of_regulator_match(&pdev->dev, regulators_np, &rmatch, 1); |
| 411 | rdata[i].initdata = rmatch.init_data; | 412 | rdata[i].initdata = rmatch.init_data; |
| 412 | rdata[i].of_node = rmatch.of_node; | 413 | rdata[i].of_node = rmatch.of_node; |
| 413 | } | 414 | } |
| @@ -417,7 +418,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
| 417 | return 0; | 418 | return 0; |
| 418 | } | 419 | } |
| 419 | #else | 420 | #else |
| 420 | static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | 421 | static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, |
| 421 | struct max77686_platform_data *pdata) | 422 | struct max77686_platform_data *pdata) |
| 422 | { | 423 | { |
| 423 | return 0; | 424 | return 0; |
| @@ -440,7 +441,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) | |||
| 440 | } | 441 | } |
| 441 | 442 | ||
| 442 | if (iodev->dev->of_node) { | 443 | if (iodev->dev->of_node) { |
| 443 | ret = max77686_pmic_dt_parse_pdata(iodev, pdata); | 444 | ret = max77686_pmic_dt_parse_pdata(pdev, pdata); |
| 444 | if (ret) | 445 | if (ret) |
| 445 | return ret; | 446 | return ret; |
| 446 | } | 447 | } |
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index d1a77512d83e..d40cf7fdb546 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
| @@ -237,8 +237,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
| 237 | return -EINVAL; | 237 | return -EINVAL; |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | ret = of_regulator_match(pdev->dev.parent, regulators, | 240 | ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, |
| 241 | max8907_matches, | ||
| 242 | ARRAY_SIZE(max8907_matches)); | 241 | ARRAY_SIZE(max8907_matches)); |
| 243 | if (ret < 0) { | 242 | if (ret < 0) { |
| 244 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 243 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 02be7fcae32f..836908ce505e 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
| @@ -934,7 +934,7 @@ static struct regulator_desc regulators[] = { | |||
| 934 | }; | 934 | }; |
| 935 | 935 | ||
| 936 | #ifdef CONFIG_OF | 936 | #ifdef CONFIG_OF |
| 937 | static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, | 937 | static int max8997_pmic_dt_parse_dvs_gpio(struct platform_device *pdev, |
| 938 | struct max8997_platform_data *pdata, | 938 | struct max8997_platform_data *pdata, |
| 939 | struct device_node *pmic_np) | 939 | struct device_node *pmic_np) |
| 940 | { | 940 | { |
| @@ -944,7 +944,7 @@ static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, | |||
| 944 | gpio = of_get_named_gpio(pmic_np, | 944 | gpio = of_get_named_gpio(pmic_np, |
| 945 | "max8997,pmic-buck125-dvs-gpios", i); | 945 | "max8997,pmic-buck125-dvs-gpios", i); |
| 946 | if (!gpio_is_valid(gpio)) { | 946 | if (!gpio_is_valid(gpio)) { |
| 947 | dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio); | 947 | dev_err(&pdev->dev, "invalid gpio[%d]: %d\n", i, gpio); |
| 948 | return -EINVAL; | 948 | return -EINVAL; |
| 949 | } | 949 | } |
| 950 | pdata->buck125_gpios[i] = gpio; | 950 | pdata->buck125_gpios[i] = gpio; |
| @@ -952,22 +952,23 @@ static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, | |||
| 952 | return 0; | 952 | return 0; |
| 953 | } | 953 | } |
| 954 | 954 | ||
| 955 | static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | 955 | static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, |
| 956 | struct max8997_platform_data *pdata) | 956 | struct max8997_platform_data *pdata) |
| 957 | { | 957 | { |
| 958 | struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); | ||
| 958 | struct device_node *pmic_np, *regulators_np, *reg_np; | 959 | struct device_node *pmic_np, *regulators_np, *reg_np; |
| 959 | struct max8997_regulator_data *rdata; | 960 | struct max8997_regulator_data *rdata; |
| 960 | unsigned int i, dvs_voltage_nr = 1, ret; | 961 | unsigned int i, dvs_voltage_nr = 1, ret; |
| 961 | 962 | ||
| 962 | pmic_np = iodev->dev->of_node; | 963 | pmic_np = iodev->dev->of_node; |
| 963 | if (!pmic_np) { | 964 | if (!pmic_np) { |
| 964 | dev_err(iodev->dev, "could not find pmic sub-node\n"); | 965 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
| 965 | return -ENODEV; | 966 | return -ENODEV; |
| 966 | } | 967 | } |
| 967 | 968 | ||
| 968 | regulators_np = of_find_node_by_name(pmic_np, "regulators"); | 969 | regulators_np = of_find_node_by_name(pmic_np, "regulators"); |
| 969 | if (!regulators_np) { | 970 | if (!regulators_np) { |
| 970 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | 971 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
| 971 | return -EINVAL; | 972 | return -EINVAL; |
| 972 | } | 973 | } |
| 973 | 974 | ||
| @@ -976,11 +977,10 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
| 976 | for_each_child_of_node(regulators_np, reg_np) | 977 | for_each_child_of_node(regulators_np, reg_np) |
| 977 | pdata->num_regulators++; | 978 | pdata->num_regulators++; |
| 978 | 979 | ||
| 979 | rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * | 980 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
| 980 | pdata->num_regulators, GFP_KERNEL); | 981 | pdata->num_regulators, GFP_KERNEL); |
| 981 | if (!rdata) { | 982 | if (!rdata) { |
| 982 | dev_err(iodev->dev, "could not allocate memory for " | 983 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); |
| 983 | "regulator data\n"); | ||
| 984 | return -ENOMEM; | 984 | return -ENOMEM; |
| 985 | } | 985 | } |
| 986 | 986 | ||
| @@ -991,14 +991,14 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
| 991 | break; | 991 | break; |
| 992 | 992 | ||
| 993 | if (i == ARRAY_SIZE(regulators)) { | 993 | if (i == ARRAY_SIZE(regulators)) { |
| 994 | dev_warn(iodev->dev, "don't know how to configure " | 994 | dev_warn(&pdev->dev, "don't know how to configure regulator %s\n", |
| 995 | "regulator %s\n", reg_np->name); | 995 | reg_np->name); |
| 996 | continue; | 996 | continue; |
| 997 | } | 997 | } |
| 998 | 998 | ||
| 999 | rdata->id = i; | 999 | rdata->id = i; |
| 1000 | rdata->initdata = of_get_regulator_init_data( | 1000 | rdata->initdata = of_get_regulator_init_data(&pdev->dev, |
| 1001 | iodev->dev, reg_np); | 1001 | reg_np); |
| 1002 | rdata->reg_node = reg_np; | 1002 | rdata->reg_node = reg_np; |
| 1003 | rdata++; | 1003 | rdata++; |
| 1004 | } | 1004 | } |
| @@ -1014,7 +1014,7 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
| 1014 | 1014 | ||
| 1015 | if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || | 1015 | if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || |
| 1016 | pdata->buck5_gpiodvs) { | 1016 | pdata->buck5_gpiodvs) { |
| 1017 | ret = max8997_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np); | 1017 | ret = max8997_pmic_dt_parse_dvs_gpio(pdev, pdata, pmic_np); |
| 1018 | if (ret) | 1018 | if (ret) |
| 1019 | return -EINVAL; | 1019 | return -EINVAL; |
| 1020 | 1020 | ||
| @@ -1025,8 +1025,7 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
| 1025 | } else { | 1025 | } else { |
| 1026 | if (pdata->buck125_default_idx >= 8) { | 1026 | if (pdata->buck125_default_idx >= 8) { |
| 1027 | pdata->buck125_default_idx = 0; | 1027 | pdata->buck125_default_idx = 0; |
| 1028 | dev_info(iodev->dev, "invalid value for " | 1028 | dev_info(&pdev->dev, "invalid value for default dvs index, using 0 instead\n"); |
| 1029 | "default dvs index, using 0 instead\n"); | ||
| 1030 | } | 1029 | } |
| 1031 | } | 1030 | } |
| 1032 | 1031 | ||
| @@ -1040,28 +1039,28 @@ static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | |||
| 1040 | if (of_property_read_u32_array(pmic_np, | 1039 | if (of_property_read_u32_array(pmic_np, |
| 1041 | "max8997,pmic-buck1-dvs-voltage", | 1040 | "max8997,pmic-buck1-dvs-voltage", |
| 1042 | pdata->buck1_voltage, dvs_voltage_nr)) { | 1041 | pdata->buck1_voltage, dvs_voltage_nr)) { |
| 1043 | dev_err(iodev->dev, "buck1 voltages not specified\n"); | 1042 | dev_err(&pdev->dev, "buck1 voltages not specified\n"); |
| 1044 | return -EINVAL; | 1043 | return -EINVAL; |
| 1045 | } | 1044 | } |
| 1046 | 1045 | ||
| 1047 | if (of_property_read_u32_array(pmic_np, | 1046 | if (of_property_read_u32_array(pmic_np, |
| 1048 | "max8997,pmic-buck2-dvs-voltage", | 1047 | "max8997,pmic-buck2-dvs-voltage", |
| 1049 | pdata->buck2_voltage, dvs_voltage_nr)) { | 1048 | pdata->buck2_voltage, dvs_voltage_nr)) { |
| 1050 | dev_err(iodev->dev, "buck2 voltages not specified\n"); | 1049 | dev_err(&pdev->dev, "buck2 voltages not specified\n"); |
| 1051 | return -EINVAL; | 1050 | return -EINVAL; |
| 1052 | } | 1051 | } |
| 1053 | 1052 | ||
| 1054 | if (of_property_read_u32_array(pmic_np, | 1053 | if (of_property_read_u32_array(pmic_np, |
| 1055 | "max8997,pmic-buck5-dvs-voltage", | 1054 | "max8997,pmic-buck5-dvs-voltage", |
| 1056 | pdata->buck5_voltage, dvs_voltage_nr)) { | 1055 | pdata->buck5_voltage, dvs_voltage_nr)) { |
| 1057 | dev_err(iodev->dev, "buck5 voltages not specified\n"); | 1056 | dev_err(&pdev->dev, "buck5 voltages not specified\n"); |
| 1058 | return -EINVAL; | 1057 | return -EINVAL; |
| 1059 | } | 1058 | } |
| 1060 | 1059 | ||
| 1061 | return 0; | 1060 | return 0; |
| 1062 | } | 1061 | } |
| 1063 | #else | 1062 | #else |
| 1064 | static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, | 1063 | static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, |
| 1065 | struct max8997_platform_data *pdata) | 1064 | struct max8997_platform_data *pdata) |
| 1066 | { | 1065 | { |
| 1067 | return 0; | 1066 | return 0; |
| @@ -1085,7 +1084,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) | |||
| 1085 | } | 1084 | } |
| 1086 | 1085 | ||
| 1087 | if (iodev->dev->of_node) { | 1086 | if (iodev->dev->of_node) { |
| 1088 | ret = max8997_pmic_dt_parse_pdata(iodev, pdata); | 1087 | ret = max8997_pmic_dt_parse_pdata(pdev, pdata); |
| 1089 | if (ret) | 1088 | if (ret) |
| 1090 | return ret; | 1089 | return ret; |
| 1091 | } | 1090 | } |
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 1f0df4046b86..0a8dd1cbee6f 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
| @@ -65,7 +65,7 @@ static const struct voltage_map_desc ldo9_voltage_map_desc = { | |||
| 65 | .min = 2800000, .step = 100000, .max = 3100000, | 65 | .min = 2800000, .step = 100000, .max = 3100000, |
| 66 | }; | 66 | }; |
| 67 | static const struct voltage_map_desc ldo10_voltage_map_desc = { | 67 | static const struct voltage_map_desc ldo10_voltage_map_desc = { |
| 68 | .min = 95000, .step = 50000, .max = 1300000, | 68 | .min = 950000, .step = 50000, .max = 1300000, |
| 69 | }; | 69 | }; |
| 70 | static const struct voltage_map_desc ldo1213_voltage_map_desc = { | 70 | static const struct voltage_map_desc ldo1213_voltage_map_desc = { |
| 71 | .min = 800000, .step = 100000, .max = 3300000, | 71 | .min = 800000, .step = 100000, .max = 3300000, |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 6f684916fd79..66ca769287ab 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
| @@ -120,6 +120,12 @@ int of_regulator_match(struct device *dev, struct device_node *node, | |||
| 120 | if (!dev || !node) | 120 | if (!dev || !node) |
| 121 | return -EINVAL; | 121 | return -EINVAL; |
| 122 | 122 | ||
| 123 | for (i = 0; i < num_matches; i++) { | ||
| 124 | struct of_regulator_match *match = &matches[i]; | ||
| 125 | match->init_data = NULL; | ||
| 126 | match->of_node = NULL; | ||
| 127 | } | ||
| 128 | |||
| 123 | for_each_child_of_node(node, child) { | 129 | for_each_child_of_node(node, child) { |
| 124 | name = of_get_property(child, | 130 | name = of_get_property(child, |
| 125 | "regulator-compatible", NULL); | 131 | "regulator-compatible", NULL); |
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index bd062a2ffbe2..cd9ea2ea1826 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
| @@ -174,9 +174,9 @@ static struct regulator_ops s2mps11_buck_ops = { | |||
| 174 | .min_uV = S2MPS11_BUCK_MIN2, \ | 174 | .min_uV = S2MPS11_BUCK_MIN2, \ |
| 175 | .uV_step = S2MPS11_BUCK_STEP2, \ | 175 | .uV_step = S2MPS11_BUCK_STEP2, \ |
| 176 | .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ | 176 | .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ |
| 177 | .vsel_reg = S2MPS11_REG_B9CTRL2, \ | 177 | .vsel_reg = S2MPS11_REG_B10CTRL2, \ |
| 178 | .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \ | 178 | .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \ |
| 179 | .enable_reg = S2MPS11_REG_B9CTRL1, \ | 179 | .enable_reg = S2MPS11_REG_B10CTRL1, \ |
| 180 | .enable_mask = S2MPS11_ENABLE_MASK \ | 180 | .enable_mask = S2MPS11_ENABLE_MASK \ |
| 181 | } | 181 | } |
| 182 | 182 | ||
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index 73dce7664126..df395187c063 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c | |||
| @@ -305,8 +305,8 @@ static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) | |||
| 305 | if (!regs) | 305 | if (!regs) |
| 306 | return NULL; | 306 | return NULL; |
| 307 | 307 | ||
| 308 | count = of_regulator_match(pdev->dev.parent, regs, | 308 | count = of_regulator_match(&pdev->dev, regs, reg_matches, |
| 309 | reg_matches, TPS65217_NUM_REGULATOR); | 309 | TPS65217_NUM_REGULATOR); |
| 310 | of_node_put(regs); | 310 | of_node_put(regs); |
| 311 | if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) | 311 | if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) |
| 312 | return NULL; | 312 | return NULL; |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 59c3770fa77d..b0e4c0bc85c3 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
| @@ -998,7 +998,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
| 998 | return NULL; | 998 | return NULL; |
| 999 | } | 999 | } |
| 1000 | 1000 | ||
| 1001 | ret = of_regulator_match(pdev->dev.parent, regulators, matches, count); | 1001 | ret = of_regulator_match(&pdev->dev, regulators, matches, count); |
| 1002 | if (ret < 0) { | 1002 | if (ret < 0) { |
| 1003 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 1003 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
| 1004 | ret); | 1004 | ret); |
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index b15d711bc8c6..9019d0e7ecb6 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c | |||
| @@ -728,7 +728,7 @@ static int tps80031_regulator_probe(struct platform_device *pdev) | |||
| 728 | } | 728 | } |
| 729 | } | 729 | } |
| 730 | rdev = regulator_register(&ri->rinfo->desc, &config); | 730 | rdev = regulator_register(&ri->rinfo->desc, &config); |
| 731 | if (IS_ERR_OR_NULL(rdev)) { | 731 | if (IS_ERR(rdev)) { |
| 732 | dev_err(&pdev->dev, | 732 | dev_err(&pdev->dev, |
| 733 | "register regulator failed %s\n", | 733 | "register regulator failed %s\n", |
| 734 | ri->rinfo->desc.name); | 734 | ri->rinfo->desc.name); |
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index afb7cfa85ccc..c016ad81767a 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c | |||
| @@ -506,6 +506,7 @@ isl1208_rtc_interrupt(int irq, void *data) | |||
| 506 | { | 506 | { |
| 507 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | 507 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
| 508 | struct i2c_client *client = data; | 508 | struct i2c_client *client = data; |
| 509 | struct rtc_device *rtc = i2c_get_clientdata(client); | ||
| 509 | int handled = 0, sr, err; | 510 | int handled = 0, sr, err; |
| 510 | 511 | ||
| 511 | /* | 512 | /* |
| @@ -528,6 +529,8 @@ isl1208_rtc_interrupt(int irq, void *data) | |||
| 528 | if (sr & ISL1208_REG_SR_ALM) { | 529 | if (sr & ISL1208_REG_SR_ALM) { |
| 529 | dev_dbg(&client->dev, "alarm!\n"); | 530 | dev_dbg(&client->dev, "alarm!\n"); |
| 530 | 531 | ||
| 532 | rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF); | ||
| 533 | |||
| 531 | /* Clear the alarm */ | 534 | /* Clear the alarm */ |
| 532 | sr &= ~ISL1208_REG_SR_ALM; | 535 | sr &= ~ISL1208_REG_SR_ALM; |
| 533 | sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr); | 536 | sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr); |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 08378e3cc21c..10c1a3454e48 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #define RTC_YMR 0x34 /* Year match register */ | 44 | #define RTC_YMR 0x34 /* Year match register */ |
| 45 | #define RTC_YLR 0x38 /* Year data load register */ | 45 | #define RTC_YLR 0x38 /* Year data load register */ |
| 46 | 46 | ||
| 47 | #define RTC_CR_EN (1 << 0) /* counter enable bit */ | ||
| 47 | #define RTC_CR_CWEN (1 << 26) /* Clockwatch enable bit */ | 48 | #define RTC_CR_CWEN (1 << 26) /* Clockwatch enable bit */ |
| 48 | 49 | ||
| 49 | #define RTC_TCR_EN (1 << 1) /* Periodic timer enable bit */ | 50 | #define RTC_TCR_EN (1 << 1) /* Periodic timer enable bit */ |
| @@ -320,7 +321,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
| 320 | struct pl031_local *ldata; | 321 | struct pl031_local *ldata; |
| 321 | struct pl031_vendor_data *vendor = id->data; | 322 | struct pl031_vendor_data *vendor = id->data; |
| 322 | struct rtc_class_ops *ops = &vendor->ops; | 323 | struct rtc_class_ops *ops = &vendor->ops; |
| 323 | unsigned long time; | 324 | unsigned long time, data; |
| 324 | 325 | ||
| 325 | ret = amba_request_regions(adev, NULL); | 326 | ret = amba_request_regions(adev, NULL); |
| 326 | if (ret) | 327 | if (ret) |
| @@ -345,10 +346,11 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
| 345 | dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev)); | 346 | dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev)); |
| 346 | dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev)); | 347 | dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev)); |
| 347 | 348 | ||
| 349 | data = readl(ldata->base + RTC_CR); | ||
| 348 | /* Enable the clockwatch on ST Variants */ | 350 | /* Enable the clockwatch on ST Variants */ |
| 349 | if (vendor->clockwatch) | 351 | if (vendor->clockwatch) |
| 350 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 352 | data |= RTC_CR_CWEN; |
| 351 | ldata->base + RTC_CR); | 353 | writel(data | RTC_CR_EN, ldata->base + RTC_CR); |
| 352 | 354 | ||
| 353 | /* | 355 | /* |
| 354 | * On ST PL031 variants, the RTC reset value does not provide correct | 356 | * On ST PL031 variants, the RTC reset value does not provide correct |
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index 00c930f4b6f3..2730533e2d2d 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c | |||
| @@ -137,7 +137,7 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
| 137 | return -EINVAL; | 137 | return -EINVAL; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S) | 140 | writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S) |
| 141 | | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S) | 141 | | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S) |
| 142 | | (bin2bcd(tm->tm_mday)) | 142 | | (bin2bcd(tm->tm_mday)) |
| 143 | | ((tm->tm_year >= 200) << DATE_CENTURY_S), | 143 | | ((tm->tm_year >= 200) << DATE_CENTURY_S), |
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index d73fdcfeb45a..2839baa82a5a 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c | |||
| @@ -633,7 +633,7 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 633 | return -ENOMEM; | 633 | return -ENOMEM; |
| 634 | pci_set_drvdata(pdev, pci_info); | 634 | pci_set_drvdata(pdev, pci_info); |
| 635 | 635 | ||
| 636 | if (efi_enabled) | 636 | if (efi_enabled(EFI_RUNTIME_SERVICES)) |
| 637 | orom = isci_get_efi_var(pdev); | 637 | orom = isci_get_efi_var(pdev); |
| 638 | 638 | ||
| 639 | if (!orom) | 639 | if (!orom) |
diff --git a/drivers/ssb/driver_gpio.c b/drivers/ssb/driver_gpio.c index 97ac0a38e3d0..eb2753008ef0 100644 --- a/drivers/ssb/driver_gpio.c +++ b/drivers/ssb/driver_gpio.c | |||
| @@ -174,3 +174,15 @@ int ssb_gpio_init(struct ssb_bus *bus) | |||
| 174 | 174 | ||
| 175 | return -1; | 175 | return -1; |
| 176 | } | 176 | } |
| 177 | |||
| 178 | int ssb_gpio_unregister(struct ssb_bus *bus) | ||
| 179 | { | ||
| 180 | if (ssb_chipco_available(&bus->chipco) || | ||
| 181 | ssb_extif_available(&bus->extif)) { | ||
| 182 | return gpiochip_remove(&bus->gpio); | ||
| 183 | } else { | ||
| 184 | SSB_WARN_ON(1); | ||
| 185 | } | ||
| 186 | |||
| 187 | return -1; | ||
| 188 | } | ||
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 772ad9b5c304..24dc331b4701 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
| @@ -443,6 +443,15 @@ static void ssb_devices_unregister(struct ssb_bus *bus) | |||
| 443 | 443 | ||
| 444 | void ssb_bus_unregister(struct ssb_bus *bus) | 444 | void ssb_bus_unregister(struct ssb_bus *bus) |
| 445 | { | 445 | { |
| 446 | int err; | ||
| 447 | |||
| 448 | err = ssb_gpio_unregister(bus); | ||
| 449 | if (err == -EBUSY) | ||
| 450 | ssb_dprintk(KERN_ERR PFX "Some GPIOs are still in use.\n"); | ||
| 451 | else if (err) | ||
| 452 | ssb_dprintk(KERN_ERR PFX | ||
| 453 | "Can not unregister GPIO driver: %i\n", err); | ||
| 454 | |||
| 446 | ssb_buses_lock(); | 455 | ssb_buses_lock(); |
| 447 | ssb_devices_unregister(bus); | 456 | ssb_devices_unregister(bus); |
| 448 | list_del(&bus->list); | 457 | list_del(&bus->list); |
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h index 6c10b66c796c..da38305a2d22 100644 --- a/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h | |||
| @@ -252,11 +252,16 @@ static inline void ssb_extif_init(struct ssb_extif *extif) | |||
| 252 | 252 | ||
| 253 | #ifdef CONFIG_SSB_DRIVER_GPIO | 253 | #ifdef CONFIG_SSB_DRIVER_GPIO |
| 254 | extern int ssb_gpio_init(struct ssb_bus *bus); | 254 | extern int ssb_gpio_init(struct ssb_bus *bus); |
| 255 | extern int ssb_gpio_unregister(struct ssb_bus *bus); | ||
| 255 | #else /* CONFIG_SSB_DRIVER_GPIO */ | 256 | #else /* CONFIG_SSB_DRIVER_GPIO */ |
| 256 | static inline int ssb_gpio_init(struct ssb_bus *bus) | 257 | static inline int ssb_gpio_init(struct ssb_bus *bus) |
| 257 | { | 258 | { |
| 258 | return -ENOTSUPP; | 259 | return -ENOTSUPP; |
| 259 | } | 260 | } |
| 261 | static inline int ssb_gpio_unregister(struct ssb_bus *bus) | ||
| 262 | { | ||
| 263 | return 0; | ||
| 264 | } | ||
| 260 | #endif /* CONFIG_SSB_DRIVER_GPIO */ | 265 | #endif /* CONFIG_SSB_DRIVER_GPIO */ |
| 261 | 266 | ||
| 262 | #endif /* LINUX_SSB_PRIVATE_H_ */ | 267 | #endif /* LINUX_SSB_PRIVATE_H_ */ |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index e2695101bb99..f2aa7543d20a 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -941,6 +941,8 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) | |||
| 941 | 941 | ||
| 942 | int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) | 942 | int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) |
| 943 | { | 943 | { |
| 944 | int block_size = dev->dev_attrib.block_size; | ||
| 945 | |||
| 944 | if (dev->export_count) { | 946 | if (dev->export_count) { |
| 945 | pr_err("dev[%p]: Unable to change SE Device" | 947 | pr_err("dev[%p]: Unable to change SE Device" |
| 946 | " fabric_max_sectors while export_count is %d\n", | 948 | " fabric_max_sectors while export_count is %d\n", |
| @@ -978,8 +980,12 @@ int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) | |||
| 978 | /* | 980 | /* |
| 979 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() | 981 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() |
| 980 | */ | 982 | */ |
| 983 | if (!block_size) { | ||
| 984 | block_size = 512; | ||
| 985 | pr_warn("Defaulting to 512 for zero block_size\n"); | ||
| 986 | } | ||
| 981 | fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors, | 987 | fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors, |
| 982 | dev->dev_attrib.block_size); | 988 | block_size); |
| 983 | 989 | ||
| 984 | dev->dev_attrib.fabric_max_sectors = fabric_max_sectors; | 990 | dev->dev_attrib.fabric_max_sectors = fabric_max_sectors; |
| 985 | pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", | 991 | pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 810263dfa4a1..c57bbbc7a7d1 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
| @@ -754,6 +754,11 @@ static int target_fabric_port_link( | |||
| 754 | return -EFAULT; | 754 | return -EFAULT; |
| 755 | } | 755 | } |
| 756 | 756 | ||
| 757 | if (!(dev->dev_flags & DF_CONFIGURED)) { | ||
| 758 | pr_err("se_device not configured yet, cannot port link\n"); | ||
| 759 | return -ENODEV; | ||
| 760 | } | ||
| 761 | |||
| 757 | tpg_ci = &lun_ci->ci_parent->ci_group->cg_item; | 762 | tpg_ci = &lun_ci->ci_parent->ci_group->cg_item; |
| 758 | se_tpg = container_of(to_config_group(tpg_ci), | 763 | se_tpg = container_of(to_config_group(tpg_ci), |
| 759 | struct se_portal_group, tpg_group); | 764 | struct se_portal_group, tpg_group); |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 26a6d183ccb1..a664c664a31a 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
| @@ -58,11 +58,10 @@ sbc_emulate_readcapacity(struct se_cmd *cmd) | |||
| 58 | buf[7] = dev->dev_attrib.block_size & 0xff; | 58 | buf[7] = dev->dev_attrib.block_size & 0xff; |
| 59 | 59 | ||
| 60 | rbuf = transport_kmap_data_sg(cmd); | 60 | rbuf = transport_kmap_data_sg(cmd); |
| 61 | if (!rbuf) | 61 | if (rbuf) { |
| 62 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 62 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); |
| 63 | 63 | transport_kunmap_data_sg(cmd); | |
| 64 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); | 64 | } |
| 65 | transport_kunmap_data_sg(cmd); | ||
| 66 | 65 | ||
| 67 | target_complete_cmd(cmd, GOOD); | 66 | target_complete_cmd(cmd, GOOD); |
| 68 | return 0; | 67 | return 0; |
| @@ -97,11 +96,10 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd) | |||
| 97 | buf[14] = 0x80; | 96 | buf[14] = 0x80; |
| 98 | 97 | ||
| 99 | rbuf = transport_kmap_data_sg(cmd); | 98 | rbuf = transport_kmap_data_sg(cmd); |
| 100 | if (!rbuf) | 99 | if (rbuf) { |
| 101 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 100 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); |
| 102 | 101 | transport_kunmap_data_sg(cmd); | |
| 103 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); | 102 | } |
| 104 | transport_kunmap_data_sg(cmd); | ||
| 105 | 103 | ||
| 106 | target_complete_cmd(cmd, GOOD); | 104 | target_complete_cmd(cmd, GOOD); |
| 107 | return 0; | 105 | return 0; |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 84f9e96e8ace..2d88f087d961 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
| @@ -641,11 +641,10 @@ spc_emulate_inquiry(struct se_cmd *cmd) | |||
| 641 | 641 | ||
| 642 | out: | 642 | out: |
| 643 | rbuf = transport_kmap_data_sg(cmd); | 643 | rbuf = transport_kmap_data_sg(cmd); |
| 644 | if (!rbuf) | 644 | if (rbuf) { |
| 645 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 645 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); |
| 646 | 646 | transport_kunmap_data_sg(cmd); | |
| 647 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); | 647 | } |
| 648 | transport_kunmap_data_sg(cmd); | ||
| 649 | 648 | ||
| 650 | if (!ret) | 649 | if (!ret) |
| 651 | target_complete_cmd(cmd, GOOD); | 650 | target_complete_cmd(cmd, GOOD); |
| @@ -851,7 +850,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) | |||
| 851 | { | 850 | { |
| 852 | struct se_device *dev = cmd->se_dev; | 851 | struct se_device *dev = cmd->se_dev; |
| 853 | char *cdb = cmd->t_task_cdb; | 852 | char *cdb = cmd->t_task_cdb; |
| 854 | unsigned char *buf, *map_buf; | 853 | unsigned char buf[SE_MODE_PAGE_BUF], *rbuf; |
| 855 | int type = dev->transport->get_device_type(dev); | 854 | int type = dev->transport->get_device_type(dev); |
| 856 | int ten = (cmd->t_task_cdb[0] == MODE_SENSE_10); | 855 | int ten = (cmd->t_task_cdb[0] == MODE_SENSE_10); |
| 857 | bool dbd = !!(cdb[1] & 0x08); | 856 | bool dbd = !!(cdb[1] & 0x08); |
| @@ -863,26 +862,8 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) | |||
| 863 | int ret; | 862 | int ret; |
| 864 | int i; | 863 | int i; |
| 865 | 864 | ||
| 866 | map_buf = transport_kmap_data_sg(cmd); | 865 | memset(buf, 0, SE_MODE_PAGE_BUF); |
| 867 | if (!map_buf) | 866 | |
| 868 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 869 | /* | ||
| 870 | * If SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC is not set, then we | ||
| 871 | * know we actually allocated a full page. Otherwise, if the | ||
| 872 | * data buffer is too small, allocate a temporary buffer so we | ||
| 873 | * don't have to worry about overruns in all our INQUIRY | ||
| 874 | * emulation handling. | ||
| 875 | */ | ||
| 876 | if (cmd->data_length < SE_MODE_PAGE_BUF && | ||
| 877 | (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC)) { | ||
| 878 | buf = kzalloc(SE_MODE_PAGE_BUF, GFP_KERNEL); | ||
| 879 | if (!buf) { | ||
| 880 | transport_kunmap_data_sg(cmd); | ||
| 881 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 882 | } | ||
| 883 | } else { | ||
| 884 | buf = map_buf; | ||
| 885 | } | ||
| 886 | /* | 867 | /* |
| 887 | * Skip over MODE DATA LENGTH + MEDIUM TYPE fields to byte 3 for | 868 | * Skip over MODE DATA LENGTH + MEDIUM TYPE fields to byte 3 for |
| 888 | * MODE_SENSE_10 and byte 2 for MODE_SENSE (6). | 869 | * MODE_SENSE_10 and byte 2 for MODE_SENSE (6). |
| @@ -934,8 +915,6 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) | |||
| 934 | if (page == 0x3f) { | 915 | if (page == 0x3f) { |
| 935 | if (subpage != 0x00 && subpage != 0xff) { | 916 | if (subpage != 0x00 && subpage != 0xff) { |
| 936 | pr_warn("MODE_SENSE: Invalid subpage code: 0x%02x\n", subpage); | 917 | pr_warn("MODE_SENSE: Invalid subpage code: 0x%02x\n", subpage); |
| 937 | kfree(buf); | ||
| 938 | transport_kunmap_data_sg(cmd); | ||
| 939 | return TCM_INVALID_CDB_FIELD; | 918 | return TCM_INVALID_CDB_FIELD; |
| 940 | } | 919 | } |
| 941 | 920 | ||
| @@ -972,7 +951,6 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) | |||
| 972 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", | 951 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", |
| 973 | page, subpage); | 952 | page, subpage); |
| 974 | 953 | ||
| 975 | transport_kunmap_data_sg(cmd); | ||
| 976 | return TCM_UNKNOWN_MODE_PAGE; | 954 | return TCM_UNKNOWN_MODE_PAGE; |
| 977 | 955 | ||
| 978 | set_length: | 956 | set_length: |
| @@ -981,12 +959,12 @@ set_length: | |||
| 981 | else | 959 | else |
| 982 | buf[0] = length - 1; | 960 | buf[0] = length - 1; |
| 983 | 961 | ||
| 984 | if (buf != map_buf) { | 962 | rbuf = transport_kmap_data_sg(cmd); |
| 985 | memcpy(map_buf, buf, cmd->data_length); | 963 | if (rbuf) { |
| 986 | kfree(buf); | 964 | memcpy(rbuf, buf, min_t(u32, SE_MODE_PAGE_BUF, cmd->data_length)); |
| 965 | transport_kunmap_data_sg(cmd); | ||
| 987 | } | 966 | } |
| 988 | 967 | ||
| 989 | transport_kunmap_data_sg(cmd); | ||
| 990 | target_complete_cmd(cmd, GOOD); | 968 | target_complete_cmd(cmd, GOOD); |
| 991 | return 0; | 969 | return 0; |
| 992 | } | 970 | } |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 4225d5e72131..8e64adf8e4d5 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <asm/unaligned.h> | 39 | #include <asm/unaligned.h> |
| 40 | #include <linux/platform_device.h> | 40 | #include <linux/platform_device.h> |
| 41 | #include <linux/workqueue.h> | 41 | #include <linux/workqueue.h> |
| 42 | #include <linux/pm_runtime.h> | ||
| 42 | 43 | ||
| 43 | #include <linux/usb.h> | 44 | #include <linux/usb.h> |
| 44 | #include <linux/usb/hcd.h> | 45 | #include <linux/usb/hcd.h> |
| @@ -1025,6 +1026,49 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
| 1025 | return retval; | 1026 | return retval; |
| 1026 | } | 1027 | } |
| 1027 | 1028 | ||
| 1029 | /* | ||
| 1030 | * usb_hcd_start_port_resume - a root-hub port is sending a resume signal | ||
| 1031 | * @bus: the bus which the root hub belongs to | ||
| 1032 | * @portnum: the port which is being resumed | ||
| 1033 | * | ||
| 1034 | * HCDs should call this function when they know that a resume signal is | ||
| 1035 | * being sent to a root-hub port. The root hub will be prevented from | ||
| 1036 | * going into autosuspend until usb_hcd_end_port_resume() is called. | ||
| 1037 | * | ||
| 1038 | * The bus's private lock must be held by the caller. | ||
| 1039 | */ | ||
| 1040 | void usb_hcd_start_port_resume(struct usb_bus *bus, int portnum) | ||
| 1041 | { | ||
| 1042 | unsigned bit = 1 << portnum; | ||
| 1043 | |||
| 1044 | if (!(bus->resuming_ports & bit)) { | ||
| 1045 | bus->resuming_ports |= bit; | ||
| 1046 | pm_runtime_get_noresume(&bus->root_hub->dev); | ||
| 1047 | } | ||
| 1048 | } | ||
| 1049 | EXPORT_SYMBOL_GPL(usb_hcd_start_port_resume); | ||
| 1050 | |||
| 1051 | /* | ||
| 1052 | * usb_hcd_end_port_resume - a root-hub port has stopped sending a resume signal | ||
| 1053 | * @bus: the bus which the root hub belongs to | ||
| 1054 | * @portnum: the port which is being resumed | ||
| 1055 | * | ||
| 1056 | * HCDs should call this function when they know that a resume signal has | ||
| 1057 | * stopped being sent to a root-hub port. The root hub will be allowed to | ||
| 1058 | * autosuspend again. | ||
| 1059 | * | ||
| 1060 | * The bus's private lock must be held by the caller. | ||
| 1061 | */ | ||
| 1062 | void usb_hcd_end_port_resume(struct usb_bus *bus, int portnum) | ||
| 1063 | { | ||
| 1064 | unsigned bit = 1 << portnum; | ||
| 1065 | |||
| 1066 | if (bus->resuming_ports & bit) { | ||
| 1067 | bus->resuming_ports &= ~bit; | ||
| 1068 | pm_runtime_put_noidle(&bus->root_hub->dev); | ||
| 1069 | } | ||
| 1070 | } | ||
| 1071 | EXPORT_SYMBOL_GPL(usb_hcd_end_port_resume); | ||
| 1028 | 1072 | ||
| 1029 | /*-------------------------------------------------------------------------*/ | 1073 | /*-------------------------------------------------------------------------*/ |
| 1030 | 1074 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 957ed2c41482..cbf7168e3ce7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -2838,6 +2838,23 @@ void usb_enable_ltm(struct usb_device *udev) | |||
| 2838 | EXPORT_SYMBOL_GPL(usb_enable_ltm); | 2838 | EXPORT_SYMBOL_GPL(usb_enable_ltm); |
| 2839 | 2839 | ||
| 2840 | #ifdef CONFIG_USB_SUSPEND | 2840 | #ifdef CONFIG_USB_SUSPEND |
| 2841 | /* | ||
| 2842 | * usb_disable_function_remotewakeup - disable usb3.0 | ||
| 2843 | * device's function remote wakeup | ||
| 2844 | * @udev: target device | ||
| 2845 | * | ||
| 2846 | * Assume there's only one function on the USB 3.0 | ||
| 2847 | * device and disable remote wake for the first | ||
| 2848 | * interface. FIXME if the interface association | ||
| 2849 | * descriptor shows there's more than one function. | ||
| 2850 | */ | ||
| 2851 | static int usb_disable_function_remotewakeup(struct usb_device *udev) | ||
| 2852 | { | ||
| 2853 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
| 2854 | USB_REQ_CLEAR_FEATURE, USB_RECIP_INTERFACE, | ||
| 2855 | USB_INTRF_FUNC_SUSPEND, 0, NULL, 0, | ||
| 2856 | USB_CTRL_SET_TIMEOUT); | ||
| 2857 | } | ||
| 2841 | 2858 | ||
| 2842 | /* | 2859 | /* |
| 2843 | * usb_port_suspend - suspend a usb device's upstream port | 2860 | * usb_port_suspend - suspend a usb device's upstream port |
| @@ -2955,12 +2972,19 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | |||
| 2955 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", | 2972 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", |
| 2956 | port1, status); | 2973 | port1, status); |
| 2957 | /* paranoia: "should not happen" */ | 2974 | /* paranoia: "should not happen" */ |
| 2958 | if (udev->do_remote_wakeup) | 2975 | if (udev->do_remote_wakeup) { |
| 2959 | (void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 2976 | if (!hub_is_superspeed(hub->hdev)) { |
| 2960 | USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE, | 2977 | (void) usb_control_msg(udev, |
| 2961 | USB_DEVICE_REMOTE_WAKEUP, 0, | 2978 | usb_sndctrlpipe(udev, 0), |
| 2962 | NULL, 0, | 2979 | USB_REQ_CLEAR_FEATURE, |
| 2963 | USB_CTRL_SET_TIMEOUT); | 2980 | USB_RECIP_DEVICE, |
| 2981 | USB_DEVICE_REMOTE_WAKEUP, 0, | ||
| 2982 | NULL, 0, | ||
| 2983 | USB_CTRL_SET_TIMEOUT); | ||
| 2984 | } else | ||
| 2985 | (void) usb_disable_function_remotewakeup(udev); | ||
| 2986 | |||
| 2987 | } | ||
| 2964 | 2988 | ||
| 2965 | /* Try to enable USB2 hardware LPM again */ | 2989 | /* Try to enable USB2 hardware LPM again */ |
| 2966 | if (udev->usb2_hw_lpm_capable == 1) | 2990 | if (udev->usb2_hw_lpm_capable == 1) |
| @@ -3052,20 +3076,30 @@ static int finish_port_resume(struct usb_device *udev) | |||
| 3052 | * udev->reset_resume | 3076 | * udev->reset_resume |
| 3053 | */ | 3077 | */ |
| 3054 | } else if (udev->actconfig && !udev->reset_resume) { | 3078 | } else if (udev->actconfig && !udev->reset_resume) { |
| 3055 | le16_to_cpus(&devstatus); | 3079 | if (!hub_is_superspeed(udev->parent)) { |
| 3056 | if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { | 3080 | le16_to_cpus(&devstatus); |
| 3057 | status = usb_control_msg(udev, | 3081 | if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) |
| 3058 | usb_sndctrlpipe(udev, 0), | 3082 | status = usb_control_msg(udev, |
| 3059 | USB_REQ_CLEAR_FEATURE, | 3083 | usb_sndctrlpipe(udev, 0), |
| 3084 | USB_REQ_CLEAR_FEATURE, | ||
| 3060 | USB_RECIP_DEVICE, | 3085 | USB_RECIP_DEVICE, |
| 3061 | USB_DEVICE_REMOTE_WAKEUP, 0, | 3086 | USB_DEVICE_REMOTE_WAKEUP, 0, |
| 3062 | NULL, 0, | 3087 | NULL, 0, |
| 3063 | USB_CTRL_SET_TIMEOUT); | 3088 | USB_CTRL_SET_TIMEOUT); |
| 3064 | if (status) | 3089 | } else { |
| 3065 | dev_dbg(&udev->dev, | 3090 | status = usb_get_status(udev, USB_RECIP_INTERFACE, 0, |
| 3066 | "disable remote wakeup, status %d\n", | 3091 | &devstatus); |
| 3067 | status); | 3092 | le16_to_cpus(&devstatus); |
| 3093 | if (!status && devstatus & (USB_INTRF_STAT_FUNC_RW_CAP | ||
| 3094 | | USB_INTRF_STAT_FUNC_RW)) | ||
| 3095 | status = | ||
| 3096 | usb_disable_function_remotewakeup(udev); | ||
| 3068 | } | 3097 | } |
| 3098 | |||
| 3099 | if (status) | ||
| 3100 | dev_dbg(&udev->dev, | ||
| 3101 | "disable remote wakeup, status %d\n", | ||
| 3102 | status); | ||
| 3069 | status = 0; | 3103 | status = 0; |
| 3070 | } | 3104 | } |
| 3071 | return status; | 3105 | return status; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 09537b2f1002..b416a3fc9959 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -797,6 +797,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
| 797 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); | 797 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
| 798 | set_bit(i, &ehci->resuming_ports); | 798 | set_bit(i, &ehci->resuming_ports); |
| 799 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 799 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
| 800 | usb_hcd_start_port_resume(&hcd->self, i); | ||
| 800 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 801 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
| 801 | } | 802 | } |
| 802 | } | 803 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4ccb97c0678f..4d3b294f203e 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -649,7 +649,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
| 649 | status = STS_PCD; | 649 | status = STS_PCD; |
| 650 | } | 650 | } |
| 651 | } | 651 | } |
| 652 | /* FIXME autosuspend idle root hubs */ | 652 | |
| 653 | /* If a resume is in progress, make sure it can finish */ | ||
| 654 | if (ehci->resuming_ports) | ||
| 655 | mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25)); | ||
| 656 | |||
| 653 | spin_unlock_irqrestore (&ehci->lock, flags); | 657 | spin_unlock_irqrestore (&ehci->lock, flags); |
| 654 | return status ? retval : 0; | 658 | return status ? retval : 0; |
| 655 | } | 659 | } |
| @@ -851,6 +855,7 @@ static int ehci_hub_control ( | |||
| 851 | /* resume signaling for 20 msec */ | 855 | /* resume signaling for 20 msec */ |
| 852 | ehci->reset_done[wIndex] = jiffies | 856 | ehci->reset_done[wIndex] = jiffies |
| 853 | + msecs_to_jiffies(20); | 857 | + msecs_to_jiffies(20); |
| 858 | usb_hcd_start_port_resume(&hcd->self, wIndex); | ||
| 854 | /* check the port again */ | 859 | /* check the port again */ |
| 855 | mod_timer(&ehci_to_hcd(ehci)->rh_timer, | 860 | mod_timer(&ehci_to_hcd(ehci)->rh_timer, |
| 856 | ehci->reset_done[wIndex]); | 861 | ehci->reset_done[wIndex]); |
| @@ -862,6 +867,7 @@ static int ehci_hub_control ( | |||
| 862 | clear_bit(wIndex, &ehci->suspended_ports); | 867 | clear_bit(wIndex, &ehci->suspended_ports); |
| 863 | set_bit(wIndex, &ehci->port_c_suspend); | 868 | set_bit(wIndex, &ehci->port_c_suspend); |
| 864 | ehci->reset_done[wIndex] = 0; | 869 | ehci->reset_done[wIndex] = 0; |
| 870 | usb_hcd_end_port_resume(&hcd->self, wIndex); | ||
| 865 | 871 | ||
| 866 | /* stop resume signaling */ | 872 | /* stop resume signaling */ |
| 867 | temp = ehci_readl(ehci, status_reg); | 873 | temp = ehci_readl(ehci, status_reg); |
| @@ -950,6 +956,7 @@ static int ehci_hub_control ( | |||
| 950 | ehci->reset_done[wIndex] = 0; | 956 | ehci->reset_done[wIndex] = 0; |
| 951 | if (temp & PORT_PE) | 957 | if (temp & PORT_PE) |
| 952 | set_bit(wIndex, &ehci->port_c_suspend); | 958 | set_bit(wIndex, &ehci->port_c_suspend); |
| 959 | usb_hcd_end_port_resume(&hcd->self, wIndex); | ||
| 953 | } | 960 | } |
| 954 | 961 | ||
| 955 | if (temp & PORT_OC) | 962 | if (temp & PORT_OC) |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 3d989028c836..fd252f0cfb3a 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -1197,17 +1197,26 @@ static void start_iaa_cycle(struct ehci_hcd *ehci, bool nested) | |||
| 1197 | if (ehci->async_iaa || ehci->async_unlinking) | 1197 | if (ehci->async_iaa || ehci->async_unlinking) |
| 1198 | return; | 1198 | return; |
| 1199 | 1199 | ||
| 1200 | /* Do all the waiting QHs at once */ | ||
| 1201 | ehci->async_iaa = ehci->async_unlink; | ||
| 1202 | ehci->async_unlink = NULL; | ||
| 1203 | |||
| 1204 | /* If the controller isn't running, we don't have to wait for it */ | 1200 | /* If the controller isn't running, we don't have to wait for it */ |
| 1205 | if (unlikely(ehci->rh_state < EHCI_RH_RUNNING)) { | 1201 | if (unlikely(ehci->rh_state < EHCI_RH_RUNNING)) { |
| 1202 | |||
| 1203 | /* Do all the waiting QHs */ | ||
| 1204 | ehci->async_iaa = ehci->async_unlink; | ||
| 1205 | ehci->async_unlink = NULL; | ||
| 1206 | |||
| 1206 | if (!nested) /* Avoid recursion */ | 1207 | if (!nested) /* Avoid recursion */ |
| 1207 | end_unlink_async(ehci); | 1208 | end_unlink_async(ehci); |
| 1208 | 1209 | ||
| 1209 | /* Otherwise start a new IAA cycle */ | 1210 | /* Otherwise start a new IAA cycle */ |
| 1210 | } else if (likely(ehci->rh_state == EHCI_RH_RUNNING)) { | 1211 | } else if (likely(ehci->rh_state == EHCI_RH_RUNNING)) { |
| 1212 | struct ehci_qh *qh; | ||
| 1213 | |||
| 1214 | /* Do only the first waiting QH (nVidia bug?) */ | ||
| 1215 | qh = ehci->async_unlink; | ||
| 1216 | ehci->async_iaa = qh; | ||
| 1217 | ehci->async_unlink = qh->unlink_next; | ||
| 1218 | qh->unlink_next = NULL; | ||
| 1219 | |||
| 1211 | /* Make sure the unlinks are all visible to the hardware */ | 1220 | /* Make sure the unlinks are all visible to the hardware */ |
| 1212 | wmb(); | 1221 | wmb(); |
| 1213 | 1222 | ||
| @@ -1255,34 +1264,35 @@ static void end_unlink_async(struct ehci_hcd *ehci) | |||
| 1255 | } | 1264 | } |
| 1256 | } | 1265 | } |
| 1257 | 1266 | ||
| 1267 | static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh); | ||
| 1268 | |||
| 1258 | static void unlink_empty_async(struct ehci_hcd *ehci) | 1269 | static void unlink_empty_async(struct ehci_hcd *ehci) |
| 1259 | { | 1270 | { |
| 1260 | struct ehci_qh *qh, *next; | 1271 | struct ehci_qh *qh; |
| 1261 | bool stopped = (ehci->rh_state < EHCI_RH_RUNNING); | 1272 | struct ehci_qh *qh_to_unlink = NULL; |
| 1262 | bool check_unlinks_later = false; | 1273 | bool check_unlinks_later = false; |
| 1274 | int count = 0; | ||
| 1263 | 1275 | ||
| 1264 | /* Unlink all the async QHs that have been empty for a timer cycle */ | 1276 | /* Find the last async QH which has been empty for a timer cycle */ |
| 1265 | next = ehci->async->qh_next.qh; | 1277 | for (qh = ehci->async->qh_next.qh; qh; qh = qh->qh_next.qh) { |
| 1266 | while (next) { | ||
| 1267 | qh = next; | ||
| 1268 | next = qh->qh_next.qh; | ||
| 1269 | |||
| 1270 | if (list_empty(&qh->qtd_list) && | 1278 | if (list_empty(&qh->qtd_list) && |
| 1271 | qh->qh_state == QH_STATE_LINKED) { | 1279 | qh->qh_state == QH_STATE_LINKED) { |
| 1272 | if (!stopped && qh->unlink_cycle == | 1280 | ++count; |
| 1273 | ehci->async_unlink_cycle) | 1281 | if (qh->unlink_cycle == ehci->async_unlink_cycle) |
| 1274 | check_unlinks_later = true; | 1282 | check_unlinks_later = true; |
| 1275 | else | 1283 | else |
| 1276 | single_unlink_async(ehci, qh); | 1284 | qh_to_unlink = qh; |
| 1277 | } | 1285 | } |
| 1278 | } | 1286 | } |
| 1279 | 1287 | ||
| 1280 | /* Start a new IAA cycle if any QHs are waiting for it */ | 1288 | /* If nothing else is being unlinked, unlink the last empty QH */ |
| 1281 | if (ehci->async_unlink) | 1289 | if (!ehci->async_iaa && !ehci->async_unlink && qh_to_unlink) { |
| 1282 | start_iaa_cycle(ehci, false); | 1290 | start_unlink_async(ehci, qh_to_unlink); |
| 1291 | --count; | ||
| 1292 | } | ||
| 1283 | 1293 | ||
| 1284 | /* QHs that haven't been empty for long enough will be handled later */ | 1294 | /* Other QHs will be handled later */ |
| 1285 | if (check_unlinks_later) { | 1295 | if (count > 0) { |
| 1286 | ehci_enable_event(ehci, EHCI_HRTIMER_ASYNC_UNLINKS, true); | 1296 | ehci_enable_event(ehci, EHCI_HRTIMER_ASYNC_UNLINKS, true); |
| 1287 | ++ehci->async_unlink_cycle; | 1297 | ++ehci->async_unlink_cycle; |
| 1288 | } | 1298 | } |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 69ebee73c0c1..b476daf49f6f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -213,7 +213,7 @@ static inline unsigned char tt_start_uframe(struct ehci_hcd *ehci, __hc32 mask) | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | static const unsigned char | 215 | static const unsigned char |
| 216 | max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 }; | 216 | max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 125, 25 }; |
| 217 | 217 | ||
| 218 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ | 218 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ |
| 219 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) | 219 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) |
| @@ -2212,11 +2212,11 @@ static void scan_isoc(struct ehci_hcd *ehci) | |||
| 2212 | } | 2212 | } |
| 2213 | ehci->now_frame = now_frame; | 2213 | ehci->now_frame = now_frame; |
| 2214 | 2214 | ||
| 2215 | frame = ehci->last_iso_frame; | ||
| 2215 | for (;;) { | 2216 | for (;;) { |
| 2216 | union ehci_shadow q, *q_p; | 2217 | union ehci_shadow q, *q_p; |
| 2217 | __hc32 type, *hw_p; | 2218 | __hc32 type, *hw_p; |
| 2218 | 2219 | ||
| 2219 | frame = ehci->last_iso_frame; | ||
| 2220 | restart: | 2220 | restart: |
| 2221 | /* scan each element in frame's queue for completions */ | 2221 | /* scan each element in frame's queue for completions */ |
| 2222 | q_p = &ehci->pshadow [frame]; | 2222 | q_p = &ehci->pshadow [frame]; |
| @@ -2321,6 +2321,9 @@ restart: | |||
| 2321 | /* Stop when we have reached the current frame */ | 2321 | /* Stop when we have reached the current frame */ |
| 2322 | if (frame == now_frame) | 2322 | if (frame == now_frame) |
| 2323 | break; | 2323 | break; |
| 2324 | ehci->last_iso_frame = (frame + 1) & fmask; | 2324 | |
| 2325 | /* The last frame may still have active siTDs */ | ||
| 2326 | ehci->last_iso_frame = frame; | ||
| 2327 | frame = (frame + 1) & fmask; | ||
| 2325 | } | 2328 | } |
| 2326 | } | 2329 | } |
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c index 20dbdcbe9b0f..f904071d70df 100644 --- a/drivers/usb/host/ehci-timer.c +++ b/drivers/usb/host/ehci-timer.c | |||
| @@ -113,14 +113,15 @@ static void ehci_poll_ASS(struct ehci_hcd *ehci) | |||
| 113 | 113 | ||
| 114 | if (want != actual) { | 114 | if (want != actual) { |
| 115 | 115 | ||
| 116 | /* Poll again later, but give up after about 20 ms */ | 116 | /* Poll again later */ |
| 117 | if (ehci->ASS_poll_count++ < 20) { | 117 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); |
| 118 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); | 118 | ++ehci->ASS_poll_count; |
| 119 | return; | 119 | return; |
| 120 | } | ||
| 121 | ehci_dbg(ehci, "Waited too long for the async schedule status (%x/%x), giving up\n", | ||
| 122 | want, actual); | ||
| 123 | } | 120 | } |
| 121 | |||
| 122 | if (ehci->ASS_poll_count > 20) | ||
| 123 | ehci_dbg(ehci, "ASS poll count reached %d\n", | ||
| 124 | ehci->ASS_poll_count); | ||
| 124 | ehci->ASS_poll_count = 0; | 125 | ehci->ASS_poll_count = 0; |
| 125 | 126 | ||
| 126 | /* The status is up-to-date; restart or stop the schedule as needed */ | 127 | /* The status is up-to-date; restart or stop the schedule as needed */ |
| @@ -159,14 +160,14 @@ static void ehci_poll_PSS(struct ehci_hcd *ehci) | |||
| 159 | 160 | ||
| 160 | if (want != actual) { | 161 | if (want != actual) { |
| 161 | 162 | ||
| 162 | /* Poll again later, but give up after about 20 ms */ | 163 | /* Poll again later */ |
| 163 | if (ehci->PSS_poll_count++ < 20) { | 164 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); |
| 164 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); | 165 | return; |
| 165 | return; | ||
| 166 | } | ||
| 167 | ehci_dbg(ehci, "Waited too long for the periodic schedule status (%x/%x), giving up\n", | ||
| 168 | want, actual); | ||
| 169 | } | 166 | } |
| 167 | |||
| 168 | if (ehci->PSS_poll_count > 20) | ||
| 169 | ehci_dbg(ehci, "PSS poll count reached %d\n", | ||
| 170 | ehci->PSS_poll_count); | ||
| 170 | ehci->PSS_poll_count = 0; | 171 | ehci->PSS_poll_count = 0; |
| 171 | 172 | ||
| 172 | /* The status is up-to-date; restart or stop the schedule as needed */ | 173 | /* The status is up-to-date; restart or stop the schedule as needed */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index a3b6d7104ae2..4c338ec03a07 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
| @@ -780,6 +780,7 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev) | |||
| 780 | "defaulting to EHCI.\n"); | 780 | "defaulting to EHCI.\n"); |
| 781 | dev_warn(&xhci_pdev->dev, | 781 | dev_warn(&xhci_pdev->dev, |
| 782 | "USB 3.0 devices will work at USB 2.0 speeds.\n"); | 782 | "USB 3.0 devices will work at USB 2.0 speeds.\n"); |
| 783 | usb_disable_xhci_ports(xhci_pdev); | ||
| 783 | return; | 784 | return; |
| 784 | } | 785 | } |
| 785 | 786 | ||
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 768d54295a20..15d13229ddbb 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
| @@ -116,6 +116,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | clear_bit(port, &uhci->resuming_ports); | 118 | clear_bit(port, &uhci->resuming_ports); |
| 119 | usb_hcd_end_port_resume(&uhci_to_hcd(uhci)->self, port); | ||
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | /* Wait for the UHCI controller in HP's iLO2 server management chip. | 122 | /* Wait for the UHCI controller in HP's iLO2 server management chip. |
| @@ -167,6 +168,8 @@ static void uhci_check_ports(struct uhci_hcd *uhci) | |||
| 167 | set_bit(port, &uhci->resuming_ports); | 168 | set_bit(port, &uhci->resuming_ports); |
| 168 | uhci->ports_timeout = jiffies + | 169 | uhci->ports_timeout = jiffies + |
| 169 | msecs_to_jiffies(25); | 170 | msecs_to_jiffies(25); |
| 171 | usb_hcd_start_port_resume( | ||
| 172 | &uhci_to_hcd(uhci)->self, port); | ||
| 170 | 173 | ||
| 171 | /* Make sure we see the port again | 174 | /* Make sure we see the port again |
| 172 | * after the resuming period is over. */ | 175 | * after the resuming period is over. */ |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 59fb5c677dbe..7f76a49e90d3 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -1698,7 +1698,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
| 1698 | faked_port_index + 1); | 1698 | faked_port_index + 1); |
| 1699 | if (slot_id && xhci->devs[slot_id]) | 1699 | if (slot_id && xhci->devs[slot_id]) |
| 1700 | xhci_ring_device(xhci, slot_id); | 1700 | xhci_ring_device(xhci, slot_id); |
| 1701 | if (bus_state->port_remote_wakeup && (1 << faked_port_index)) { | 1701 | if (bus_state->port_remote_wakeup & (1 << faked_port_index)) { |
| 1702 | bus_state->port_remote_wakeup &= | 1702 | bus_state->port_remote_wakeup &= |
| 1703 | ~(1 << faked_port_index); | 1703 | ~(1 << faked_port_index); |
| 1704 | xhci_test_and_clear_bit(xhci, port_array, | 1704 | xhci_test_and_clear_bit(xhci, port_array, |
| @@ -2589,6 +2589,8 @@ cleanup: | |||
| 2589 | (trb_comp_code != COMP_STALL && | 2589 | (trb_comp_code != COMP_STALL && |
| 2590 | trb_comp_code != COMP_BABBLE)) | 2590 | trb_comp_code != COMP_BABBLE)) |
| 2591 | xhci_urb_free_priv(xhci, urb_priv); | 2591 | xhci_urb_free_priv(xhci, urb_priv); |
| 2592 | else | ||
| 2593 | kfree(urb_priv); | ||
| 2592 | 2594 | ||
| 2593 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | 2595 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); |
| 2594 | if ((urb->actual_length != urb->transfer_buffer_length && | 2596 | if ((urb->actual_length != urb->transfer_buffer_length && |
| @@ -3108,7 +3110,7 @@ static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, | |||
| 3108 | * running_total. | 3110 | * running_total. |
| 3109 | */ | 3111 | */ |
| 3110 | packets_transferred = (running_total + trb_buff_len) / | 3112 | packets_transferred = (running_total + trb_buff_len) / |
| 3111 | usb_endpoint_maxp(&urb->ep->desc); | 3113 | GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); |
| 3112 | 3114 | ||
| 3113 | if ((total_packet_count - packets_transferred) > 31) | 3115 | if ((total_packet_count - packets_transferred) > 31) |
| 3114 | return 31 << 17; | 3116 | return 31 << 17; |
| @@ -3642,7 +3644,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3642 | td_len = urb->iso_frame_desc[i].length; | 3644 | td_len = urb->iso_frame_desc[i].length; |
| 3643 | td_remain_len = td_len; | 3645 | td_remain_len = td_len; |
| 3644 | total_packet_count = DIV_ROUND_UP(td_len, | 3646 | total_packet_count = DIV_ROUND_UP(td_len, |
| 3645 | usb_endpoint_maxp(&urb->ep->desc)); | 3647 | GET_MAX_PACKET( |
| 3648 | usb_endpoint_maxp(&urb->ep->desc))); | ||
| 3646 | /* A zero-length transfer still involves at least one packet. */ | 3649 | /* A zero-length transfer still involves at least one packet. */ |
| 3647 | if (total_packet_count == 0) | 3650 | if (total_packet_count == 0) |
| 3648 | total_packet_count++; | 3651 | total_packet_count++; |
| @@ -3664,9 +3667,11 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3664 | td = urb_priv->td[i]; | 3667 | td = urb_priv->td[i]; |
| 3665 | for (j = 0; j < trbs_per_td; j++) { | 3668 | for (j = 0; j < trbs_per_td; j++) { |
| 3666 | u32 remainder = 0; | 3669 | u32 remainder = 0; |
| 3667 | field = TRB_TBC(burst_count) | TRB_TLBPC(residue); | 3670 | field = 0; |
| 3668 | 3671 | ||
| 3669 | if (first_trb) { | 3672 | if (first_trb) { |
| 3673 | field = TRB_TBC(burst_count) | | ||
| 3674 | TRB_TLBPC(residue); | ||
| 3670 | /* Queue the isoc TRB */ | 3675 | /* Queue the isoc TRB */ |
| 3671 | field |= TRB_TYPE(TRB_ISOC); | 3676 | field |= TRB_TYPE(TRB_ISOC); |
| 3672 | /* Assume URB_ISO_ASAP is set */ | 3677 | /* Assume URB_ISO_ASAP is set */ |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index f14736f647ff..edc0f0dcad83 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
| @@ -60,6 +60,7 @@ static const struct usb_device_id id_table[] = { | |||
| 60 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ | 60 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ |
| 61 | { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ | 61 | { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ |
| 62 | { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */ | 62 | { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */ |
| 63 | { USB_DEVICE(0x0FDE, 0xCA05) }, /* OWL Wireless Electricity Monitor CM-160 */ | ||
| 63 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ | 64 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ |
| 64 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 65 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
| 65 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ | 66 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ba68835d06a6..90ceef1776c3 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -584,6 +584,7 @@ static struct usb_device_id id_table_combined [] = { | |||
| 584 | /* | 584 | /* |
| 585 | * ELV devices: | 585 | * ELV devices: |
| 586 | */ | 586 | */ |
| 587 | { USB_DEVICE(FTDI_ELV_VID, FTDI_ELV_WS300_PID) }, | ||
| 587 | { USB_DEVICE(FTDI_VID, FTDI_ELV_USR_PID) }, | 588 | { USB_DEVICE(FTDI_VID, FTDI_ELV_USR_PID) }, |
| 588 | { USB_DEVICE(FTDI_VID, FTDI_ELV_MSM1_PID) }, | 589 | { USB_DEVICE(FTDI_VID, FTDI_ELV_MSM1_PID) }, |
| 589 | { USB_DEVICE(FTDI_VID, FTDI_ELV_KL100_PID) }, | 590 | { USB_DEVICE(FTDI_VID, FTDI_ELV_KL100_PID) }, |
| @@ -670,6 +671,7 @@ static struct usb_device_id id_table_combined [] = { | |||
| 670 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, | 671 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, |
| 671 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, | 672 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, |
| 672 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, | 673 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, |
| 674 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, | ||
| 673 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 675 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
| 674 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, | 676 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, |
| 675 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_KW_PID) }, | 677 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_KW_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index fa5d56038276..9d359e189a64 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
| @@ -147,6 +147,11 @@ | |||
| 147 | #define XSENS_CONVERTER_6_PID 0xD38E | 147 | #define XSENS_CONVERTER_6_PID 0xD38E |
| 148 | #define XSENS_CONVERTER_7_PID 0xD38F | 148 | #define XSENS_CONVERTER_7_PID 0xD38F |
| 149 | 149 | ||
| 150 | /** | ||
| 151 | * Zolix (www.zolix.com.cb) product ids | ||
| 152 | */ | ||
| 153 | #define FTDI_OMNI1509 0xD491 /* Omni1509 embedded USB-serial */ | ||
| 154 | |||
| 150 | /* | 155 | /* |
| 151 | * NDI (www.ndigital.com) product ids | 156 | * NDI (www.ndigital.com) product ids |
| 152 | */ | 157 | */ |
| @@ -204,7 +209,7 @@ | |||
| 204 | 209 | ||
| 205 | /* | 210 | /* |
| 206 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). | 211 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). |
| 207 | * All of these devices use FTDI's vendor ID (0x0403). | 212 | * Almost all of these devices use FTDI's vendor ID (0x0403). |
| 208 | * Further IDs taken from ELV Windows .inf file. | 213 | * Further IDs taken from ELV Windows .inf file. |
| 209 | * | 214 | * |
| 210 | * The previously included PID for the UO 100 module was incorrect. | 215 | * The previously included PID for the UO 100 module was incorrect. |
| @@ -212,6 +217,8 @@ | |||
| 212 | * | 217 | * |
| 213 | * Armin Laeuger originally sent the PID for the UM 100 module. | 218 | * Armin Laeuger originally sent the PID for the UM 100 module. |
| 214 | */ | 219 | */ |
| 220 | #define FTDI_ELV_VID 0x1B1F /* ELV AG */ | ||
| 221 | #define FTDI_ELV_WS300_PID 0xC006 /* eQ3 WS 300 PC II */ | ||
| 215 | #define FTDI_ELV_USR_PID 0xE000 /* ELV Universal-Sound-Recorder */ | 222 | #define FTDI_ELV_USR_PID 0xE000 /* ELV Universal-Sound-Recorder */ |
| 216 | #define FTDI_ELV_MSM1_PID 0xE001 /* ELV Mini-Sound-Modul */ | 223 | #define FTDI_ELV_MSM1_PID 0xE001 /* ELV Mini-Sound-Modul */ |
| 217 | #define FTDI_ELV_KL100_PID 0xE002 /* ELV Kfz-Leistungsmesser KL 100 */ | 224 | #define FTDI_ELV_KL100_PID 0xE002 /* ELV Kfz-Leistungsmesser KL 100 */ |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 0d9dac9e7f93..567bc77d6397 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -242,6 +242,7 @@ static void option_instat_callback(struct urb *urb); | |||
| 242 | #define TELIT_PRODUCT_CC864_DUAL 0x1005 | 242 | #define TELIT_PRODUCT_CC864_DUAL 0x1005 |
| 243 | #define TELIT_PRODUCT_CC864_SINGLE 0x1006 | 243 | #define TELIT_PRODUCT_CC864_SINGLE 0x1006 |
| 244 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 | 244 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 |
| 245 | #define TELIT_PRODUCT_LE920 0x1200 | ||
| 245 | 246 | ||
| 246 | /* ZTE PRODUCTS */ | 247 | /* ZTE PRODUCTS */ |
| 247 | #define ZTE_VENDOR_ID 0x19d2 | 248 | #define ZTE_VENDOR_ID 0x19d2 |
| @@ -453,6 +454,10 @@ static void option_instat_callback(struct urb *urb); | |||
| 453 | #define TPLINK_VENDOR_ID 0x2357 | 454 | #define TPLINK_VENDOR_ID 0x2357 |
| 454 | #define TPLINK_PRODUCT_MA180 0x0201 | 455 | #define TPLINK_PRODUCT_MA180 0x0201 |
| 455 | 456 | ||
| 457 | /* Changhong products */ | ||
| 458 | #define CHANGHONG_VENDOR_ID 0x2077 | ||
| 459 | #define CHANGHONG_PRODUCT_CH690 0x7001 | ||
| 460 | |||
| 456 | /* some devices interfaces need special handling due to a number of reasons */ | 461 | /* some devices interfaces need special handling due to a number of reasons */ |
| 457 | enum option_blacklist_reason { | 462 | enum option_blacklist_reason { |
| 458 | OPTION_BLACKLIST_NONE = 0, | 463 | OPTION_BLACKLIST_NONE = 0, |
| @@ -534,6 +539,11 @@ static const struct option_blacklist_info zte_1255_blacklist = { | |||
| 534 | .reserved = BIT(3) | BIT(4), | 539 | .reserved = BIT(3) | BIT(4), |
| 535 | }; | 540 | }; |
| 536 | 541 | ||
| 542 | static const struct option_blacklist_info telit_le920_blacklist = { | ||
| 543 | .sendsetup = BIT(0), | ||
| 544 | .reserved = BIT(1) | BIT(5), | ||
| 545 | }; | ||
| 546 | |||
| 537 | static const struct usb_device_id option_ids[] = { | 547 | static const struct usb_device_id option_ids[] = { |
| 538 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 548 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
| 539 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 549 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
| @@ -784,6 +794,8 @@ static const struct usb_device_id option_ids[] = { | |||
| 784 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, | 794 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, |
| 785 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, | 795 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, |
| 786 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, | 796 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, |
| 797 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), | ||
| 798 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, | ||
| 787 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ | 799 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
| 788 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), | 800 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
| 789 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | 801 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, |
| @@ -1318,6 +1330,7 @@ static const struct usb_device_id option_ids[] = { | |||
| 1318 | { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, | 1330 | { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, |
| 1319 | { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), | 1331 | { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), |
| 1320 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 1332 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1333 | { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) }, | ||
| 1321 | { } /* Terminating entry */ | 1334 | { } /* Terminating entry */ |
| 1322 | }; | 1335 | }; |
| 1323 | MODULE_DEVICE_TABLE(usb, option_ids); | 1336 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index aa148c21ea40..24662547dc5b 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -53,6 +53,7 @@ static const struct usb_device_id id_table[] = { | |||
| 53 | {DEVICE_G1K(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ | 53 | {DEVICE_G1K(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ |
| 54 | {DEVICE_G1K(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ | 54 | {DEVICE_G1K(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ |
| 55 | {DEVICE_G1K(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ | 55 | {DEVICE_G1K(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ |
| 56 | {DEVICE_G1K(0x1bc7, 0x900e)}, /* Telit Gobi QDL device */ | ||
| 56 | 57 | ||
| 57 | /* Gobi 2000 devices */ | 58 | /* Gobi 2000 devices */ |
| 58 | {USB_DEVICE(0x1410, 0xa010)}, /* Novatel Gobi 2000 QDL device */ | 59 | {USB_DEVICE(0x1410, 0xa010)}, /* Novatel Gobi 2000 QDL device */ |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 105d900150c1..16b0bf055eeb 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
| @@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_data *us) | |||
| 92 | return 0; | 92 | return 0; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /* This places the HUAWEI E220 devices in multi-port mode */ | 95 | /* This places the HUAWEI usb dongles in multi-port mode */ |
| 96 | int usb_stor_huawei_e220_init(struct us_data *us) | 96 | static int usb_stor_huawei_feature_init(struct us_data *us) |
| 97 | { | 97 | { |
| 98 | int result; | 98 | int result; |
| 99 | 99 | ||
| @@ -104,3 +104,75 @@ int usb_stor_huawei_e220_init(struct us_data *us) | |||
| 104 | US_DEBUGP("Huawei mode set result is %d\n", result); | 104 | US_DEBUGP("Huawei mode set result is %d\n", result); |
| 105 | return 0; | 105 | return 0; |
| 106 | } | 106 | } |
| 107 | |||
| 108 | /* | ||
| 109 | * It will send a scsi switch command called rewind' to huawei dongle. | ||
| 110 | * When the dongle receives this command at the first time, | ||
| 111 | * it will reboot immediately. After rebooted, it will ignore this command. | ||
| 112 | * So it is unnecessary to read its response. | ||
| 113 | */ | ||
| 114 | static int usb_stor_huawei_scsi_init(struct us_data *us) | ||
| 115 | { | ||
| 116 | int result = 0; | ||
| 117 | int act_len = 0; | ||
| 118 | struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf; | ||
| 119 | char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, | ||
| 120 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
| 121 | |||
| 122 | bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN); | ||
| 123 | bcbw->Tag = 0; | ||
| 124 | bcbw->DataTransferLength = 0; | ||
| 125 | bcbw->Flags = bcbw->Lun = 0; | ||
| 126 | bcbw->Length = sizeof(rewind_cmd); | ||
| 127 | memset(bcbw->CDB, 0, sizeof(bcbw->CDB)); | ||
| 128 | memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd)); | ||
| 129 | |||
| 130 | result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw, | ||
| 131 | US_BULK_CB_WRAP_LEN, &act_len); | ||
| 132 | US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result); | ||
| 133 | return result; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* | ||
| 137 | * It tries to find the supported Huawei USB dongles. | ||
| 138 | * In Huawei, they assign the following product IDs | ||
| 139 | * for all of their mobile broadband dongles, | ||
| 140 | * including the new dongles in the future. | ||
| 141 | * So if the product ID is not included in this list, | ||
| 142 | * it means it is not Huawei's mobile broadband dongles. | ||
| 143 | */ | ||
| 144 | static int usb_stor_huawei_dongles_pid(struct us_data *us) | ||
| 145 | { | ||
| 146 | struct usb_interface_descriptor *idesc; | ||
| 147 | int idProduct; | ||
| 148 | |||
| 149 | idesc = &us->pusb_intf->cur_altsetting->desc; | ||
| 150 | idProduct = us->pusb_dev->descriptor.idProduct; | ||
| 151 | /* The first port is CDROM, | ||
| 152 | * means the dongle in the single port mode, | ||
| 153 | * and a switch command is required to be sent. */ | ||
| 154 | if (idesc && idesc->bInterfaceNumber == 0) { | ||
| 155 | if ((idProduct == 0x1001) | ||
| 156 | || (idProduct == 0x1003) | ||
| 157 | || (idProduct == 0x1004) | ||
| 158 | || (idProduct >= 0x1401 && idProduct <= 0x1500) | ||
| 159 | || (idProduct >= 0x1505 && idProduct <= 0x1600) | ||
| 160 | || (idProduct >= 0x1c02 && idProduct <= 0x2202)) { | ||
| 161 | return 1; | ||
| 162 | } | ||
| 163 | } | ||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | int usb_stor_huawei_init(struct us_data *us) | ||
| 168 | { | ||
| 169 | int result = 0; | ||
| 170 | |||
| 171 | if (usb_stor_huawei_dongles_pid(us)) { | ||
| 172 | if (us->pusb_dev->descriptor.idProduct >= 0x1446) | ||
| 173 | result = usb_stor_huawei_scsi_init(us); | ||
| 174 | else | ||
| 175 | result = usb_stor_huawei_feature_init(us); | ||
| 176 | } | ||
| 177 | return result; | ||
| 178 | } | ||
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index 529327fbb06b..5376d4fc76f0 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h | |||
| @@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data *us); | |||
| 46 | * flash reader */ | 46 | * flash reader */ |
| 47 | int usb_stor_ucr61s2b_init(struct us_data *us); | 47 | int usb_stor_ucr61s2b_init(struct us_data *us); |
| 48 | 48 | ||
| 49 | /* This places the HUAWEI E220 devices in multi-port mode */ | 49 | /* This places the HUAWEI usb dongles in multi-port mode */ |
| 50 | int usb_stor_huawei_e220_init(struct us_data *us); | 50 | int usb_stor_huawei_init(struct us_data *us); |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index d305a5aa3a5d..72923b56bbf6 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -1527,335 +1527,10 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100, | |||
| 1527 | /* Reported by fangxiaozhi <huananhu@huawei.com> | 1527 | /* Reported by fangxiaozhi <huananhu@huawei.com> |
| 1528 | * This brings the HUAWEI data card devices into multi-port mode | 1528 | * This brings the HUAWEI data card devices into multi-port mode |
| 1529 | */ | 1529 | */ |
| 1530 | UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000, | 1530 | UNUSUAL_VENDOR_INTF(0x12d1, 0x08, 0x06, 0x50, |
| 1531 | "HUAWEI MOBILE", | 1531 | "HUAWEI MOBILE", |
| 1532 | "Mass Storage", | 1532 | "Mass Storage", |
| 1533 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | 1533 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_init, |
| 1534 | 0), | ||
| 1535 | UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000, | ||
| 1536 | "HUAWEI MOBILE", | ||
| 1537 | "Mass Storage", | ||
| 1538 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1539 | 0), | ||
| 1540 | UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000, | ||
| 1541 | "HUAWEI MOBILE", | ||
| 1542 | "Mass Storage", | ||
| 1543 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1544 | 0), | ||
| 1545 | UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000, | ||
| 1546 | "HUAWEI MOBILE", | ||
| 1547 | "Mass Storage", | ||
| 1548 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1549 | 0), | ||
| 1550 | UNUSUAL_DEV( 0x12d1, 0x1402, 0x0000, 0x0000, | ||
| 1551 | "HUAWEI MOBILE", | ||
| 1552 | "Mass Storage", | ||
| 1553 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1554 | 0), | ||
| 1555 | UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000, | ||
| 1556 | "HUAWEI MOBILE", | ||
| 1557 | "Mass Storage", | ||
| 1558 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1559 | 0), | ||
| 1560 | UNUSUAL_DEV( 0x12d1, 0x1404, 0x0000, 0x0000, | ||
| 1561 | "HUAWEI MOBILE", | ||
| 1562 | "Mass Storage", | ||
| 1563 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1564 | 0), | ||
| 1565 | UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000, | ||
| 1566 | "HUAWEI MOBILE", | ||
| 1567 | "Mass Storage", | ||
| 1568 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1569 | 0), | ||
| 1570 | UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000, | ||
| 1571 | "HUAWEI MOBILE", | ||
| 1572 | "Mass Storage", | ||
| 1573 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1574 | 0), | ||
| 1575 | UNUSUAL_DEV( 0x12d1, 0x1407, 0x0000, 0x0000, | ||
| 1576 | "HUAWEI MOBILE", | ||
| 1577 | "Mass Storage", | ||
| 1578 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1579 | 0), | ||
| 1580 | UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000, | ||
| 1581 | "HUAWEI MOBILE", | ||
| 1582 | "Mass Storage", | ||
| 1583 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1584 | 0), | ||
| 1585 | UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000, | ||
| 1586 | "HUAWEI MOBILE", | ||
| 1587 | "Mass Storage", | ||
| 1588 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1589 | 0), | ||
| 1590 | UNUSUAL_DEV( 0x12d1, 0x140A, 0x0000, 0x0000, | ||
| 1591 | "HUAWEI MOBILE", | ||
| 1592 | "Mass Storage", | ||
| 1593 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1594 | 0), | ||
| 1595 | UNUSUAL_DEV( 0x12d1, 0x140B, 0x0000, 0x0000, | ||
| 1596 | "HUAWEI MOBILE", | ||
| 1597 | "Mass Storage", | ||
| 1598 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1599 | 0), | ||
| 1600 | UNUSUAL_DEV( 0x12d1, 0x140C, 0x0000, 0x0000, | ||
| 1601 | "HUAWEI MOBILE", | ||
| 1602 | "Mass Storage", | ||
| 1603 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1604 | 0), | ||
| 1605 | UNUSUAL_DEV( 0x12d1, 0x140D, 0x0000, 0x0000, | ||
| 1606 | "HUAWEI MOBILE", | ||
| 1607 | "Mass Storage", | ||
| 1608 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1609 | 0), | ||
| 1610 | UNUSUAL_DEV( 0x12d1, 0x140E, 0x0000, 0x0000, | ||
| 1611 | "HUAWEI MOBILE", | ||
| 1612 | "Mass Storage", | ||
| 1613 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1614 | 0), | ||
| 1615 | UNUSUAL_DEV( 0x12d1, 0x140F, 0x0000, 0x0000, | ||
| 1616 | "HUAWEI MOBILE", | ||
| 1617 | "Mass Storage", | ||
| 1618 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1619 | 0), | ||
| 1620 | UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000, | ||
| 1621 | "HUAWEI MOBILE", | ||
| 1622 | "Mass Storage", | ||
| 1623 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1624 | 0), | ||
| 1625 | UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000, | ||
| 1626 | "HUAWEI MOBILE", | ||
| 1627 | "Mass Storage", | ||
| 1628 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1629 | 0), | ||
| 1630 | UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000, | ||
| 1631 | "HUAWEI MOBILE", | ||
| 1632 | "Mass Storage", | ||
| 1633 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1634 | 0), | ||
| 1635 | UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000, | ||
| 1636 | "HUAWEI MOBILE", | ||
| 1637 | "Mass Storage", | ||
| 1638 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1639 | 0), | ||
| 1640 | UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000, | ||
| 1641 | "HUAWEI MOBILE", | ||
| 1642 | "Mass Storage", | ||
| 1643 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1644 | 0), | ||
| 1645 | UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000, | ||
| 1646 | "HUAWEI MOBILE", | ||
| 1647 | "Mass Storage", | ||
| 1648 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1649 | 0), | ||
| 1650 | UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000, | ||
| 1651 | "HUAWEI MOBILE", | ||
| 1652 | "Mass Storage", | ||
| 1653 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1654 | 0), | ||
| 1655 | UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000, | ||
| 1656 | "HUAWEI MOBILE", | ||
| 1657 | "Mass Storage", | ||
| 1658 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1659 | 0), | ||
| 1660 | UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000, | ||
| 1661 | "HUAWEI MOBILE", | ||
| 1662 | "Mass Storage", | ||
| 1663 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1664 | 0), | ||
| 1665 | UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000, | ||
| 1666 | "HUAWEI MOBILE", | ||
| 1667 | "Mass Storage", | ||
| 1668 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1669 | 0), | ||
| 1670 | UNUSUAL_DEV( 0x12d1, 0x141A, 0x0000, 0x0000, | ||
| 1671 | "HUAWEI MOBILE", | ||
| 1672 | "Mass Storage", | ||
| 1673 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1674 | 0), | ||
| 1675 | UNUSUAL_DEV( 0x12d1, 0x141B, 0x0000, 0x0000, | ||
| 1676 | "HUAWEI MOBILE", | ||
| 1677 | "Mass Storage", | ||
| 1678 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1679 | 0), | ||
| 1680 | UNUSUAL_DEV( 0x12d1, 0x141C, 0x0000, 0x0000, | ||
| 1681 | "HUAWEI MOBILE", | ||
| 1682 | "Mass Storage", | ||
| 1683 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1684 | 0), | ||
| 1685 | UNUSUAL_DEV( 0x12d1, 0x141D, 0x0000, 0x0000, | ||
| 1686 | "HUAWEI MOBILE", | ||
| 1687 | "Mass Storage", | ||
| 1688 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1689 | 0), | ||
| 1690 | UNUSUAL_DEV( 0x12d1, 0x141E, 0x0000, 0x0000, | ||
| 1691 | "HUAWEI MOBILE", | ||
| 1692 | "Mass Storage", | ||
| 1693 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1694 | 0), | ||
| 1695 | UNUSUAL_DEV( 0x12d1, 0x141F, 0x0000, 0x0000, | ||
| 1696 | "HUAWEI MOBILE", | ||
| 1697 | "Mass Storage", | ||
| 1698 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1699 | 0), | ||
| 1700 | UNUSUAL_DEV( 0x12d1, 0x1420, 0x0000, 0x0000, | ||
| 1701 | "HUAWEI MOBILE", | ||
| 1702 | "Mass Storage", | ||
| 1703 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1704 | 0), | ||
| 1705 | UNUSUAL_DEV( 0x12d1, 0x1421, 0x0000, 0x0000, | ||
| 1706 | "HUAWEI MOBILE", | ||
| 1707 | "Mass Storage", | ||
| 1708 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1709 | 0), | ||
| 1710 | UNUSUAL_DEV( 0x12d1, 0x1422, 0x0000, 0x0000, | ||
| 1711 | "HUAWEI MOBILE", | ||
| 1712 | "Mass Storage", | ||
| 1713 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1714 | 0), | ||
| 1715 | UNUSUAL_DEV( 0x12d1, 0x1423, 0x0000, 0x0000, | ||
| 1716 | "HUAWEI MOBILE", | ||
| 1717 | "Mass Storage", | ||
| 1718 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1719 | 0), | ||
| 1720 | UNUSUAL_DEV( 0x12d1, 0x1424, 0x0000, 0x0000, | ||
| 1721 | "HUAWEI MOBILE", | ||
| 1722 | "Mass Storage", | ||
| 1723 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1724 | 0), | ||
| 1725 | UNUSUAL_DEV( 0x12d1, 0x1425, 0x0000, 0x0000, | ||
| 1726 | "HUAWEI MOBILE", | ||
| 1727 | "Mass Storage", | ||
| 1728 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1729 | 0), | ||
| 1730 | UNUSUAL_DEV( 0x12d1, 0x1426, 0x0000, 0x0000, | ||
| 1731 | "HUAWEI MOBILE", | ||
| 1732 | "Mass Storage", | ||
| 1733 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1734 | 0), | ||
| 1735 | UNUSUAL_DEV( 0x12d1, 0x1427, 0x0000, 0x0000, | ||
| 1736 | "HUAWEI MOBILE", | ||
| 1737 | "Mass Storage", | ||
| 1738 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1739 | 0), | ||
| 1740 | UNUSUAL_DEV( 0x12d1, 0x1428, 0x0000, 0x0000, | ||
| 1741 | "HUAWEI MOBILE", | ||
| 1742 | "Mass Storage", | ||
| 1743 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1744 | 0), | ||
| 1745 | UNUSUAL_DEV( 0x12d1, 0x1429, 0x0000, 0x0000, | ||
| 1746 | "HUAWEI MOBILE", | ||
| 1747 | "Mass Storage", | ||
| 1748 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1749 | 0), | ||
| 1750 | UNUSUAL_DEV( 0x12d1, 0x142A, 0x0000, 0x0000, | ||
| 1751 | "HUAWEI MOBILE", | ||
| 1752 | "Mass Storage", | ||
| 1753 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1754 | 0), | ||
| 1755 | UNUSUAL_DEV( 0x12d1, 0x142B, 0x0000, 0x0000, | ||
| 1756 | "HUAWEI MOBILE", | ||
| 1757 | "Mass Storage", | ||
| 1758 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1759 | 0), | ||
| 1760 | UNUSUAL_DEV( 0x12d1, 0x142C, 0x0000, 0x0000, | ||
| 1761 | "HUAWEI MOBILE", | ||
| 1762 | "Mass Storage", | ||
| 1763 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1764 | 0), | ||
| 1765 | UNUSUAL_DEV( 0x12d1, 0x142D, 0x0000, 0x0000, | ||
| 1766 | "HUAWEI MOBILE", | ||
| 1767 | "Mass Storage", | ||
| 1768 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1769 | 0), | ||
| 1770 | UNUSUAL_DEV( 0x12d1, 0x142E, 0x0000, 0x0000, | ||
| 1771 | "HUAWEI MOBILE", | ||
| 1772 | "Mass Storage", | ||
| 1773 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1774 | 0), | ||
| 1775 | UNUSUAL_DEV( 0x12d1, 0x142F, 0x0000, 0x0000, | ||
| 1776 | "HUAWEI MOBILE", | ||
| 1777 | "Mass Storage", | ||
| 1778 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1779 | 0), | ||
| 1780 | UNUSUAL_DEV( 0x12d1, 0x1430, 0x0000, 0x0000, | ||
| 1781 | "HUAWEI MOBILE", | ||
| 1782 | "Mass Storage", | ||
| 1783 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1784 | 0), | ||
| 1785 | UNUSUAL_DEV( 0x12d1, 0x1431, 0x0000, 0x0000, | ||
| 1786 | "HUAWEI MOBILE", | ||
| 1787 | "Mass Storage", | ||
| 1788 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1789 | 0), | ||
| 1790 | UNUSUAL_DEV( 0x12d1, 0x1432, 0x0000, 0x0000, | ||
| 1791 | "HUAWEI MOBILE", | ||
| 1792 | "Mass Storage", | ||
| 1793 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1794 | 0), | ||
| 1795 | UNUSUAL_DEV( 0x12d1, 0x1433, 0x0000, 0x0000, | ||
| 1796 | "HUAWEI MOBILE", | ||
| 1797 | "Mass Storage", | ||
| 1798 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1799 | 0), | ||
| 1800 | UNUSUAL_DEV( 0x12d1, 0x1434, 0x0000, 0x0000, | ||
| 1801 | "HUAWEI MOBILE", | ||
| 1802 | "Mass Storage", | ||
| 1803 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1804 | 0), | ||
| 1805 | UNUSUAL_DEV( 0x12d1, 0x1435, 0x0000, 0x0000, | ||
| 1806 | "HUAWEI MOBILE", | ||
| 1807 | "Mass Storage", | ||
| 1808 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1809 | 0), | ||
| 1810 | UNUSUAL_DEV( 0x12d1, 0x1436, 0x0000, 0x0000, | ||
| 1811 | "HUAWEI MOBILE", | ||
| 1812 | "Mass Storage", | ||
| 1813 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1814 | 0), | ||
| 1815 | UNUSUAL_DEV( 0x12d1, 0x1437, 0x0000, 0x0000, | ||
| 1816 | "HUAWEI MOBILE", | ||
| 1817 | "Mass Storage", | ||
| 1818 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1819 | 0), | ||
| 1820 | UNUSUAL_DEV( 0x12d1, 0x1438, 0x0000, 0x0000, | ||
| 1821 | "HUAWEI MOBILE", | ||
| 1822 | "Mass Storage", | ||
| 1823 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1824 | 0), | ||
| 1825 | UNUSUAL_DEV( 0x12d1, 0x1439, 0x0000, 0x0000, | ||
| 1826 | "HUAWEI MOBILE", | ||
| 1827 | "Mass Storage", | ||
| 1828 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1829 | 0), | ||
| 1830 | UNUSUAL_DEV( 0x12d1, 0x143A, 0x0000, 0x0000, | ||
| 1831 | "HUAWEI MOBILE", | ||
| 1832 | "Mass Storage", | ||
| 1833 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1834 | 0), | ||
| 1835 | UNUSUAL_DEV( 0x12d1, 0x143B, 0x0000, 0x0000, | ||
| 1836 | "HUAWEI MOBILE", | ||
| 1837 | "Mass Storage", | ||
| 1838 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1839 | 0), | ||
| 1840 | UNUSUAL_DEV( 0x12d1, 0x143C, 0x0000, 0x0000, | ||
| 1841 | "HUAWEI MOBILE", | ||
| 1842 | "Mass Storage", | ||
| 1843 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1844 | 0), | ||
| 1845 | UNUSUAL_DEV( 0x12d1, 0x143D, 0x0000, 0x0000, | ||
| 1846 | "HUAWEI MOBILE", | ||
| 1847 | "Mass Storage", | ||
| 1848 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1849 | 0), | ||
| 1850 | UNUSUAL_DEV( 0x12d1, 0x143E, 0x0000, 0x0000, | ||
| 1851 | "HUAWEI MOBILE", | ||
| 1852 | "Mass Storage", | ||
| 1853 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1854 | 0), | ||
| 1855 | UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000, | ||
| 1856 | "HUAWEI MOBILE", | ||
| 1857 | "Mass Storage", | ||
| 1858 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
| 1859 | 0), | 1534 | 0), |
| 1860 | 1535 | ||
| 1861 | /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ | 1536 | /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 31b3e1a61bbd..cf09b6ba71ff 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
| @@ -120,6 +120,17 @@ MODULE_PARM_DESC(quirks, "supplemental list of device IDs and their quirks"); | |||
| 120 | .useTransport = use_transport, \ | 120 | .useTransport = use_transport, \ |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | #define UNUSUAL_VENDOR_INTF(idVendor, cl, sc, pr, \ | ||
| 124 | vendor_name, product_name, use_protocol, use_transport, \ | ||
| 125 | init_function, Flags) \ | ||
| 126 | { \ | ||
| 127 | .vendorName = vendor_name, \ | ||
| 128 | .productName = product_name, \ | ||
| 129 | .useProtocol = use_protocol, \ | ||
| 130 | .useTransport = use_transport, \ | ||
| 131 | .initFunction = init_function, \ | ||
| 132 | } | ||
| 133 | |||
| 123 | static struct us_unusual_dev us_unusual_dev_list[] = { | 134 | static struct us_unusual_dev us_unusual_dev_list[] = { |
| 124 | # include "unusual_devs.h" | 135 | # include "unusual_devs.h" |
| 125 | { } /* Terminating entry */ | 136 | { } /* Terminating entry */ |
| @@ -131,6 +142,7 @@ static struct us_unusual_dev for_dynamic_ids = | |||
| 131 | #undef UNUSUAL_DEV | 142 | #undef UNUSUAL_DEV |
| 132 | #undef COMPLIANT_DEV | 143 | #undef COMPLIANT_DEV |
| 133 | #undef USUAL_DEV | 144 | #undef USUAL_DEV |
| 145 | #undef UNUSUAL_VENDOR_INTF | ||
| 134 | 146 | ||
| 135 | #ifdef CONFIG_LOCKDEP | 147 | #ifdef CONFIG_LOCKDEP |
| 136 | 148 | ||
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c index b78a526910fb..5ef8ce74aae4 100644 --- a/drivers/usb/storage/usual-tables.c +++ b/drivers/usb/storage/usual-tables.c | |||
| @@ -41,6 +41,20 @@ | |||
| 41 | #define USUAL_DEV(useProto, useTrans) \ | 41 | #define USUAL_DEV(useProto, useTrans) \ |
| 42 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } | 42 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } |
| 43 | 43 | ||
| 44 | /* Define the device is matched with Vendor ID and interface descriptors */ | ||
| 45 | #define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \ | ||
| 46 | vendorName, productName, useProtocol, useTransport, \ | ||
| 47 | initFunction, flags) \ | ||
| 48 | { \ | ||
| 49 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ | ||
| 50 | | USB_DEVICE_ID_MATCH_VENDOR, \ | ||
| 51 | .idVendor = (id_vendor), \ | ||
| 52 | .bInterfaceClass = (cl), \ | ||
| 53 | .bInterfaceSubClass = (sc), \ | ||
| 54 | .bInterfaceProtocol = (pr), \ | ||
| 55 | .driver_info = (flags) \ | ||
| 56 | } | ||
| 57 | |||
| 44 | struct usb_device_id usb_storage_usb_ids[] = { | 58 | struct usb_device_id usb_storage_usb_ids[] = { |
| 45 | # include "unusual_devs.h" | 59 | # include "unusual_devs.h" |
| 46 | { } /* Terminating entry */ | 60 | { } /* Terminating entry */ |
| @@ -50,6 +64,7 @@ MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids); | |||
| 50 | #undef UNUSUAL_DEV | 64 | #undef UNUSUAL_DEV |
| 51 | #undef COMPLIANT_DEV | 65 | #undef COMPLIANT_DEV |
| 52 | #undef USUAL_DEV | 66 | #undef USUAL_DEV |
| 67 | #undef UNUSUAL_VENDOR_INTF | ||
| 53 | 68 | ||
| 54 | /* | 69 | /* |
| 55 | * The table of devices to ignore | 70 | * The table of devices to ignore |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index ebd08b21b234..959b1cd89e6a 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -165,12 +165,16 @@ static void tx_poll_stop(struct vhost_net *net) | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | /* Caller must have TX VQ lock */ | 167 | /* Caller must have TX VQ lock */ |
| 168 | static void tx_poll_start(struct vhost_net *net, struct socket *sock) | 168 | static int tx_poll_start(struct vhost_net *net, struct socket *sock) |
| 169 | { | 169 | { |
| 170 | int ret; | ||
| 171 | |||
| 170 | if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED)) | 172 | if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED)) |
| 171 | return; | 173 | return 0; |
| 172 | vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file); | 174 | ret = vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file); |
| 173 | net->tx_poll_state = VHOST_NET_POLL_STARTED; | 175 | if (!ret) |
| 176 | net->tx_poll_state = VHOST_NET_POLL_STARTED; | ||
| 177 | return ret; | ||
| 174 | } | 178 | } |
| 175 | 179 | ||
| 176 | /* In case of DMA done not in order in lower device driver for some reason. | 180 | /* In case of DMA done not in order in lower device driver for some reason. |
| @@ -642,20 +646,23 @@ static void vhost_net_disable_vq(struct vhost_net *n, | |||
| 642 | vhost_poll_stop(n->poll + VHOST_NET_VQ_RX); | 646 | vhost_poll_stop(n->poll + VHOST_NET_VQ_RX); |
| 643 | } | 647 | } |
| 644 | 648 | ||
| 645 | static void vhost_net_enable_vq(struct vhost_net *n, | 649 | static int vhost_net_enable_vq(struct vhost_net *n, |
| 646 | struct vhost_virtqueue *vq) | 650 | struct vhost_virtqueue *vq) |
| 647 | { | 651 | { |
| 648 | struct socket *sock; | 652 | struct socket *sock; |
| 653 | int ret; | ||
| 649 | 654 | ||
| 650 | sock = rcu_dereference_protected(vq->private_data, | 655 | sock = rcu_dereference_protected(vq->private_data, |
| 651 | lockdep_is_held(&vq->mutex)); | 656 | lockdep_is_held(&vq->mutex)); |
| 652 | if (!sock) | 657 | if (!sock) |
| 653 | return; | 658 | return 0; |
| 654 | if (vq == n->vqs + VHOST_NET_VQ_TX) { | 659 | if (vq == n->vqs + VHOST_NET_VQ_TX) { |
| 655 | n->tx_poll_state = VHOST_NET_POLL_STOPPED; | 660 | n->tx_poll_state = VHOST_NET_POLL_STOPPED; |
| 656 | tx_poll_start(n, sock); | 661 | ret = tx_poll_start(n, sock); |
| 657 | } else | 662 | } else |
| 658 | vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file); | 663 | ret = vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file); |
| 664 | |||
| 665 | return ret; | ||
| 659 | } | 666 | } |
| 660 | 667 | ||
| 661 | static struct socket *vhost_net_stop_vq(struct vhost_net *n, | 668 | static struct socket *vhost_net_stop_vq(struct vhost_net *n, |
| @@ -827,15 +834,18 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) | |||
| 827 | r = PTR_ERR(ubufs); | 834 | r = PTR_ERR(ubufs); |
| 828 | goto err_ubufs; | 835 | goto err_ubufs; |
| 829 | } | 836 | } |
| 830 | oldubufs = vq->ubufs; | 837 | |
| 831 | vq->ubufs = ubufs; | ||
| 832 | vhost_net_disable_vq(n, vq); | 838 | vhost_net_disable_vq(n, vq); |
| 833 | rcu_assign_pointer(vq->private_data, sock); | 839 | rcu_assign_pointer(vq->private_data, sock); |
| 834 | vhost_net_enable_vq(n, vq); | ||
| 835 | |||
| 836 | r = vhost_init_used(vq); | 840 | r = vhost_init_used(vq); |
| 837 | if (r) | 841 | if (r) |
| 838 | goto err_vq; | 842 | goto err_used; |
| 843 | r = vhost_net_enable_vq(n, vq); | ||
| 844 | if (r) | ||
| 845 | goto err_used; | ||
| 846 | |||
| 847 | oldubufs = vq->ubufs; | ||
| 848 | vq->ubufs = ubufs; | ||
| 839 | 849 | ||
| 840 | n->tx_packets = 0; | 850 | n->tx_packets = 0; |
| 841 | n->tx_zcopy_err = 0; | 851 | n->tx_zcopy_err = 0; |
| @@ -859,6 +869,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) | |||
| 859 | mutex_unlock(&n->dev.mutex); | 869 | mutex_unlock(&n->dev.mutex); |
| 860 | return 0; | 870 | return 0; |
| 861 | 871 | ||
| 872 | err_used: | ||
| 873 | rcu_assign_pointer(vq->private_data, oldsock); | ||
| 874 | vhost_net_enable_vq(n, vq); | ||
| 875 | if (ubufs) | ||
| 876 | vhost_ubuf_put_and_wait(ubufs); | ||
| 862 | err_ubufs: | 877 | err_ubufs: |
| 863 | fput(sock->file); | 878 | fput(sock->file); |
| 864 | err_vq: | 879 | err_vq: |
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index b20df5c829f5..22321cf84fbe 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
| @@ -575,10 +575,8 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs) | |||
| 575 | 575 | ||
| 576 | /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */ | 576 | /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */ |
| 577 | tv_tpg = vs->vs_tpg; | 577 | tv_tpg = vs->vs_tpg; |
| 578 | if (unlikely(!tv_tpg)) { | 578 | if (unlikely(!tv_tpg)) |
| 579 | pr_err("%s endpoint not set\n", __func__); | ||
| 580 | return; | 579 | return; |
| 581 | } | ||
| 582 | 580 | ||
| 583 | mutex_lock(&vq->mutex); | 581 | mutex_lock(&vq->mutex); |
| 584 | vhost_disable_notify(&vs->dev, vq); | 582 | vhost_disable_notify(&vs->dev, vq); |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 34389f75fe65..9759249e6d90 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -77,26 +77,38 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, | |||
| 77 | init_poll_funcptr(&poll->table, vhost_poll_func); | 77 | init_poll_funcptr(&poll->table, vhost_poll_func); |
| 78 | poll->mask = mask; | 78 | poll->mask = mask; |
| 79 | poll->dev = dev; | 79 | poll->dev = dev; |
| 80 | poll->wqh = NULL; | ||
| 80 | 81 | ||
| 81 | vhost_work_init(&poll->work, fn); | 82 | vhost_work_init(&poll->work, fn); |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | /* Start polling a file. We add ourselves to file's wait queue. The caller must | 85 | /* Start polling a file. We add ourselves to file's wait queue. The caller must |
| 85 | * keep a reference to a file until after vhost_poll_stop is called. */ | 86 | * keep a reference to a file until after vhost_poll_stop is called. */ |
| 86 | void vhost_poll_start(struct vhost_poll *poll, struct file *file) | 87 | int vhost_poll_start(struct vhost_poll *poll, struct file *file) |
| 87 | { | 88 | { |
| 88 | unsigned long mask; | 89 | unsigned long mask; |
| 90 | int ret = 0; | ||
| 89 | 91 | ||
| 90 | mask = file->f_op->poll(file, &poll->table); | 92 | mask = file->f_op->poll(file, &poll->table); |
| 91 | if (mask) | 93 | if (mask) |
| 92 | vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask); | 94 | vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask); |
| 95 | if (mask & POLLERR) { | ||
| 96 | if (poll->wqh) | ||
| 97 | remove_wait_queue(poll->wqh, &poll->wait); | ||
| 98 | ret = -EINVAL; | ||
| 99 | } | ||
| 100 | |||
| 101 | return ret; | ||
| 93 | } | 102 | } |
| 94 | 103 | ||
| 95 | /* Stop polling a file. After this function returns, it becomes safe to drop the | 104 | /* Stop polling a file. After this function returns, it becomes safe to drop the |
| 96 | * file reference. You must also flush afterwards. */ | 105 | * file reference. You must also flush afterwards. */ |
| 97 | void vhost_poll_stop(struct vhost_poll *poll) | 106 | void vhost_poll_stop(struct vhost_poll *poll) |
| 98 | { | 107 | { |
| 99 | remove_wait_queue(poll->wqh, &poll->wait); | 108 | if (poll->wqh) { |
| 109 | remove_wait_queue(poll->wqh, &poll->wait); | ||
| 110 | poll->wqh = NULL; | ||
| 111 | } | ||
| 100 | } | 112 | } |
| 101 | 113 | ||
| 102 | static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, | 114 | static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, |
| @@ -792,7 +804,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) | |||
| 792 | fput(filep); | 804 | fput(filep); |
| 793 | 805 | ||
| 794 | if (pollstart && vq->handle_kick) | 806 | if (pollstart && vq->handle_kick) |
| 795 | vhost_poll_start(&vq->poll, vq->kick); | 807 | r = vhost_poll_start(&vq->poll, vq->kick); |
| 796 | 808 | ||
| 797 | mutex_unlock(&vq->mutex); | 809 | mutex_unlock(&vq->mutex); |
| 798 | 810 | ||
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 2639c58b23ab..17261e277c02 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
| @@ -42,7 +42,7 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work); | |||
| 42 | 42 | ||
| 43 | void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, | 43 | void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, |
| 44 | unsigned long mask, struct vhost_dev *dev); | 44 | unsigned long mask, struct vhost_dev *dev); |
| 45 | void vhost_poll_start(struct vhost_poll *poll, struct file *file); | 45 | int vhost_poll_start(struct vhost_poll *poll, struct file *file); |
| 46 | void vhost_poll_stop(struct vhost_poll *poll); | 46 | void vhost_poll_stop(struct vhost_poll *poll); |
| 47 | void vhost_poll_flush(struct vhost_poll *poll); | 47 | void vhost_poll_flush(struct vhost_poll *poll); |
| 48 | void vhost_poll_queue(struct vhost_poll *poll); | 48 | void vhost_poll_queue(struct vhost_poll *poll); |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 0be4df39e953..74d77dfa5f63 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -840,7 +840,7 @@ int bind_evtchn_to_irq(unsigned int evtchn) | |||
| 840 | 840 | ||
| 841 | if (irq == -1) { | 841 | if (irq == -1) { |
| 842 | irq = xen_allocate_irq_dynamic(); | 842 | irq = xen_allocate_irq_dynamic(); |
| 843 | if (irq == -1) | 843 | if (irq < 0) |
| 844 | goto out; | 844 | goto out; |
| 845 | 845 | ||
| 846 | irq_set_chip_and_handler_name(irq, &xen_dynamic_chip, | 846 | irq_set_chip_and_handler_name(irq, &xen_dynamic_chip, |
| @@ -944,7 +944,7 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
| 944 | 944 | ||
| 945 | if (irq == -1) { | 945 | if (irq == -1) { |
| 946 | irq = xen_allocate_irq_dynamic(); | 946 | irq = xen_allocate_irq_dynamic(); |
| 947 | if (irq == -1) | 947 | if (irq < 0) |
| 948 | goto out; | 948 | goto out; |
| 949 | 949 | ||
| 950 | irq_set_chip_and_handler_name(irq, &xen_percpu_chip, | 950 | irq_set_chip_and_handler_name(irq, &xen_percpu_chip, |
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 97f5d264c31e..37c1f825f513 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c | |||
| @@ -135,7 +135,6 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev, | |||
| 135 | struct pci_dev *dev, struct xen_pci_op *op) | 135 | struct pci_dev *dev, struct xen_pci_op *op) |
| 136 | { | 136 | { |
| 137 | struct xen_pcibk_dev_data *dev_data; | 137 | struct xen_pcibk_dev_data *dev_data; |
| 138 | int otherend = pdev->xdev->otherend_id; | ||
| 139 | int status; | 138 | int status; |
| 140 | 139 | ||
| 141 | if (unlikely(verbose_request)) | 140 | if (unlikely(verbose_request)) |
| @@ -144,8 +143,9 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev, | |||
| 144 | status = pci_enable_msi(dev); | 143 | status = pci_enable_msi(dev); |
| 145 | 144 | ||
| 146 | if (status) { | 145 | if (status) { |
| 147 | printk(KERN_ERR "error enable msi for guest %x status %x\n", | 146 | pr_warn_ratelimited(DRV_NAME ": %s: error enabling MSI for guest %u: err %d\n", |
| 148 | otherend, status); | 147 | pci_name(dev), pdev->xdev->otherend_id, |
| 148 | status); | ||
| 149 | op->value = 0; | 149 | op->value = 0; |
| 150 | return XEN_PCI_ERR_op_failed; | 150 | return XEN_PCI_ERR_op_failed; |
| 151 | } | 151 | } |
| @@ -223,10 +223,10 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, | |||
| 223 | pci_name(dev), i, | 223 | pci_name(dev), i, |
| 224 | op->msix_entries[i].vector); | 224 | op->msix_entries[i].vector); |
| 225 | } | 225 | } |
| 226 | } else { | 226 | } else |
| 227 | printk(KERN_WARNING DRV_NAME ": %s: failed to enable MSI-X: err %d!\n", | 227 | pr_warn_ratelimited(DRV_NAME ": %s: error enabling MSI-X for guest %u: err %d!\n", |
| 228 | pci_name(dev), result); | 228 | pci_name(dev), pdev->xdev->otherend_id, |
| 229 | } | 229 | result); |
| 230 | kfree(entries); | 230 | kfree(entries); |
| 231 | 231 | ||
| 232 | op->value = result; | 232 | op->value = result; |
