@@ -129,17 +129,17 @@ static ssize_t pyra_sysfs_write(struct file *fp, struct kobject *kobj,
129129
130130#define PYRA_SYSFS_W (thingy , THINGY ) \
131131static ssize_t pyra_sysfs_write_ ## thingy(struct file *fp, \
132- struct kobject *kobj, struct bin_attribute *attr, char *buf , \
133- loff_t off, size_t count) \
132+ struct kobject *kobj, const struct bin_attribute *attr, \
133+ char *buf, loff_t off, size_t count) \
134134{ \
135135 return pyra_sysfs_write(fp, kobj, buf, off, count, \
136136 PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \
137137}
138138
139139#define PYRA_SYSFS_R (thingy , THINGY ) \
140140static ssize_t pyra_sysfs_read_ ## thingy(struct file *fp, \
141- struct kobject *kobj, struct bin_attribute *attr, char *buf , \
142- loff_t off, size_t count) \
141+ struct kobject *kobj, const struct bin_attribute *attr, \
142+ char *buf, loff_t off, size_t count) \
143143{ \
144144 return pyra_sysfs_read(fp, kobj, buf, off, count, \
145145 PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \
@@ -151,27 +151,27 @@ PYRA_SYSFS_R(thingy, THINGY)
151151
152152#define PYRA_BIN_ATTRIBUTE_RW (thingy , THINGY ) \
153153PYRA_SYSFS_RW(thingy, THINGY); \
154- static struct bin_attribute bin_attr_##thingy = { \
154+ static const struct bin_attribute bin_attr_##thingy = { \
155155 .attr = { .name = #thingy, .mode = 0660 }, \
156156 .size = PYRA_SIZE_ ## THINGY, \
157- .read = pyra_sysfs_read_ ## thingy, \
158- .write = pyra_sysfs_write_ ## thingy \
157+ .read_new = pyra_sysfs_read_ ## thingy, \
158+ .write_new = pyra_sysfs_write_ ## thingy \
159159}
160160
161161#define PYRA_BIN_ATTRIBUTE_R (thingy , THINGY ) \
162162PYRA_SYSFS_R(thingy, THINGY); \
163- static struct bin_attribute bin_attr_##thingy = { \
163+ static const struct bin_attribute bin_attr_##thingy = { \
164164 .attr = { .name = #thingy, .mode = 0440 }, \
165- .size = PYRA_SIZE_ ## THINGY, \
166- .read = pyra_sysfs_read_ ## thingy, \
165+ .size_new = PYRA_SIZE_ ## THINGY, \
166+ .read_new = pyra_sysfs_read_ ## thingy, \
167167}
168168
169169#define PYRA_BIN_ATTRIBUTE_W (thingy , THINGY ) \
170170PYRA_SYSFS_W(thingy, THINGY); \
171- static struct bin_attribute bin_attr_##thingy = { \
171+ static const struct bin_attribute bin_attr_##thingy = { \
172172 .attr = { .name = #thingy, .mode = 0220 }, \
173173 .size = PYRA_SIZE_ ## THINGY, \
174- .write = pyra_sysfs_write_ ## thingy \
174+ .write_new = pyra_sysfs_write_ ## thingy \
175175}
176176
177177PYRA_BIN_ATTRIBUTE_W (control , CONTROL );
@@ -180,8 +180,8 @@ PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
180180PYRA_BIN_ATTRIBUTE_RW (profile_buttons , PROFILE_BUTTONS );
181181
182182static ssize_t pyra_sysfs_read_profilex_settings (struct file * fp ,
183- struct kobject * kobj , struct bin_attribute * attr , char * buf ,
184- loff_t off , size_t count )
183+ struct kobject * kobj , const struct bin_attribute * attr ,
184+ char * buf , loff_t off , size_t count )
185185{
186186 struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
187187 struct usb_device * usb_dev = interface_to_usbdev (to_usb_interface (dev ));
@@ -198,8 +198,8 @@ static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp,
198198}
199199
200200static ssize_t pyra_sysfs_read_profilex_buttons (struct file * fp ,
201- struct kobject * kobj , struct bin_attribute * attr , char * buf ,
202- loff_t off , size_t count )
201+ struct kobject * kobj , const struct bin_attribute * attr ,
202+ char * buf , loff_t off , size_t count )
203203{
204204 struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
205205 struct usb_device * usb_dev = interface_to_usbdev (to_usb_interface (dev ));
@@ -216,16 +216,16 @@ static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp,
216216}
217217
218218#define PROFILE_ATTR (number ) \
219- static struct bin_attribute bin_attr_profile##number##_settings = { \
219+ static const struct bin_attribute bin_attr_profile##number##_settings = { \
220220 .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
221221 .size = PYRA_SIZE_PROFILE_SETTINGS, \
222- .read = pyra_sysfs_read_profilex_settings, \
222+ .read_new = pyra_sysfs_read_profilex_settings, \
223223 .private = &profile_numbers[number-1], \
224224}; \
225- static struct bin_attribute bin_attr_profile##number##_buttons = { \
225+ static const struct bin_attribute bin_attr_profile##number##_buttons = { \
226226 .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
227227 .size = PYRA_SIZE_PROFILE_BUTTONS, \
228- .read = pyra_sysfs_read_profilex_buttons, \
228+ .read_new = pyra_sysfs_read_profilex_buttons, \
229229 .private = &profile_numbers[number-1], \
230230};
231231PROFILE_ATTR (1 );
@@ -235,8 +235,8 @@ PROFILE_ATTR(4);
235235PROFILE_ATTR (5 );
236236
237237static ssize_t pyra_sysfs_write_settings (struct file * fp ,
238- struct kobject * kobj , struct bin_attribute * attr , char * buf ,
239- loff_t off , size_t count )
238+ struct kobject * kobj , const struct bin_attribute * attr ,
239+ char * buf , loff_t off , size_t count )
240240{
241241 struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
242242 struct pyra_device * pyra = hid_get_drvdata (dev_get_drvdata (dev ));
@@ -273,7 +273,7 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp,
273273}
274274
275275PYRA_SYSFS_R (settings , SETTINGS );
276- static struct bin_attribute bin_attr_settings =
276+ static const struct bin_attribute bin_attr_settings =
277277 __BIN_ATTR (settings , (S_IWUSR | S_IRUGO ),
278278 pyra_sysfs_read_settings , pyra_sysfs_write_settings ,
279279 PYRA_SIZE_SETTINGS );
@@ -334,7 +334,7 @@ static struct attribute *pyra_attrs[] = {
334334 NULL ,
335335};
336336
337- static struct bin_attribute * pyra_bin_attributes [] = {
337+ static const struct bin_attribute * const pyra_bin_attributes [] = {
338338 & bin_attr_control ,
339339 & bin_attr_info ,
340340 & bin_attr_profile_settings ,
@@ -355,7 +355,7 @@ static struct bin_attribute *pyra_bin_attributes[] = {
355355
356356static const struct attribute_group pyra_group = {
357357 .attrs = pyra_attrs ,
358- .bin_attrs = pyra_bin_attributes ,
358+ .bin_attrs_new = pyra_bin_attributes ,
359359};
360360
361361static const struct attribute_group * pyra_groups [] = {
0 commit comments