Staging: ipack: remove field driver from struct ipack_device.
authorJens Taprogge <jens.taprogge@taprogge.org>
Tue, 11 Sep 2012 11:34:59 +0000 (13:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Sep 2012 19:16:35 +0000 (12:16 -0700)
After a successful match is found the driver field in struct device is
set by the core device code. We can use this field.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ipack/ipack.c
drivers/staging/ipack/ipack.h

index 1ad73e5c70bacfe589d4878e0c9d8415f88901c9..689542638aaea76d6f0d68cb744c75da104606f8 100644 (file)
@@ -59,32 +59,29 @@ static int ipack_bus_match(struct device *dev, struct device_driver *drv)
        const struct ipack_device_id *found_id;
 
        found_id = ipack_match_id(idrv->id_table, idev);
-       if (found_id) {
-               idev->driver = idrv;
-               return 1;
-       }
-
-       return 0;
+       return found_id ? 1 : 0;
 }
 
 static int ipack_bus_probe(struct device *device)
 {
        struct ipack_device *dev = to_ipack_dev(device);
+       struct ipack_driver *drv = to_ipack_driver(device->driver);
 
-       if (!dev->driver->ops->probe)
+       if (!drv->ops->probe)
                return -EINVAL;
 
-       return dev->driver->ops->probe(dev);
+       return drv->ops->probe(dev);
 }
 
 static int ipack_bus_remove(struct device *device)
 {
        struct ipack_device *dev = to_ipack_dev(device);
+       struct ipack_driver *drv = to_ipack_driver(device->driver);
 
-       if (!dev->driver->ops->remove)
+       if (!drv->ops->remove)
                return -EINVAL;
 
-       dev->driver->ops->remove(dev);
+       drv->ops->remove(dev);
        return 0;
 }
 
index 89af9e4ee0dc6a56eaed8285cae14bcfedc026ca..ad4c3bf14f1315262d8c970b2645a026905d2047 100644 (file)
@@ -53,7 +53,6 @@ struct ipack_addr_space {
  *     @bus_nr: IP bus number where the device is plugged
  *     @slot: Slot where the device is plugged in the carrier board
  *     @irq: IRQ vector
- *     @driver: Pointer to the ipack_driver that manages the device
  *     @bus: ipack_bus_device where the device is plugged to.
  *     @id_space: Virtual address to ID space.
  *     @io_space: Virtual address to IO space.
@@ -68,7 +67,6 @@ struct ipack_device {
        unsigned int bus_nr;
        unsigned int slot;
        unsigned int irq;
-       struct ipack_driver *driver;
        struct ipack_bus_device *bus;
        struct ipack_addr_space id_space;
        struct ipack_addr_space io_space;