SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
56d110e852
commit
ee959b00c3
@@ -5591,9 +5591,10 @@ static void osst_remove_sysfs_files(struct device_driver *sysfs)
|
||||
* sysfs support for accessing ADR header information
|
||||
*/
|
||||
|
||||
static ssize_t osst_adr_rev_show(struct class_device *class_dev, char *buf)
|
||||
static ssize_t osst_adr_rev_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev);
|
||||
struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev);
|
||||
ssize_t l = 0;
|
||||
|
||||
if (STp && STp->header_ok && STp->linux_media)
|
||||
@@ -5601,11 +5602,13 @@ static ssize_t osst_adr_rev_show(struct class_device *class_dev, char *buf)
|
||||
return l;
|
||||
}
|
||||
|
||||
CLASS_DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL);
|
||||
DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL);
|
||||
|
||||
static ssize_t osst_linux_media_version_show(struct class_device *class_dev, char *buf)
|
||||
static ssize_t osst_linux_media_version_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev);
|
||||
struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev);
|
||||
ssize_t l = 0;
|
||||
|
||||
if (STp && STp->header_ok && STp->linux_media)
|
||||
@@ -5613,11 +5616,12 @@ static ssize_t osst_linux_media_version_show(struct class_device *class_dev, cha
|
||||
return l;
|
||||
}
|
||||
|
||||
CLASS_DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL);
|
||||
DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL);
|
||||
|
||||
static ssize_t osst_capacity_show(struct class_device *class_dev, char *buf)
|
||||
static ssize_t osst_capacity_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev);
|
||||
struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev);
|
||||
ssize_t l = 0;
|
||||
|
||||
if (STp && STp->header_ok && STp->linux_media)
|
||||
@@ -5625,11 +5629,13 @@ static ssize_t osst_capacity_show(struct class_device *class_dev, char *buf)
|
||||
return l;
|
||||
}
|
||||
|
||||
CLASS_DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL);
|
||||
DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL);
|
||||
|
||||
static ssize_t osst_first_data_ppos_show(struct class_device *class_dev, char *buf)
|
||||
static ssize_t osst_first_data_ppos_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev);
|
||||
struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev);
|
||||
ssize_t l = 0;
|
||||
|
||||
if (STp && STp->header_ok && STp->linux_media)
|
||||
@@ -5637,11 +5643,13 @@ static ssize_t osst_first_data_ppos_show(struct class_device *class_dev, char *b
|
||||
return l;
|
||||
}
|
||||
|
||||
CLASS_DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL);
|
||||
DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL);
|
||||
|
||||
static ssize_t osst_eod_frame_ppos_show(struct class_device *class_dev, char *buf)
|
||||
static ssize_t osst_eod_frame_ppos_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev);
|
||||
struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev);
|
||||
ssize_t l = 0;
|
||||
|
||||
if (STp && STp->header_ok && STp->linux_media)
|
||||
@@ -5649,11 +5657,12 @@ static ssize_t osst_eod_frame_ppos_show(struct class_device *class_dev, char *bu
|
||||
return l;
|
||||
}
|
||||
|
||||
CLASS_DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL);
|
||||
DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL);
|
||||
|
||||
static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf)
|
||||
static ssize_t osst_filemark_cnt_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev);
|
||||
struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev);
|
||||
ssize_t l = 0;
|
||||
|
||||
if (STp && STp->header_ok && STp->linux_media)
|
||||
@@ -5661,7 +5670,7 @@ static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf)
|
||||
return l;
|
||||
}
|
||||
|
||||
CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL);
|
||||
DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL);
|
||||
|
||||
static struct class *osst_sysfs_class;
|
||||
|
||||
@@ -5678,44 +5687,37 @@ static int osst_sysfs_init(void)
|
||||
|
||||
static void osst_sysfs_destroy(dev_t dev)
|
||||
{
|
||||
class_device_destroy(osst_sysfs_class, dev);
|
||||
device_destroy(osst_sysfs_class, dev);
|
||||
}
|
||||
|
||||
static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * STp, char * name)
|
||||
{
|
||||
struct class_device *osst_class_member;
|
||||
struct device *osst_member;
|
||||
int err;
|
||||
|
||||
osst_class_member = class_device_create(osst_sysfs_class, NULL, dev,
|
||||
device, "%s", name);
|
||||
if (IS_ERR(osst_class_member)) {
|
||||
osst_member = device_create(osst_sysfs_class, device, dev, "%s", name);
|
||||
if (IS_ERR(osst_member)) {
|
||||
printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name);
|
||||
return PTR_ERR(osst_class_member);
|
||||
return PTR_ERR(osst_member);
|
||||
}
|
||||
|
||||
class_set_devdata(osst_class_member, STp);
|
||||
err = class_device_create_file(osst_class_member,
|
||||
&class_device_attr_ADR_rev);
|
||||
dev_set_drvdata(osst_member, STp);
|
||||
err = device_create_file(osst_member, &dev_attr_ADR_rev);
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = class_device_create_file(osst_class_member,
|
||||
&class_device_attr_media_version);
|
||||
err = device_create_file(osst_member, &dev_attr_media_version);
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = class_device_create_file(osst_class_member,
|
||||
&class_device_attr_capacity);
|
||||
err = device_create_file(osst_member, &dev_attr_capacity);
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = class_device_create_file(osst_class_member,
|
||||
&class_device_attr_BOT_frame);
|
||||
err = device_create_file(osst_member, &dev_attr_BOT_frame);
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = class_device_create_file(osst_class_member,
|
||||
&class_device_attr_EOD_frame);
|
||||
err = device_create_file(osst_member, &dev_attr_EOD_frame);
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = class_device_create_file(osst_class_member,
|
||||
&class_device_attr_file_count);
|
||||
err = device_create_file(osst_member, &dev_attr_file_count);
|
||||
if (err)
|
||||
goto err_out;
|
||||
|
||||
|
Reference in New Issue
Block a user