diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:05:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 18:39:05 -0400 |
commit | ac3785d5c15922c8a4c6b9e050a5bc59895a6b9b (patch) | |
tree | 22420e7bd17a7e40a304056743023d0ba7b5b95a /drivers/misc | |
parent | e56341ad380114454119ac043e6d710ddbbb7710 (diff) |
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')
-rw-r--r-- | drivers/misc/c2port/core.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c index abe6e251e368..464419b36440 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, | |||
856 | 856 | ||
857 | return ret; | 857 | return ret; |
858 | } | 858 | } |
859 | /* size is computed at run-time */ | ||
860 | static BIN_ATTR(flash_data, 0644, c2port_read_flash_data, | ||
861 | c2port_write_flash_data, 0); | ||
859 | 862 | ||
860 | /* | 863 | /* |
861 | * Class attributes | 864 | * Class attributes |
@@ -873,19 +876,20 @@ static struct attribute *c2port_attrs[] = { | |||
873 | &dev_attr_flash_erase.attr, | 876 | &dev_attr_flash_erase.attr, |
874 | NULL, | 877 | NULL, |
875 | }; | 878 | }; |
876 | ATTRIBUTE_GROUPS(c2port); | 879 | |
877 | 880 | static struct bin_attribute *c2port_bin_attrs[] = { | |
878 | static struct bin_attribute c2port_bin_attrs[] = { | 881 | &bin_attr_flash_data, |
879 | { | 882 | NULL, |
880 | .attr = { | 883 | }; |
881 | .name = "flash_data", | 884 | |
882 | .mode = 0644 | 885 | static const struct attribute_group c2port_group = { |
883 | }, | 886 | .attrs = c2port_attrs, |
884 | .read = c2port_read_flash_data, | 887 | .bin_attrs = c2port_bin_attrs, |
885 | .write = c2port_write_flash_data, | 888 | }; |
886 | /* .size is computed at run-time */ | 889 | |
887 | }, | 890 | static const struct attribute_group *c2port_groups[] = { |
888 | __ATTR_NULL | 891 | &c2port_group, |
892 | NULL, | ||
889 | }; | 893 | }; |
890 | 894 | ||
891 | /* | 895 | /* |
@@ -918,7 +922,7 @@ struct c2port_device *c2port_device_register(char *name, | |||
918 | goto error_idr_alloc; | 922 | goto error_idr_alloc; |
919 | c2dev->id = ret; | 923 | c2dev->id = ret; |
920 | 924 | ||
921 | c2port_bin_attrs[0].size = ops->blocks_num * ops->block_size; | 925 | bin_attr_flash_data.size = ops->blocks_num * ops->block_size; |
922 | 926 | ||
923 | c2dev->dev = device_create(c2port_class, NULL, 0, c2dev, | 927 | c2dev->dev = device_create(c2port_class, NULL, 0, c2dev, |
924 | "c2port%d", c2dev->id); | 928 | "c2port%d", c2dev->id); |
@@ -988,7 +992,6 @@ static int __init c2port_init(void) | |||
988 | return PTR_ERR(c2port_class); | 992 | return PTR_ERR(c2port_class); |
989 | } | 993 | } |
990 | c2port_class->dev_groups = c2port_groups; | 994 | c2port_class->dev_groups = c2port_groups; |
991 | c2port_class->dev_bin_attrs = c2port_bin_attrs; | ||
992 | 995 | ||
993 | return 0; | 996 | return 0; |
994 | } | 997 | } |