Skip to content

Commit c8c1025

Browse files
mszyprowFelipe Balbi
authored andcommitted
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" f65f0f1) 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 <[email protected]> Signed-off-by: Robert Baldyga <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 7f2ccc8 commit c8c1025

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/usb/gadget/s3c-hsotg.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,25 +2962,22 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
29622962
if (!hsotg)
29632963
return -ENODEV;
29642964

2965-
if (!driver || driver != hsotg->driver || !driver->unbind)
2966-
return -EINVAL;
2967-
29682965
/* all endpoints should be shutdown */
29692966
for (ep = 0; ep < hsotg->num_of_eps; ep++)
29702967
s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
29712968

29722969
spin_lock_irqsave(&hsotg->lock, flags);
29732970

29742971
s3c_hsotg_phy_disable(hsotg);
2975-
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
29762972

2977-
hsotg->driver = NULL;
2973+
if (!driver)
2974+
hsotg->driver = NULL;
2975+
29782976
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
29792977

29802978
spin_unlock_irqrestore(&hsotg->lock, flags);
29812979

2982-
dev_info(hsotg->dev, "unregistered gadget driver '%s'\n",
2983-
driver->driver.name);
2980+
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
29842981

29852982
return 0;
29862983
}

0 commit comments

Comments
 (0)