return 0;
 }
 
-/* Display the version of drm_core. This doesn't work right in current design */
-static ssize_t version_show(struct class *dev, struct class_attribute *attr,
-                               char *buf)
-{
-       return sprintf(buf, "%s %d.%d.%d %s\n", CORE_NAME, CORE_MAJOR,
-                      CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
-}
-
 static char *drm_devnode(struct device *dev, mode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
 }
 
-static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
+static CLASS_ATTR_STRING(version, S_IRUGO,
+               CORE_NAME " "
+               __stringify(CORE_MAJOR) "."
+               __stringify(CORE_MINOR) "."
+               __stringify(CORE_PATCHLEVEL) " "
+               CORE_DATE);
 
 /**
  * drm_sysfs_create - create a struct drm_sysfs_class structure
        class->suspend = drm_class_suspend;
        class->resume = drm_class_resume;
 
-       err = class_create_file(class, &class_attr_version);
+       err = class_create_file(class, &class_attr_version.attr);
        if (err)
                goto err_out_class;
 
 {
        if ((drm_class == NULL) || (IS_ERR(drm_class)))
                return;
-       class_remove_file(drm_class, &class_attr_version);
+       class_remove_file(drm_class, &class_attr_version.attr);
        class_destroy(drm_class);
 }
 
 
        device_unregister(&ucm_dev->dev);
 }
 
-static ssize_t show_abi_version(struct class *class,
-                               struct class_attribute *attr,
-                               char *buf)
-{
-       return sprintf(buf, "%d\n", IB_USER_CM_ABI_VERSION);
-}
-static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
+static CLASS_ATTR_STRING(abi_version, S_IRUGO,
+                        __stringify(IB_USER_CM_ABI_VERSION));
 
 static int __init ib_ucm_init(void)
 {
                goto error1;
        }
 
-       ret = class_create_file(&cm_class, &class_attr_abi_version);
+       ret = class_create_file(&cm_class, &class_attr_abi_version.attr);
        if (ret) {
                printk(KERN_ERR "ucm: couldn't create abi_version attribute\n");
                goto error2;
        return 0;
 
 error3:
-       class_remove_file(&cm_class, &class_attr_abi_version);
+       class_remove_file(&cm_class, &class_attr_abi_version.attr);
 error2:
        unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
 error1:
 static void __exit ib_ucm_cleanup(void)
 {
        ib_unregister_client(&ucm_client);
-       class_remove_file(&cm_class, &class_attr_abi_version);
+       class_remove_file(&cm_class, &class_attr_abi_version.attr);
        unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
        if (overflow_maj)
                unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES);
 
 }
 static DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
 
-static ssize_t show_abi_version(struct class *class,
-                               struct class_attribute *attr,
-                               char *buf)
-{
-       return sprintf(buf, "%d\n", IB_USER_MAD_ABI_VERSION);
-}
-static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
+static CLASS_ATTR_STRING(abi_version, S_IRUGO,
+                        __stringify(IB_USER_MAD_ABI_VERSION));
 
 static dev_t overflow_maj;
 static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS);
                goto out_chrdev;
        }
 
-       ret = class_create_file(umad_class, &class_attr_abi_version);
+       ret = class_create_file(umad_class, &class_attr_abi_version.attr);
        if (ret) {
                printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n");
                goto out_class;
 
 }
 static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL);
 
-static ssize_t show_abi_version(struct class *class,
-                               struct class_attribute *attr,
-                               char *buf)
-{
-       return sprintf(buf, "%d\n", IB_USER_VERBS_ABI_VERSION);
-}
-static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
+static CLASS_ATTR_STRING(abi_version, S_IRUGO,
+                        __stringify(IB_USER_VERBS_ABI_VERSION));
 
 static dev_t overflow_maj;
 static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES);
                goto out_chrdev;
        }
 
-       ret = class_create_file(uverbs_class, &class_attr_abi_version);
+       ret = class_create_file(uverbs_class, &class_attr_abi_version.attr);
        if (ret) {
                printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n");
                goto out_class;
 
        .resume = phantom_resume
 };
 
-static ssize_t phantom_show_version(struct class *cls, struct class_attribute *attr, char *buf)
-{
-       return sprintf(buf, PHANTOM_VERSION "\n");
-}
-
-static CLASS_ATTR(version, 0444, phantom_show_version, NULL);
+static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION);
 
 static int __init phantom_init(void)
 {
                printk(KERN_ERR "phantom: can't register phantom class\n");
                goto err;
        }
-       retval = class_create_file(phantom_class, &class_attr_version);
+       retval = class_create_file(phantom_class, &class_attr_version.attr);
        if (retval) {
                printk(KERN_ERR "phantom: can't create sysfs version file\n");
                goto err_class;
 err_unchr:
        unregister_chrdev_region(dev, PHANTOM_MAX_MINORS);
 err_attr:
-       class_remove_file(phantom_class, &class_attr_version);
+       class_remove_file(phantom_class, &class_attr_version.attr);
 err_class:
        class_destroy(phantom_class);
 err:
 
        unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS);
 
-       class_remove_file(phantom_class, &class_attr_version);
+       class_remove_file(phantom_class, &class_attr_version.attr);
        class_destroy(phantom_class);
 
        pr_debug("phantom: module successfully removed\n");
 
        .id_table =     id_table,
 };
 
-static ssize_t version_show(struct class *dev,
-                           struct class_attribute *attr,
-                           char *buf)
-{
-       return sprintf(buf, ASUS_OLED_UNDERSCORE_NAME " %s\n",
-                      ASUS_OLED_VERSION);
-}
-
-static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
+static CLASS_ATTR_STRING(version, S_IRUGO,
+                       ASUS_OLED_UNDERSCORE_NAME " " ASUS_OLED_VERSION);
 
 static int __init asus_oled_init(void)
 {
                return PTR_ERR(oled_class);
        }
 
-       retval = class_create_file(oled_class, &class_attr_version);
+       retval = class_create_file(oled_class, &class_attr_version.attr);
        if (retval) {
                err("Error creating class version file");
                goto error;
 
 static void __exit asus_oled_exit(void)
 {
-       class_remove_file(oled_class, &class_attr_version);
+       class_remove_file(oled_class, &class_attr_version.attr);
        class_destroy(oled_class);
 
        usb_deregister(&oled_driver);