diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-01 12:18:17 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-01 12:18:17 -0400 |
| commit | 0232b23d084bd075cee0812242323bbd1f4d0763 (patch) | |
| tree | cd066031c45aaefd344d775a61b79fcd88c61e5a | |
| parent | aa7a6c8e5252ba28f36a8f87b9acd6a726aa3ae5 (diff) | |
| parent | ab2a4bf83902c170d29ba130a8abb5f9d90559e1 (diff) | |
Merge tag 'usb-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB and PHY fixes from Greg KH:
"Here are a number of small USB and PHY driver fixes for 4.7-rc6.
Nothing major here, all are described in the shortlog below. All have
been in linux-next with no reported issues"
* tag 'usb-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: don't free bandwidth_mutex too early
USB: EHCI: declare hostpc register as zero-length array
phy-sun4i-usb: Fix irq free conditions to match request conditions
phy: bcm-ns-usb2: checking the wrong variable
phy-sun4i-usb: fix missing __iomem *
phy: phy-sun4i-usb: Fix optional gpios failing probe
phy: rockchip-dp: fix return value check in rockchip_dp_phy_probe()
phy: rcar-gen3-usb2: fix unexpected repeat interrupts of VBUS change
usb: common: otg-fsm: add license to usb-otg-fsm
| -rw-r--r-- | drivers/phy/phy-bcm-ns-usb2.c | 4 | ||||
| -rw-r--r-- | drivers/phy/phy-rcar-gen3-usb2.c | 14 | ||||
| -rw-r--r-- | drivers/phy/phy-rockchip-dp.c | 2 | ||||
| -rw-r--r-- | drivers/phy/phy-sun4i-usb.c | 14 | ||||
| -rw-r--r-- | drivers/usb/common/usb-otg-fsm.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/hcd.c | 17 | ||||
| -rw-r--r-- | include/linux/usb/ehci_def.h | 4 |
7 files changed, 22 insertions, 35 deletions
diff --git a/drivers/phy/phy-bcm-ns-usb2.c b/drivers/phy/phy-bcm-ns-usb2.c index 95ab6b2a0de5..58dff80e9386 100644 --- a/drivers/phy/phy-bcm-ns-usb2.c +++ b/drivers/phy/phy-bcm-ns-usb2.c | |||
| @@ -109,8 +109,8 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | usb2->phy = devm_phy_create(dev, NULL, &ops); | 111 | usb2->phy = devm_phy_create(dev, NULL, &ops); |
| 112 | if (IS_ERR(dev)) | 112 | if (IS_ERR(usb2->phy)) |
| 113 | return PTR_ERR(dev); | 113 | return PTR_ERR(usb2->phy); |
| 114 | 114 | ||
| 115 | phy_set_drvdata(usb2->phy, usb2); | 115 | phy_set_drvdata(usb2->phy, usb2); |
| 116 | platform_set_drvdata(pdev, usb2); | 116 | platform_set_drvdata(pdev, usb2); |
diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c index 76bb88f0700a..4be3f5dbbc9f 100644 --- a/drivers/phy/phy-rcar-gen3-usb2.c +++ b/drivers/phy/phy-rcar-gen3-usb2.c | |||
| @@ -144,12 +144,6 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch) | |||
| 144 | extcon_set_cable_state_(ch->extcon, EXTCON_USB, true); | 144 | extcon_set_cable_state_(ch->extcon, EXTCON_USB, true); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch) | ||
| 148 | { | ||
| 149 | return !!(readl(ch->base + USB2_ADPCTRL) & | ||
| 150 | USB2_ADPCTRL_OTGSESSVLD); | ||
| 151 | } | ||
| 152 | |||
| 153 | static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) | 147 | static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) |
| 154 | { | 148 | { |
| 155 | return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG); | 149 | return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG); |
| @@ -157,13 +151,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) | |||
| 157 | 151 | ||
| 158 | static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) | 152 | static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) |
| 159 | { | 153 | { |
| 160 | bool is_host = true; | 154 | if (!rcar_gen3_check_id(ch)) |
| 161 | |||
| 162 | /* B-device? */ | ||
| 163 | if (rcar_gen3_check_id(ch) && rcar_gen3_check_vbus(ch)) | ||
| 164 | is_host = false; | ||
| 165 | |||
| 166 | if (is_host) | ||
| 167 | rcar_gen3_init_for_host(ch); | 155 | rcar_gen3_init_for_host(ch); |
| 168 | else | 156 | else |
| 169 | rcar_gen3_init_for_peri(ch); | 157 | rcar_gen3_init_for_peri(ch); |
diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c index 793ecb6d87bc..8b267a746576 100644 --- a/drivers/phy/phy-rockchip-dp.c +++ b/drivers/phy/phy-rockchip-dp.c | |||
| @@ -90,7 +90,7 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) | |||
| 90 | return -ENODEV; | 90 | return -ENODEV; |
| 91 | 91 | ||
| 92 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); | 92 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); |
| 93 | if (IS_ERR(dp)) | 93 | if (!dp) |
| 94 | return -ENOMEM; | 94 | return -ENOMEM; |
| 95 | 95 | ||
| 96 | dp->dev = dev; | 96 | dp->dev = dev; |
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index bae54f7a1f48..de3101fbbf40 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
| @@ -175,7 +175,7 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data, | |||
| 175 | { | 175 | { |
| 176 | struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy); | 176 | struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy); |
| 177 | u32 temp, usbc_bit = BIT(phy->index * 2); | 177 | u32 temp, usbc_bit = BIT(phy->index * 2); |
| 178 | void *phyctl = phy_data->base + phy_data->cfg->phyctl_offset; | 178 | void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset; |
| 179 | int i; | 179 | int i; |
| 180 | 180 | ||
| 181 | mutex_lock(&phy_data->mutex); | 181 | mutex_lock(&phy_data->mutex); |
| @@ -514,9 +514,9 @@ static int sun4i_usb_phy_remove(struct platform_device *pdev) | |||
| 514 | 514 | ||
| 515 | if (data->vbus_power_nb_registered) | 515 | if (data->vbus_power_nb_registered) |
| 516 | power_supply_unreg_notifier(&data->vbus_power_nb); | 516 | power_supply_unreg_notifier(&data->vbus_power_nb); |
| 517 | if (data->id_det_irq >= 0) | 517 | if (data->id_det_irq > 0) |
| 518 | devm_free_irq(dev, data->id_det_irq, data); | 518 | devm_free_irq(dev, data->id_det_irq, data); |
| 519 | if (data->vbus_det_irq >= 0) | 519 | if (data->vbus_det_irq > 0) |
| 520 | devm_free_irq(dev, data->vbus_det_irq, data); | 520 | devm_free_irq(dev, data->vbus_det_irq, data); |
| 521 | 521 | ||
| 522 | cancel_delayed_work_sync(&data->detect); | 522 | cancel_delayed_work_sync(&data->detect); |
| @@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) | |||
| 645 | 645 | ||
| 646 | data->id_det_irq = gpiod_to_irq(data->id_det_gpio); | 646 | data->id_det_irq = gpiod_to_irq(data->id_det_gpio); |
| 647 | data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio); | 647 | data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio); |
| 648 | if ((data->id_det_gpio && data->id_det_irq < 0) || | 648 | if ((data->id_det_gpio && data->id_det_irq <= 0) || |
| 649 | (data->vbus_det_gpio && data->vbus_det_irq < 0)) | 649 | (data->vbus_det_gpio && data->vbus_det_irq <= 0)) |
| 650 | data->phy0_poll = true; | 650 | data->phy0_poll = true; |
| 651 | 651 | ||
| 652 | if (data->id_det_irq >= 0) { | 652 | if (data->id_det_irq > 0) { |
| 653 | ret = devm_request_irq(dev, data->id_det_irq, | 653 | ret = devm_request_irq(dev, data->id_det_irq, |
| 654 | sun4i_usb_phy0_id_vbus_det_irq, | 654 | sun4i_usb_phy0_id_vbus_det_irq, |
| 655 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 655 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| @@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) | |||
| 660 | } | 660 | } |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | if (data->vbus_det_irq >= 0) { | 663 | if (data->vbus_det_irq > 0) { |
| 664 | ret = devm_request_irq(dev, data->vbus_det_irq, | 664 | ret = devm_request_irq(dev, data->vbus_det_irq, |
| 665 | sun4i_usb_phy0_id_vbus_det_irq, | 665 | sun4i_usb_phy0_id_vbus_det_irq, |
| 666 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 666 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 9059b7dc185e..2f537bbdda09 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <linux/module.h> | ||
| 24 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 26 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| @@ -450,3 +451,4 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
| 450 | return fsm->state_changed; | 451 | return fsm->state_changed; |
| 451 | } | 452 | } |
| 452 | EXPORT_SYMBOL_GPL(otg_statemachine); | 453 | EXPORT_SYMBOL_GPL(otg_statemachine); |
| 454 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 34b837ae1ed7..d2e3f655c26f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -2598,26 +2598,23 @@ EXPORT_SYMBOL_GPL(usb_create_hcd); | |||
| 2598 | * Don't deallocate the bandwidth_mutex until the last shared usb_hcd is | 2598 | * Don't deallocate the bandwidth_mutex until the last shared usb_hcd is |
| 2599 | * deallocated. | 2599 | * deallocated. |
| 2600 | * | 2600 | * |
| 2601 | * Make sure to only deallocate the bandwidth_mutex when the primary HCD is | 2601 | * Make sure to deallocate the bandwidth_mutex only when the last HCD is |
| 2602 | * freed. When hcd_release() is called for either hcd in a peer set | 2602 | * freed. When hcd_release() is called for either hcd in a peer set, |
| 2603 | * invalidate the peer's ->shared_hcd and ->primary_hcd pointers to | 2603 | * invalidate the peer's ->shared_hcd and ->primary_hcd pointers. |
| 2604 | * block new peering attempts | ||
| 2605 | */ | 2604 | */ |
| 2606 | static void hcd_release(struct kref *kref) | 2605 | static void hcd_release(struct kref *kref) |
| 2607 | { | 2606 | { |
| 2608 | struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); | 2607 | struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); |
| 2609 | 2608 | ||
| 2610 | mutex_lock(&usb_port_peer_mutex); | 2609 | mutex_lock(&usb_port_peer_mutex); |
| 2611 | if (usb_hcd_is_primary_hcd(hcd)) { | ||
| 2612 | kfree(hcd->address0_mutex); | ||
| 2613 | kfree(hcd->bandwidth_mutex); | ||
| 2614 | } | ||
| 2615 | if (hcd->shared_hcd) { | 2610 | if (hcd->shared_hcd) { |
| 2616 | struct usb_hcd *peer = hcd->shared_hcd; | 2611 | struct usb_hcd *peer = hcd->shared_hcd; |
| 2617 | 2612 | ||
| 2618 | peer->shared_hcd = NULL; | 2613 | peer->shared_hcd = NULL; |
| 2619 | if (peer->primary_hcd == hcd) | 2614 | peer->primary_hcd = NULL; |
| 2620 | peer->primary_hcd = NULL; | 2615 | } else { |
| 2616 | kfree(hcd->address0_mutex); | ||
| 2617 | kfree(hcd->bandwidth_mutex); | ||
| 2621 | } | 2618 | } |
| 2622 | mutex_unlock(&usb_port_peer_mutex); | 2619 | mutex_unlock(&usb_port_peer_mutex); |
| 2623 | kfree(hcd); | 2620 | kfree(hcd); |
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h index 966889a20ea3..e479033bd782 100644 --- a/include/linux/usb/ehci_def.h +++ b/include/linux/usb/ehci_def.h | |||
| @@ -180,11 +180,11 @@ struct ehci_regs { | |||
| 180 | * PORTSCx | 180 | * PORTSCx |
| 181 | */ | 181 | */ |
| 182 | /* HOSTPC: offset 0x84 */ | 182 | /* HOSTPC: offset 0x84 */ |
| 183 | u32 hostpc[1]; /* HOSTPC extension */ | 183 | u32 hostpc[0]; /* HOSTPC extension */ |
| 184 | #define HOSTPC_PHCD (1<<22) /* Phy clock disable */ | 184 | #define HOSTPC_PHCD (1<<22) /* Phy clock disable */ |
| 185 | #define HOSTPC_PSPD (3<<25) /* Port speed detection */ | 185 | #define HOSTPC_PSPD (3<<25) /* Port speed detection */ |
| 186 | 186 | ||
| 187 | u32 reserved5[16]; | 187 | u32 reserved5[17]; |
| 188 | 188 | ||
| 189 | /* USBMODE_EX: offset 0xc8 */ | 189 | /* USBMODE_EX: offset 0xc8 */ |
| 190 | u32 usbmode_ex; /* USB Device mode extension */ | 190 | u32 usbmode_ex; /* USB Device mode extension */ |
