Commit 23b9c1ab authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Infiniband: make ipath driver use default driver groups.

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