OSDN Git Service

phy: usb: phy-brcm-usb: Remove sysfs attributes upon driver removal
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 22 May 2019 18:35:25 +0000 (11:35 -0700)
committerKishon Vijay Abraham I <kishon@ti.com>
Wed, 12 Jun 2019 10:05:44 +0000 (15:35 +0530)
We are not destroying the sysfs attribute groupe we registered during
the probe function which will make subsequent probe calls to that
driver fail. Correct that with adding a remove function which only
removes those attributes since the reference counting on clocks did its
job already.

Fixes: 415060b21f31 ("phy: usb: phy-brcm-usb: Add ability to force DRD mode to host or device")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/broadcom/phy-brcm-usb.c

index f59b1dc..292d5b3 100644 (file)
@@ -376,6 +376,13 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
        return PTR_ERR_OR_ZERO(phy_provider);
 }
 
+static int brcm_usb_phy_remove(struct platform_device *pdev)
+{
+       sysfs_remove_group(&pdev->dev.kobj, &brcm_usb_phy_group);
+
+       return 0;
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int brcm_usb_phy_suspend(struct device *dev)
 {
@@ -441,6 +448,7 @@ MODULE_DEVICE_TABLE(of, brcm_usb_dt_ids);
 
 static struct platform_driver brcm_usb_driver = {
        .probe          = brcm_usb_phy_probe,
+       .remove         = brcm_usb_phy_remove,
        .driver         = {
                .name   = "brcmstb-usb-phy",
                .owner  = THIS_MODULE,