diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2013-09-12 10:18:48 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-09-17 12:08:45 -0400 |
commit | c8c10253d8706be7ce8bc8197e385cb837eed5a0 (patch) | |
tree | 589ef107d975f930b8e5afabfbab2da03ae02df8 /drivers/usb | |
parent | 7f2ccc8cb28cb3ec2f114486a3ccd57deae1560f (diff) |
usb: s3c-hsotg: fix unregistration function
After driver conversion to udc_start/udc_stop infrastructure (commit
"usb:hsotg:samsung: Use new udc_start and udc_stop callbacks"
f65f0f1098) the gadget unregistration function is almost always called
with 'driver' parameter being NULL, what caused that the unregistration
code has not been executed at all. This is a leftover from the earlier
verison of this function (which used simple start/stop interface), where
driver parameter was obligatory.
This patch removes the NULL check for the 'driver' pointer and removes
all dereferences of it. It also moves disabling voltage regulators out
of the atomic context, because handling regulators (which are usually
i2c devices) might require sleeping.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/s3c-hsotg.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index d69b36a99dbc..91b1263327b2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -2962,9 +2962,6 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2962 | if (!hsotg) | 2962 | if (!hsotg) |
2963 | return -ENODEV; | 2963 | return -ENODEV; |
2964 | 2964 | ||
2965 | if (!driver || driver != hsotg->driver || !driver->unbind) | ||
2966 | return -EINVAL; | ||
2967 | |||
2968 | /* all endpoints should be shutdown */ | 2965 | /* all endpoints should be shutdown */ |
2969 | for (ep = 0; ep < hsotg->num_of_eps; ep++) | 2966 | for (ep = 0; ep < hsotg->num_of_eps; ep++) |
2970 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2967 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); |
@@ -2972,15 +2969,15 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2972 | spin_lock_irqsave(&hsotg->lock, flags); | 2969 | spin_lock_irqsave(&hsotg->lock, flags); |
2973 | 2970 | ||
2974 | s3c_hsotg_phy_disable(hsotg); | 2971 | s3c_hsotg_phy_disable(hsotg); |
2975 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); | ||
2976 | 2972 | ||
2977 | hsotg->driver = NULL; | 2973 | if (!driver) |
2974 | hsotg->driver = NULL; | ||
2975 | |||
2978 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; | 2976 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; |
2979 | 2977 | ||
2980 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2978 | spin_unlock_irqrestore(&hsotg->lock, flags); |
2981 | 2979 | ||
2982 | dev_info(hsotg->dev, "unregistered gadget driver '%s'\n", | 2980 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); |
2983 | driver->driver.name); | ||
2984 | 2981 | ||
2985 | return 0; | 2982 | return 0; |
2986 | } | 2983 | } |