aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-05 01:53:16 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:34 -0500
commit23b9c1ab5baf368a32b7242bf110ef1f48700d04 (patch)
treee1da2529abd59a2b15213c837ab6bacd5e0f17dc /drivers/infiniband
parent0478b83adb0269033221dc063d1185a224681ee8 (diff)
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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c13
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c17
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sysfs.c30
4 files changed, 18 insertions, 45 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 6a56d86a2951..c9e32b46387f 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -590,6 +590,11 @@ static struct attribute_group ehca_drv_attr_grp = {
590 .attrs = ehca_drv_attrs 590 .attrs = ehca_drv_attrs
591}; 591};
592 592
593static struct attribute_group *ehca_drv_attr_groups[] = {
594 &ehca_drv_attr_grp,
595 NULL,
596};
597
593#define EHCA_RESOURCE_ATTR(name) \ 598#define EHCA_RESOURCE_ATTR(name) \
594static ssize_t ehca_show_##name(struct device *dev, \ 599static ssize_t ehca_show_##name(struct device *dev, \
595 struct device_attribute *attr, \ 600 struct device_attribute *attr, \
@@ -899,6 +904,9 @@ static struct of_platform_driver ehca_driver = {
899 .match_table = ehca_device_table, 904 .match_table = ehca_device_table,
900 .probe = ehca_probe, 905 .probe = ehca_probe,
901 .remove = ehca_remove, 906 .remove = ehca_remove,
907 .driver = {
908 .groups = ehca_drv_attr_groups,
909 },
902}; 910};
903 911
904void ehca_poll_eqs(unsigned long data) 912void ehca_poll_eqs(unsigned long data)
@@ -957,10 +965,6 @@ int __init ehca_module_init(void)
957 goto module_init2; 965 goto module_init2;
958 } 966 }
959 967
960 ret = sysfs_create_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
961 if (ret) /* only complain; we can live without attributes */
962 ehca_gen_err("Cannot create driver attributes ret=%d", ret);
963
964 if (ehca_poll_all_eqs != 1) { 968 if (ehca_poll_all_eqs != 1) {
965 ehca_gen_err("WARNING!!!"); 969 ehca_gen_err("WARNING!!!");
966 ehca_gen_err("It is possible to lose interrupts."); 970 ehca_gen_err("It is possible to lose interrupts.");
@@ -986,7 +990,6 @@ void __exit ehca_module_exit(void)
986 if (ehca_poll_all_eqs == 1) 990 if (ehca_poll_all_eqs == 1)
987 del_timer_sync(&poll_eqs_timer); 991 del_timer_sync(&poll_eqs_timer);
988 992
989 sysfs_remove_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
990 ibmebus_unregister_driver(&ehca_driver); 993 ibmebus_unregister_driver(&ehca_driver);
991 994
992 ehca_destroy_slab_caches(); 995 ehca_destroy_slab_caches();
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 1f152ded1e3c..fc355981bbab 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -121,6 +121,9 @@ static struct pci_driver ipath_driver = {
121 .probe = ipath_init_one, 121 .probe = ipath_init_one,
122 .remove = __devexit_p(ipath_remove_one), 122 .remove = __devexit_p(ipath_remove_one),
123 .id_table = ipath_pci_tbl, 123 .id_table = ipath_pci_tbl,
124 .driver = {
125 .groups = ipath_driver_attr_groups,
126 },
124}; 127};
125 128
126static void ipath_check_status(struct work_struct *work) 129static void ipath_check_status(struct work_struct *work)
@@ -2217,25 +2220,15 @@ static int __init infinipath_init(void)
2217 goto bail_unit; 2220 goto bail_unit;
2218 } 2221 }
2219 2222
2220 ret = ipath_driver_create_group(&ipath_driver.driver);
2221 if (ret < 0) {
2222 printk(KERN_ERR IPATH_DRV_NAME ": Unable to create driver "
2223 "sysfs entries: error %d\n", -ret);
2224 goto bail_pci;
2225 }
2226
2227 ret = ipath_init_ipathfs(); 2223 ret = ipath_init_ipathfs();
2228 if (ret < 0) { 2224 if (ret < 0) {
2229 printk(KERN_ERR IPATH_DRV_NAME ": Unable to create " 2225 printk(KERN_ERR IPATH_DRV_NAME ": Unable to create "
2230 "ipathfs: error %d\n", -ret); 2226 "ipathfs: error %d\n", -ret);
2231 goto bail_group; 2227 goto bail_pci;
2232 } 2228 }
2233 2229
2234 goto bail; 2230 goto bail;
2235 2231
2236bail_group:
2237 ipath_driver_remove_group(&ipath_driver.driver);
2238
2239bail_pci: 2232bail_pci:
2240 pci_unregister_driver(&ipath_driver); 2233 pci_unregister_driver(&ipath_driver);
2241 2234
@@ -2250,8 +2243,6 @@ static void __exit infinipath_cleanup(void)
2250{ 2243{
2251 ipath_exit_ipathfs(); 2244 ipath_exit_ipathfs();
2252 2245
2253 ipath_driver_remove_group(&ipath_driver.driver);
2254
2255 ipath_cdbg(VERBOSE, "Unregistering pci driver\n"); 2246 ipath_cdbg(VERBOSE, "Unregistering pci driver\n");
2256 pci_unregister_driver(&ipath_driver); 2247 pci_unregister_driver(&ipath_driver);
2257 2248
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 8786dd7922e4..bb1dc075f1d1 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -938,8 +938,7 @@ struct device_driver;
938 938
939extern const char ib_ipath_version[]; 939extern const char ib_ipath_version[];
940 940
941int ipath_driver_create_group(struct device_driver *); 941extern struct attribute_group *ipath_driver_attr_groups[];
942void ipath_driver_remove_group(struct device_driver *);
943 942
944int ipath_device_create_group(struct device *, struct ipath_devdata *); 943int ipath_device_create_group(struct device *, struct ipath_devdata *);
945void ipath_device_remove_group(struct device *, struct ipath_devdata *); 944void ipath_device_remove_group(struct device *, struct ipath_devdata *);
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c
index e1ad7cfc21fd..aa27ca9f03b1 100644
--- a/drivers/infiniband/hw/ipath/ipath_sysfs.c
+++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c
@@ -683,6 +683,11 @@ static struct attribute_group driver_attr_group = {
683 .attrs = driver_attributes 683 .attrs = driver_attributes
684}; 684};
685 685
686struct attribute_group *ipath_driver_attr_groups[] = {
687 &driver_attr_group,
688 NULL,
689};
690
686static DEVICE_ATTR(guid, S_IWUSR | S_IRUGO, show_guid, store_guid); 691static DEVICE_ATTR(guid, S_IWUSR | S_IRUGO, show_guid, store_guid);
687static DEVICE_ATTR(lmc, S_IWUSR | S_IRUGO, show_lmc, store_lmc); 692static DEVICE_ATTR(lmc, S_IWUSR | S_IRUGO, show_lmc, store_lmc);
688static DEVICE_ATTR(lid, S_IWUSR | S_IRUGO, show_lid, store_lid); 693static DEVICE_ATTR(lid, S_IWUSR | S_IRUGO, show_lid, store_lid);
@@ -753,24 +758,9 @@ int ipath_expose_reset(struct device *dev)
753 return ret; 758 return ret;
754} 759}
755 760
756int ipath_driver_create_group(struct device_driver *drv)
757{
758 int ret;
759
760 ret = sysfs_create_group(&drv->kobj, &driver_attr_group);
761
762 return ret;
763}
764
765void ipath_driver_remove_group(struct device_driver *drv)
766{
767 sysfs_remove_group(&drv->kobj, &driver_attr_group);
768}
769
770int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd) 761int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
771{ 762{
772 int ret; 763 int ret;
773 char unit[5];
774 764
775 ret = sysfs_create_group(&dev->kobj, &dev_attr_group); 765 ret = sysfs_create_group(&dev->kobj, &dev_attr_group);
776 if (ret) 766 if (ret)
@@ -780,11 +770,6 @@ int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
780 if (ret) 770 if (ret)
781 goto bail_attrs; 771 goto bail_attrs;
782 772
783 snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
784 ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, unit);
785 if (ret == 0)
786 goto bail;
787
788 sysfs_remove_group(&dev->kobj, &dev_counter_attr_group); 773 sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
789bail_attrs: 774bail_attrs:
790 sysfs_remove_group(&dev->kobj, &dev_attr_group); 775 sysfs_remove_group(&dev->kobj, &dev_attr_group);
@@ -794,11 +779,6 @@ bail:
794 779
795void ipath_device_remove_group(struct device *dev, struct ipath_devdata *dd) 780void ipath_device_remove_group(struct device *dev, struct ipath_devdata *dd)
796{ 781{
797 char unit[5];
798
799 snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
800 sysfs_remove_link(&dev->driver->kobj, unit);
801
802 sysfs_remove_group(&dev->kobj, &dev_counter_attr_group); 782 sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
803 sysfs_remove_group(&dev->kobj, &dev_attr_group); 783 sysfs_remove_group(&dev->kobj, &dev_attr_group);
804 784