summaryrefslogtreecommitdiffstats
path: root/drivers/misc/c2port
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 15:05:37 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 15:39:05 -0700
commitac3785d5c15922c8a4c6b9e050a5bc59895a6b9b (patch)
tree22420e7bd17a7e40a304056743023d0ba7b5b95a /drivers/misc/c2port
parente56341ad380114454119ac043e6d710ddbbb7710 (diff)
downloadop-kernel-dev-ac3785d5c15922c8a4c6b9e050a5bc59895a6b9b.zip
op-kernel-dev-ac3785d5c15922c8a4c6b9e050a5bc59895a6b9b.tar.gz
c2port: convert class code to use bin_attrs in groups
Now that attribute groups support binary attributes, use them instead of the dev_bin_attrs field in struct class, as that is going away soon. Cc: Rodolfo Giometti <giometti@linux.it> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/c2port')
-rw-r--r--drivers/misc/c2port/core.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index abe6e25..464419b 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -856,6 +856,9 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
return ret;
}
+/* size is computed at run-time */
+static BIN_ATTR(flash_data, 0644, c2port_read_flash_data,
+ c2port_write_flash_data, 0);
/*
* Class attributes
@@ -873,19 +876,20 @@ static struct attribute *c2port_attrs[] = {
&dev_attr_flash_erase.attr,
NULL,
};
-ATTRIBUTE_GROUPS(c2port);
-
-static struct bin_attribute c2port_bin_attrs[] = {
- {
- .attr = {
- .name = "flash_data",
- .mode = 0644
- },
- .read = c2port_read_flash_data,
- .write = c2port_write_flash_data,
- /* .size is computed at run-time */
- },
- __ATTR_NULL
+
+static struct bin_attribute *c2port_bin_attrs[] = {
+ &bin_attr_flash_data,
+ NULL,
+};
+
+static const struct attribute_group c2port_group = {
+ .attrs = c2port_attrs,
+ .bin_attrs = c2port_bin_attrs,
+};
+
+static const struct attribute_group *c2port_groups[] = {
+ &c2port_group,
+ NULL,
};
/*
@@ -918,7 +922,7 @@ struct c2port_device *c2port_device_register(char *name,
goto error_idr_alloc;
c2dev->id = ret;
- c2port_bin_attrs[0].size = ops->blocks_num * ops->block_size;
+ bin_attr_flash_data.size = ops->blocks_num * ops->block_size;
c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
"c2port%d", c2dev->id);
@@ -988,7 +992,6 @@ static int __init c2port_init(void)
return PTR_ERR(c2port_class);
}
c2port_class->dev_groups = c2port_groups;
- c2port_class->dev_bin_attrs = c2port_bin_attrs;
return 0;
}
OpenPOWER on IntegriCloud