diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-01-24 13:35:24 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-24 19:00:35 -0500 |
commit | f3ff9247088a0af0c192a28908dab76ff3d8871f (patch) | |
tree | 4ff2c822bcf82213d14b2195d4f00fe470876b1d | |
parent | 9f30ea950edfaefa51221dd26a065b3442599778 (diff) |
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: Alan 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: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/net/phy/phy_device.c | 6 | ||||
-rw-r--r-- | drivers/pci/xen-pcifront.c | 3 | ||||
-rw-r--r-- | drivers/ssb/main.c | 20 | ||||
-rw-r--r-- | lib/dma-debug.c | 3 |
4 files changed, 5 insertions, 27 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f320f466f03b..e8c42d6a7d1c 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -915,9 +915,7 @@ static int phy_probe(struct device *dev) | |||
915 | 915 | ||
916 | phydev = to_phy_device(dev); | 916 | phydev = to_phy_device(dev); |
917 | 917 | ||
918 | /* Make sure the driver is held. | 918 | drv = phydev->dev.driver; |
919 | * XXX -- Is this correct? */ | ||
920 | drv = get_driver(phydev->dev.driver); | ||
921 | phydrv = to_phy_driver(drv); | 919 | phydrv = to_phy_driver(drv); |
922 | phydev->drv = phydrv; | 920 | phydev->drv = phydrv; |
923 | 921 | ||
@@ -957,8 +955,6 @@ static int phy_remove(struct device *dev) | |||
957 | 955 | ||
958 | if (phydev->drv->remove) | 956 | if (phydev->drv->remove) |
959 | phydev->drv->remove(phydev); | 957 | phydev->drv->remove(phydev); |
960 | |||
961 | put_driver(dev->driver); | ||
962 | phydev->drv = NULL; | 958 | phydev->drv = NULL; |
963 | 959 | ||
964 | return 0; | 960 | return 0; |
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 7cf3d2fcf56a..6f819988a8da 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -593,7 +593,7 @@ static pci_ers_result_t pcifront_common_process(int cmd, | |||
593 | } | 593 | } |
594 | pdrv = pcidev->driver; | 594 | pdrv = pcidev->driver; |
595 | 595 | ||
596 | if (get_driver(&pdrv->driver)) { | 596 | if (pdrv->driver) { |
597 | if (pdrv->err_handler && pdrv->err_handler->error_detected) { | 597 | if (pdrv->err_handler && pdrv->err_handler->error_detected) { |
598 | dev_dbg(&pcidev->dev, | 598 | dev_dbg(&pcidev->dev, |
599 | "trying to call AER service\n"); | 599 | "trying to call AER service\n"); |
@@ -623,7 +623,6 @@ static pci_ers_result_t pcifront_common_process(int cmd, | |||
623 | } | 623 | } |
624 | } | 624 | } |
625 | } | 625 | } |
626 | put_driver(&pdrv->driver); | ||
627 | } | 626 | } |
628 | if (!flag) | 627 | if (!flag) |
629 | result = PCI_ERS_RESULT_NONE; | 628 | result = PCI_ERS_RESULT_NONE; |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index bb6317fb925c..ff109ae94767 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -140,19 +140,6 @@ static void ssb_device_put(struct ssb_device *dev) | |||
140 | put_device(dev->dev); | 140 | put_device(dev->dev); |
141 | } | 141 | } |
142 | 142 | ||
143 | static inline struct ssb_driver *ssb_driver_get(struct ssb_driver *drv) | ||
144 | { | ||
145 | if (drv) | ||
146 | get_driver(&drv->drv); | ||
147 | return drv; | ||
148 | } | ||
149 | |||
150 | static inline void ssb_driver_put(struct ssb_driver *drv) | ||
151 | { | ||
152 | if (drv) | ||
153 | put_driver(&drv->drv); | ||
154 | } | ||
155 | |||
156 | static int ssb_device_resume(struct device *dev) | 143 | static int ssb_device_resume(struct device *dev) |
157 | { | 144 | { |
158 | struct ssb_device *ssb_dev = dev_to_ssb_dev(dev); | 145 | 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 | ssb_device_put(sdev); | 237 | ssb_device_put(sdev); |
251 | continue; | 238 | continue; |
252 | } | 239 | } |
253 | sdrv = ssb_driver_get(drv_to_ssb_drv(sdev->dev->driver)); | 240 | sdrv = drv_to_ssb_drv(sdev->dev->driver); |
254 | if (!sdrv || SSB_WARN_ON(!sdrv->remove)) { | 241 | if (SSB_WARN_ON(!sdrv->remove)) |
255 | ssb_device_put(sdev); | ||
256 | continue; | 242 | continue; |
257 | } | ||
258 | sdrv->remove(sdev); | 243 | sdrv->remove(sdev); |
259 | ctx->device_frozen[i] = 1; | 244 | ctx->device_frozen[i] = 1; |
260 | } | 245 | } |
@@ -293,7 +278,6 @@ int ssb_devices_thaw(struct ssb_freeze_context *ctx) | |||
293 | dev_name(sdev->dev)); | 278 | dev_name(sdev->dev)); |
294 | result = err; | 279 | result = err; |
295 | } | 280 | } |
296 | ssb_driver_put(sdrv); | ||
297 | ssb_device_put(sdev); | 281 | ssb_device_put(sdev); |
298 | } | 282 | } |
299 | 283 | ||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index fea790a2b176..13ef2338be41 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -170,7 +170,7 @@ static bool driver_filter(struct device *dev) | |||
170 | return false; | 170 | return false; |
171 | 171 | ||
172 | /* driver filter on but not yet initialized */ | 172 | /* driver filter on but not yet initialized */ |
173 | drv = get_driver(dev->driver); | 173 | drv = dev->driver; |
174 | if (!drv) | 174 | if (!drv) |
175 | return false; | 175 | return false; |
176 | 176 | ||
@@ -185,7 +185,6 @@ static bool driver_filter(struct device *dev) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | read_unlock_irqrestore(&driver_name_lock, flags); | 187 | read_unlock_irqrestore(&driver_name_lock, flags); |
188 | put_driver(drv); | ||
189 | 188 | ||
190 | return ret; | 189 | return ret; |
191 | } | 190 | } |