From: Andrew Morton Davem merged it - please drop. Cc: Greg KH Signed-off-by: Andrew Morton --- include/linux/atmdev.h | 4 +- net/atm/atm_sysfs.c | 66 +++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff -puN include/linux/atmdev.h~revert-gregkh-driver-atm-convert-struct-class_device-to-struct-device include/linux/atmdev.h --- a/include/linux/atmdev.h~revert-gregkh-driver-atm-convert-struct-class_device-to-struct-device +++ a/include/linux/atmdev.h @@ -359,7 +359,7 @@ struct atm_dev { struct proc_dir_entry *proc_entry; /* proc entry */ char *proc_name; /* proc entry name */ #endif - struct device class_dev; /* sysfs device */ + struct class_device class_dev; /* sysfs class device */ struct list_head dev_list; /* linkage */ }; @@ -461,7 +461,7 @@ static inline void atm_dev_put(struct at BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); if (dev->ops->dev_close) dev->ops->dev_close(dev); - put_device(&dev->class_dev); + class_device_put(&dev->class_dev); } } diff -puN net/atm/atm_sysfs.c~revert-gregkh-driver-atm-convert-struct-class_device-to-struct-device net/atm/atm_sysfs.c --- a/net/atm/atm_sysfs.c~revert-gregkh-driver-atm-convert-struct-class_device-to-struct-device +++ a/net/atm/atm_sysfs.c @@ -9,15 +9,13 @@ #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev) -static ssize_t show_type(struct device *cdev, - struct device_attribute *attr, char *buf) +static ssize_t show_type(struct class_device *cdev, char *buf) { struct atm_dev *adev = to_atm_dev(cdev); return sprintf(buf, "%s\n", adev->type); } -static ssize_t show_address(struct device *cdev, - struct device_attribute *attr, char *buf) +static ssize_t show_address(struct class_device *cdev, char *buf) { char *pos = buf; struct atm_dev *adev = to_atm_dev(cdev); @@ -30,8 +28,7 @@ static ssize_t show_address(struct devic return pos - buf; } -static ssize_t show_atmaddress(struct device *cdev, - struct device_attribute *attr, char *buf) +static ssize_t show_atmaddress(struct class_device *cdev, char *buf) { unsigned long flags; char *pos = buf; @@ -57,8 +54,7 @@ static ssize_t show_atmaddress(struct de return pos - buf; } -static ssize_t show_carrier(struct device *cdev, - struct device_attribute *attr, char *buf) +static ssize_t show_carrier(struct class_device *cdev, char *buf) { char *pos = buf; struct atm_dev *adev = to_atm_dev(cdev); @@ -69,8 +65,7 @@ static ssize_t show_carrier(struct devic return pos - buf; } -static ssize_t show_link_rate(struct device *cdev, - struct device_attribute *attr, char *buf) +static ssize_t show_link_rate(struct class_device *cdev, char *buf) { char *pos = buf; struct atm_dev *adev = to_atm_dev(cdev); @@ -95,23 +90,22 @@ static ssize_t show_link_rate(struct dev return pos - buf; } -static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); -static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); -static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); -static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); -static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); - -static struct device_attribute *atm_attrs[] = { - &dev_attr_atmaddress, - &dev_attr_address, - &dev_attr_carrier, - &dev_attr_type, - &dev_attr_link_rate, +static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL); +static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); +static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); +static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL); +static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); + +static struct class_device_attribute *atm_attrs[] = { + &class_device_attr_atmaddress, + &class_device_attr_address, + &class_device_attr_carrier, + &class_device_attr_type, + &class_device_attr_link_rate, NULL }; - -static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env) +static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env) { struct atm_dev *adev; @@ -128,7 +122,7 @@ static int atm_uevent(struct device *cde return 0; } -static void atm_release(struct device *cdev) +static void atm_release(struct class_device *cdev) { struct atm_dev *adev = to_atm_dev(cdev); @@ -137,25 +131,25 @@ static void atm_release(struct device *c static struct class atm_class = { .name = "atm", - .dev_release = atm_release, - .dev_uevent = atm_uevent, + .release = atm_release, + .uevent = atm_uevent, }; int atm_register_sysfs(struct atm_dev *adev) { - struct device *cdev = &adev->class_dev; + struct class_device *cdev = &adev->class_dev; int i, j, err; cdev->class = &atm_class; - dev_set_drvdata(cdev, adev); + class_set_devdata(cdev, adev); - snprintf(cdev->bus_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); - err = device_register(cdev); + snprintf(cdev->class_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); + err = class_device_register(cdev); if (err < 0) return err; for (i = 0; atm_attrs[i]; i++) { - err = device_create_file(cdev, atm_attrs[i]); + err = class_device_create_file(cdev, atm_attrs[i]); if (err) goto err_out; } @@ -164,16 +158,16 @@ int atm_register_sysfs(struct atm_dev *a err_out: for (j = 0; j < i; j++) - device_remove_file(cdev, atm_attrs[j]); - device_del(cdev); + class_device_remove_file(cdev, atm_attrs[j]); + class_device_del(cdev); return err; } void atm_unregister_sysfs(struct atm_dev *adev) { - struct device *cdev = &adev->class_dev; + struct class_device *cdev = &adev->class_dev; - device_del(cdev); + class_device_del(cdev); } int __init atm_sysfs_init(void) _