]> err.no Git - linux-2.6/commitdiff
Infiniband: make ipath driver use default driver groups.
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 5 Dec 2007 06:53:16 +0000 (22:53 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:34 +0000 (20:40 -0800)
Make the ipath driver use the new driver functions so that it does not
touch the sysfs portion of the driver structure.

We also remove the redundant symlink from the device back to the driver,
as it is already in the sysfs tree.  Any userspace tools should be using
the standard symlink, not some driver specific one.

Cc: Roland Dreier <rdreier@cisco.com>
Cc: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: Arthur Jones <arthur.jones@qlogic.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/infiniband/hw/ehca/ehca_main.c
drivers/infiniband/hw/ipath/ipath_driver.c
drivers/infiniband/hw/ipath/ipath_kernel.h
drivers/infiniband/hw/ipath/ipath_sysfs.c

index 6a56d86a295105549c0a41205601f7b6c1fd8106..c9e32b46387fa3138b992e02f27795c45fa75750 100644 (file)
@@ -590,6 +590,11 @@ static struct attribute_group ehca_drv_attr_grp = {
        .attrs = ehca_drv_attrs
 };
 
+static struct attribute_group *ehca_drv_attr_groups[] = {
+       &ehca_drv_attr_grp,
+       NULL,
+};
+
 #define EHCA_RESOURCE_ATTR(name)                                           \
 static ssize_t  ehca_show_##name(struct device *dev,                       \
                                 struct device_attribute *attr,            \
@@ -899,6 +904,9 @@ static struct of_platform_driver ehca_driver = {
        .match_table = ehca_device_table,
        .probe       = ehca_probe,
        .remove      = ehca_remove,
+       .driver      = {
+               .groups = ehca_drv_attr_groups,
+       },
 };
 
 void ehca_poll_eqs(unsigned long data)
@@ -957,10 +965,6 @@ int __init ehca_module_init(void)
                goto module_init2;
        }
 
-       ret = sysfs_create_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
-       if (ret) /* only complain; we can live without attributes */
-               ehca_gen_err("Cannot create driver attributes  ret=%d", ret);
-
        if (ehca_poll_all_eqs != 1) {
                ehca_gen_err("WARNING!!!");
                ehca_gen_err("It is possible to lose interrupts.");
@@ -986,7 +990,6 @@ void __exit ehca_module_exit(void)
        if (ehca_poll_all_eqs == 1)
                del_timer_sync(&poll_eqs_timer);
 
-       sysfs_remove_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
        ibmebus_unregister_driver(&ehca_driver);
 
        ehca_destroy_slab_caches();
index 1f152ded1e3c48083840e8119aecea8738be1cd3..fc355981bbab10213855eb4208def7179406bf3d 100644 (file)
@@ -121,6 +121,9 @@ static struct pci_driver ipath_driver = {
        .probe = ipath_init_one,
        .remove = __devexit_p(ipath_remove_one),
        .id_table = ipath_pci_tbl,
+       .driver = {
+               .groups = ipath_driver_attr_groups,
+       },
 };
 
 static void ipath_check_status(struct work_struct *work)
@@ -2217,25 +2220,15 @@ static int __init infinipath_init(void)
                goto bail_unit;
        }
 
-       ret = ipath_driver_create_group(&ipath_driver.driver);
-       if (ret < 0) {
-               printk(KERN_ERR IPATH_DRV_NAME ": Unable to create driver "
-                      "sysfs entries: error %d\n", -ret);
-               goto bail_pci;
-       }
-
        ret = ipath_init_ipathfs();
        if (ret < 0) {
                printk(KERN_ERR IPATH_DRV_NAME ": Unable to create "
                       "ipathfs: error %d\n", -ret);
-               goto bail_group;
+               goto bail_pci;
        }
 
        goto bail;
 
-bail_group:
-       ipath_driver_remove_group(&ipath_driver.driver);
-
 bail_pci:
        pci_unregister_driver(&ipath_driver);
 
@@ -2250,8 +2243,6 @@ static void __exit infinipath_cleanup(void)
 {
        ipath_exit_ipathfs();
 
-       ipath_driver_remove_group(&ipath_driver.driver);
-
        ipath_cdbg(VERBOSE, "Unregistering pci driver\n");
        pci_unregister_driver(&ipath_driver);
 
index 8786dd7922e4e3916170af24d8cb8752793ea7ba..bb1dc075f1d1ee2126fc0e62f7a332637248f00a 100644 (file)
@@ -938,8 +938,7 @@ struct device_driver;
 
 extern const char ib_ipath_version[];
 
-int ipath_driver_create_group(struct device_driver *);
-void ipath_driver_remove_group(struct device_driver *);
+extern struct attribute_group *ipath_driver_attr_groups[];
 
 int ipath_device_create_group(struct device *, struct ipath_devdata *);
 void ipath_device_remove_group(struct device *, struct ipath_devdata *);
index e1ad7cfc21fd66b89e5f46055fb611b730aa94ab..aa27ca9f03b12b0110677b46141352d043423837 100644 (file)
@@ -683,6 +683,11 @@ static struct attribute_group driver_attr_group = {
        .attrs = driver_attributes
 };
 
+struct attribute_group *ipath_driver_attr_groups[] = {
+       &driver_attr_group,
+       NULL,
+};
+
 static DEVICE_ATTR(guid, S_IWUSR | S_IRUGO, show_guid, store_guid);
 static DEVICE_ATTR(lmc, S_IWUSR | S_IRUGO, show_lmc, store_lmc);
 static DEVICE_ATTR(lid, S_IWUSR | S_IRUGO, show_lid, store_lid);
@@ -753,24 +758,9 @@ int ipath_expose_reset(struct device *dev)
        return ret;
 }
 
-int ipath_driver_create_group(struct device_driver *drv)
-{
-       int ret;
-
-       ret = sysfs_create_group(&drv->kobj, &driver_attr_group);
-
-       return ret;
-}
-
-void ipath_driver_remove_group(struct device_driver *drv)
-{
-       sysfs_remove_group(&drv->kobj, &driver_attr_group);
-}
-
 int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
 {
        int ret;
-       char unit[5];
 
        ret = sysfs_create_group(&dev->kobj, &dev_attr_group);
        if (ret)
@@ -780,11 +770,6 @@ int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
        if (ret)
                goto bail_attrs;
 
-       snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
-       ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, unit);
-       if (ret == 0)
-               goto bail;
-
        sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
 bail_attrs:
        sysfs_remove_group(&dev->kobj, &dev_attr_group);
@@ -794,11 +779,6 @@ bail:
 
 void ipath_device_remove_group(struct device *dev, struct ipath_devdata *dd)
 {
-       char unit[5];
-
-       snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
-       sysfs_remove_link(&dev->driver->kobj, unit);
-
        sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
        sysfs_remove_group(&dev->kobj, &dev_attr_group);