nfsd4: allow setting grace period time
[safe/jmp/linux-2.6] / drivers / dio / dio-driver.c
index ffe6f44..a7b174e 100644 (file)
 #include <linux/dio.h>
 
 
-       /**
-        *  dio_match_device - Tell if a DIO device structure has a matching
-        *                     DIO device id structure
-        *  @ids: array of DIO device id structures to search in
-        *  @dev: the DIO device structure to match against
-        *
-        *  Used by a driver to check whether a DIO device present in the
-        *  system is in its list of supported devices. Returns the matching
-        *  dio_device_id structure or %NULL if there is no match.
-        */
+/**
+ *  dio_match_device - Tell if a DIO device structure has a matching DIO device id structure
+ *  @ids: array of DIO device id structures to search in
+ *  @d: the DIO device structure to match against
+ *
+ *  Used by a driver to check whether a DIO device present in the
+ *  system is in its list of supported devices. Returns the matching
+ *  dio_device_id structure or %NULL if there is no match.
+ */
 
 const struct dio_device_id *
 dio_match_device(const struct dio_device_id *ids,
@@ -66,40 +65,34 @@ static int dio_device_probe(struct device *dev)
 }
 
 
-       /**
-        *  dio_register_driver - register a new DIO driver
-        *  @drv: the driver structure to register
-        *
-        *  Adds the driver structure to the list of registered drivers
-        *  Returns the number of DIO devices which were claimed by the driver
-        *  during registration.  The driver remains registered even if the
-        *  return value is zero.
-        */
+/**
+ *  dio_register_driver - register a new DIO driver
+ *  @drv: the driver structure to register
+ *
+ *  Adds the driver structure to the list of registered drivers
+ *  Returns zero or a negative error value.
+ */
 
 int dio_register_driver(struct dio_driver *drv)
 {
-       int count = 0;
-
        /* initialize common driver fields */
        drv->driver.name = drv->name;
        drv->driver.bus = &dio_bus_type;
-       drv->driver.probe = dio_device_probe;
 
        /* register with core */
-       count = driver_register(&drv->driver);
-       return count ? count : 1;
+       return driver_register(&drv->driver);
 }
 
 
-       /**
       *  dio_unregister_driver - unregister a DIO driver
       *  @drv: the driver structure to unregister
       *
       *  Deletes the driver structure from the list of registered DIO drivers,
       *  gives it a chance to clean up by calling its remove() function for
       *  each device it was responsible for, and marks those devices as
       *  driverless.
       */
+/**
+ *  dio_unregister_driver - unregister a DIO driver
+ *  @drv: the driver structure to unregister
+ *
+ *  Deletes the driver structure from the list of registered DIO drivers,
+ *  gives it a chance to clean up by calling its remove() function for
+ *  each device it was responsible for, and marks those devices as
+ *  driverless.
+ */
 
 void dio_unregister_driver(struct dio_driver *drv)
 {
@@ -107,16 +100,15 @@ void dio_unregister_driver(struct dio_driver *drv)
 }
 
 
-       /**
-        *  dio_bus_match - Tell if a DIO device structure has a matching DIO
-        *                  device id structure
-        *  @ids: array of DIO device id structures to search in
-        *  @dev: the DIO device structure to match against
-        *
-        *  Used by a driver to check whether a DIO device present in the
-        *  system is in its list of supported devices. Returns the matching
-        *  dio_device_id structure or %NULL if there is no match.
-        */
+/**
+ *  dio_bus_match - Tell if a DIO device structure has a matching DIO device id structure
+ *  @dev: the DIO device structure to match against
+ *  @drv: the &device_driver that points to the array of DIO device id structures to search
+ *
+ *  Used by a driver to check whether a DIO device present in the
+ *  system is in its list of supported devices. Returns the matching
+ *  dio_device_id structure or %NULL if there is no match.
+ */
 
 static int dio_bus_match(struct device *dev, struct device_driver *drv)
 {
@@ -127,25 +119,14 @@ static int dio_bus_match(struct device *dev, struct device_driver *drv)
        if (!ids)
                return 0;
 
-       while (ids->id) {
-               if (ids->id == DIO_WILDCARD)
-                       return 1;
-               if (DIO_NEEDSSECID(ids->id & 0xff)) {
-                       if (ids->id == d->id)
-                               return 1;
-               } else {
-                       if ((ids->id & 0xff) == (d->id & 0xff))
-                               return 1;
-               }
-               ids++;
-       }
-       return 0;
+       return dio_match_device(ids, d) ? 1 : 0;
 }
 
 
 struct bus_type dio_bus_type = {
        .name   = "dio",
-       .match  = dio_bus_match
+       .match  = dio_bus_match,
+       .probe  = dio_device_probe,
 };
 
 
@@ -159,5 +140,4 @@ postcore_initcall(dio_driver_init);
 EXPORT_SYMBOL(dio_match_device);
 EXPORT_SYMBOL(dio_register_driver);
 EXPORT_SYMBOL(dio_unregister_driver);
-EXPORT_SYMBOL(dio_dev_driver);
 EXPORT_SYMBOL(dio_bus_type);