Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: misc: usb3503: Clean up on driver unbind

The driver should clean up after itself by unpreparing the clock when it
is unbound.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Krzysztof Kozlowski and committed by
Greg Kroah-Hartman
62c32e46 495660cb

+24
+24
drivers/usb/misc/usb3503.c
··· 330 330 return usb3503_probe(hub); 331 331 } 332 332 333 + static int usb3503_i2c_remove(struct i2c_client *i2c) 334 + { 335 + struct usb3503 *hub; 336 + 337 + hub = i2c_get_clientdata(i2c); 338 + if (hub->clk) 339 + clk_disable_unprepare(hub->clk); 340 + 341 + return 0; 342 + } 343 + 333 344 static int usb3503_platform_probe(struct platform_device *pdev) 334 345 { 335 346 struct usb3503 *hub; ··· 352 341 platform_set_drvdata(pdev, hub); 353 342 354 343 return usb3503_probe(hub); 344 + } 345 + 346 + static int usb3503_platform_remove(struct platform_device *pdev) 347 + { 348 + struct usb3503 *hub; 349 + 350 + hub = platform_get_drvdata(pdev); 351 + if (hub->clk) 352 + clk_disable_unprepare(hub->clk); 353 + 354 + return 0; 355 355 } 356 356 357 357 #ifdef CONFIG_PM_SLEEP ··· 418 396 .of_match_table = of_match_ptr(usb3503_of_match), 419 397 }, 420 398 .probe = usb3503_i2c_probe, 399 + .remove = usb3503_i2c_remove, 421 400 .id_table = usb3503_id, 422 401 }; 423 402 ··· 428 405 .of_match_table = of_match_ptr(usb3503_of_match), 429 406 }, 430 407 .probe = usb3503_platform_probe, 408 + .remove = usb3503_platform_remove, 431 409 }; 432 410 433 411 static int __init usb3503_init(void)