Commit f3ff9247 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

Remove useless get_driver()/put_driver() calls

As part of the removal of get_driver()/put_driver(), this patch
(as1512) gets rid of various useless and unnecessary calls in several
drivers.  In some cases it may be desirable to pin the driver by
calling try_module_get(), but that can be done later.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
CC: "David S. Miller" <davem@davemloft.net>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Michael Buesch <m@bues.ch>
CC: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9f30ea95
...@@ -915,9 +915,7 @@ static int phy_probe(struct device *dev) ...@@ -915,9 +915,7 @@ static int phy_probe(struct device *dev)
phydev = to_phy_device(dev); phydev = to_phy_device(dev);
/* Make sure the driver is held. drv = phydev->dev.driver;
* XXX -- Is this correct? */
drv = get_driver(phydev->dev.driver);
phydrv = to_phy_driver(drv); phydrv = to_phy_driver(drv);
phydev->drv = phydrv; phydev->drv = phydrv;
...@@ -957,8 +955,6 @@ static int phy_remove(struct device *dev) ...@@ -957,8 +955,6 @@ static int phy_remove(struct device *dev)
if (phydev->drv->remove) if (phydev->drv->remove)
phydev->drv->remove(phydev); phydev->drv->remove(phydev);
put_driver(dev->driver);
phydev->drv = NULL; phydev->drv = NULL;
return 0; return 0;
......
...@@ -593,7 +593,7 @@ static pci_ers_result_t pcifront_common_process(int cmd, ...@@ -593,7 +593,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
} }
pdrv = pcidev->driver; pdrv = pcidev->driver;
if (get_driver(&pdrv->driver)) { if (pdrv->driver) {
if (pdrv->err_handler && pdrv->err_handler->error_detected) { if (pdrv->err_handler && pdrv->err_handler->error_detected) {
dev_dbg(&pcidev->dev, dev_dbg(&pcidev->dev,
"trying to call AER service\n"); "trying to call AER service\n");
...@@ -623,7 +623,6 @@ static pci_ers_result_t pcifront_common_process(int cmd, ...@@ -623,7 +623,6 @@ static pci_ers_result_t pcifront_common_process(int cmd,
} }
} }
} }
put_driver(&pdrv->driver);
} }
if (!flag) if (!flag)
result = PCI_ERS_RESULT_NONE; result = PCI_ERS_RESULT_NONE;
......
...@@ -140,19 +140,6 @@ static void ssb_device_put(struct ssb_device *dev) ...@@ -140,19 +140,6 @@ static void ssb_device_put(struct ssb_device *dev)
put_device(dev->dev); put_device(dev->dev);
} }
static inline struct ssb_driver *ssb_driver_get(struct ssb_driver *drv)
{
if (drv)
get_driver(&drv->drv);
return drv;
}
static inline void ssb_driver_put(struct ssb_driver *drv)
{
if (drv)
put_driver(&drv->drv);
}
static int ssb_device_resume(struct device *dev) static int ssb_device_resume(struct device *dev)
{ {
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev); struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
...@@ -250,11 +237,9 @@ int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx) ...@@ -250,11 +237,9 @@ int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
ssb_device_put(sdev); ssb_device_put(sdev);
continue; continue;
} }
sdrv = ssb_driver_get(drv_to_ssb_drv(sdev->dev->driver)); sdrv = drv_to_ssb_drv(sdev->dev->driver);
if (!sdrv || SSB_WARN_ON(!sdrv->remove)) { if (SSB_WARN_ON(!sdrv->remove))
ssb_device_put(sdev);
continue; continue;
}
sdrv->remove(sdev); sdrv->remove(sdev);
ctx->device_frozen[i] = 1; ctx->device_frozen[i] = 1;
} }
...@@ -293,7 +278,6 @@ int ssb_devices_thaw(struct ssb_freeze_context *ctx) ...@@ -293,7 +278,6 @@ int ssb_devices_thaw(struct ssb_freeze_context *ctx)
dev_name(sdev->dev)); dev_name(sdev->dev));
result = err; result = err;
} }
ssb_driver_put(sdrv);
ssb_device_put(sdev); ssb_device_put(sdev);
} }
......
...@@ -170,7 +170,7 @@ static bool driver_filter(struct device *dev) ...@@ -170,7 +170,7 @@ static bool driver_filter(struct device *dev)
return false; return false;
/* driver filter on but not yet initialized */ /* driver filter on but not yet initialized */
drv = get_driver(dev->driver); drv = dev->driver;
if (!drv) if (!drv)
return false; return false;
...@@ -185,7 +185,6 @@ static bool driver_filter(struct device *dev) ...@@ -185,7 +185,6 @@ static bool driver_filter(struct device *dev)
} }
read_unlock_irqrestore(&driver_name_lock, flags); read_unlock_irqrestore(&driver_name_lock, flags);
put_driver(drv);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment