aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-01-05 06:48:09 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 20:04:48 -0500
commit0933e2d98d1b170ef62d48e18157f5dc43b58217 (patch)
treeecbd589b7607cda35743faf65c8f4326fc8373dd /drivers/infiniband
parent869dfc875e32fd832385fd52ce54525a10401ed6 (diff)
driver core: Convert some drivers to CLASS_ATTR_STRING
Convert some drivers who export a single string as class attribute to the new class_attr_string functions. This removes redundant code all over. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/ucm.c15
-rw-r--r--drivers/infiniband/core/user_mad.c11
-rw-r--r--drivers/infiniband/core/uverbs_main.c11
3 files changed, 11 insertions, 26 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 02e209ff33fd..017d6e24448f 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1336,13 +1336,8 @@ static void ib_ucm_remove_one(struct ib_device *device)
1336 device_unregister(&ucm_dev->dev); 1336 device_unregister(&ucm_dev->dev);
1337} 1337}
1338 1338
1339static ssize_t show_abi_version(struct class *class, 1339static CLASS_ATTR_STRING(abi_version, S_IRUGO,
1340 struct class_attribute *attr, 1340 __stringify(IB_USER_CM_ABI_VERSION));
1341 char *buf)
1342{
1343 return sprintf(buf, "%d\n", IB_USER_CM_ABI_VERSION);
1344}
1345static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
1346 1341
1347static int __init ib_ucm_init(void) 1342static int __init ib_ucm_init(void)
1348{ 1343{
@@ -1355,7 +1350,7 @@ static int __init ib_ucm_init(void)
1355 goto error1; 1350 goto error1;
1356 } 1351 }
1357 1352
1358 ret = class_create_file(&cm_class, &class_attr_abi_version); 1353 ret = class_create_file(&cm_class, &class_attr_abi_version.attr);
1359 if (ret) { 1354 if (ret) {
1360 printk(KERN_ERR "ucm: couldn't create abi_version attribute\n"); 1355 printk(KERN_ERR "ucm: couldn't create abi_version attribute\n");
1361 goto error2; 1356 goto error2;
@@ -1369,7 +1364,7 @@ static int __init ib_ucm_init(void)
1369 return 0; 1364 return 0;
1370 1365
1371error3: 1366error3:
1372 class_remove_file(&cm_class, &class_attr_abi_version); 1367 class_remove_file(&cm_class, &class_attr_abi_version.attr);
1373error2: 1368error2:
1374 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); 1369 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
1375error1: 1370error1:
@@ -1379,7 +1374,7 @@ error1:
1379static void __exit ib_ucm_cleanup(void) 1374static void __exit ib_ucm_cleanup(void)
1380{ 1375{
1381 ib_unregister_client(&ucm_client); 1376 ib_unregister_client(&ucm_client);
1382 class_remove_file(&cm_class, &class_attr_abi_version); 1377 class_remove_file(&cm_class, &class_attr_abi_version.attr);
1383 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); 1378 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
1384 if (overflow_maj) 1379 if (overflow_maj)
1385 unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES); 1380 unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES);
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index d0de8f265f45..04b585e86cb2 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -965,13 +965,8 @@ static ssize_t show_port(struct device *dev, struct device_attribute *attr,
965} 965}
966static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); 966static DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
967 967
968static ssize_t show_abi_version(struct class *class, 968static CLASS_ATTR_STRING(abi_version, S_IRUGO,
969 struct class_attribute *attr, 969 __stringify(IB_USER_MAD_ABI_VERSION));
970 char *buf)
971{
972 return sprintf(buf, "%d\n", IB_USER_MAD_ABI_VERSION);
973}
974static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
975 970
976static dev_t overflow_maj; 971static dev_t overflow_maj;
977static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS); 972static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS);
@@ -1196,7 +1191,7 @@ static int __init ib_umad_init(void)
1196 goto out_chrdev; 1191 goto out_chrdev;
1197 } 1192 }
1198 1193
1199 ret = class_create_file(umad_class, &class_attr_abi_version); 1194 ret = class_create_file(umad_class, &class_attr_abi_version.attr);
1200 if (ret) { 1195 if (ret) {
1201 printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); 1196 printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n");
1202 goto out_class; 1197 goto out_class;
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 60879399207a..d805cf365c8d 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -691,13 +691,8 @@ static ssize_t show_dev_abi_version(struct device *device,
691} 691}
692static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL); 692static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL);
693 693
694static ssize_t show_abi_version(struct class *class, 694static CLASS_ATTR_STRING(abi_version, S_IRUGO,
695 struct class_attribute *attr, 695 __stringify(IB_USER_VERBS_ABI_VERSION));
696 char *buf)
697{
698 return sprintf(buf, "%d\n", IB_USER_VERBS_ABI_VERSION);
699}
700static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
701 696
702static dev_t overflow_maj; 697static dev_t overflow_maj;
703static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES); 698static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES);
@@ -843,7 +838,7 @@ static int __init ib_uverbs_init(void)
843 goto out_chrdev; 838 goto out_chrdev;
844 } 839 }
845 840
846 ret = class_create_file(uverbs_class, &class_attr_abi_version); 841 ret = class_create_file(uverbs_class, &class_attr_abi_version.attr);
847 if (ret) { 842 if (ret) {
848 printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n"); 843 printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n");
849 goto out_class; 844 goto out_class;