@@ -129,17 +129,17 @@ static ssize_t pyra_sysfs_write(struct file *fp, struct kobject *kobj,
129
129
130
130
#define PYRA_SYSFS_W (thingy , THINGY ) \
131
131
static 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) \
134
134
{ \
135
135
return pyra_sysfs_write(fp, kobj, buf, off, count, \
136
136
PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \
137
137
}
138
138
139
139
#define PYRA_SYSFS_R (thingy , THINGY ) \
140
140
static 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) \
143
143
{ \
144
144
return pyra_sysfs_read(fp, kobj, buf, off, count, \
145
145
PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \
@@ -151,27 +151,27 @@ PYRA_SYSFS_R(thingy, THINGY)
151
151
152
152
#define PYRA_BIN_ATTRIBUTE_RW (thingy , THINGY ) \
153
153
PYRA_SYSFS_RW(thingy, THINGY); \
154
- static struct bin_attribute bin_attr_##thingy = { \
154
+ static const struct bin_attribute bin_attr_##thingy = { \
155
155
.attr = { .name = #thingy, .mode = 0660 }, \
156
156
.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 \
159
159
}
160
160
161
161
#define PYRA_BIN_ATTRIBUTE_R (thingy , THINGY ) \
162
162
PYRA_SYSFS_R(thingy, THINGY); \
163
- static struct bin_attribute bin_attr_##thingy = { \
163
+ static const struct bin_attribute bin_attr_##thingy = { \
164
164
.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, \
167
167
}
168
168
169
169
#define PYRA_BIN_ATTRIBUTE_W (thingy , THINGY ) \
170
170
PYRA_SYSFS_W(thingy, THINGY); \
171
- static struct bin_attribute bin_attr_##thingy = { \
171
+ static const struct bin_attribute bin_attr_##thingy = { \
172
172
.attr = { .name = #thingy, .mode = 0220 }, \
173
173
.size = PYRA_SIZE_ ## THINGY, \
174
- .write = pyra_sysfs_write_ ## thingy \
174
+ .write_new = pyra_sysfs_write_ ## thingy \
175
175
}
176
176
177
177
PYRA_BIN_ATTRIBUTE_W (control , CONTROL );
@@ -180,8 +180,8 @@ PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
180
180
PYRA_BIN_ATTRIBUTE_RW (profile_buttons , PROFILE_BUTTONS );
181
181
182
182
static 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 )
185
185
{
186
186
struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
187
187
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,
198
198
}
199
199
200
200
static 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 )
203
203
{
204
204
struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
205
205
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,
216
216
}
217
217
218
218
#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 = { \
220
220
.attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
221
221
.size = PYRA_SIZE_PROFILE_SETTINGS, \
222
- .read = pyra_sysfs_read_profilex_settings, \
222
+ .read_new = pyra_sysfs_read_profilex_settings, \
223
223
.private = &profile_numbers[number-1], \
224
224
}; \
225
- static struct bin_attribute bin_attr_profile##number##_buttons = { \
225
+ static const struct bin_attribute bin_attr_profile##number##_buttons = { \
226
226
.attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
227
227
.size = PYRA_SIZE_PROFILE_BUTTONS, \
228
- .read = pyra_sysfs_read_profilex_buttons, \
228
+ .read_new = pyra_sysfs_read_profilex_buttons, \
229
229
.private = &profile_numbers[number-1], \
230
230
};
231
231
PROFILE_ATTR (1 );
@@ -235,8 +235,8 @@ PROFILE_ATTR(4);
235
235
PROFILE_ATTR (5 );
236
236
237
237
static 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 )
240
240
{
241
241
struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
242
242
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,
273
273
}
274
274
275
275
PYRA_SYSFS_R (settings , SETTINGS );
276
- static struct bin_attribute bin_attr_settings =
276
+ static const struct bin_attribute bin_attr_settings =
277
277
__BIN_ATTR (settings , (S_IWUSR | S_IRUGO ),
278
278
pyra_sysfs_read_settings , pyra_sysfs_write_settings ,
279
279
PYRA_SIZE_SETTINGS );
@@ -334,7 +334,7 @@ static struct attribute *pyra_attrs[] = {
334
334
NULL ,
335
335
};
336
336
337
- static struct bin_attribute * pyra_bin_attributes [] = {
337
+ static const struct bin_attribute * const pyra_bin_attributes [] = {
338
338
& bin_attr_control ,
339
339
& bin_attr_info ,
340
340
& bin_attr_profile_settings ,
@@ -355,7 +355,7 @@ static struct bin_attribute *pyra_bin_attributes[] = {
355
355
356
356
static const struct attribute_group pyra_group = {
357
357
.attrs = pyra_attrs ,
358
- .bin_attrs = pyra_bin_attributes ,
358
+ .bin_attrs_new = pyra_bin_attributes ,
359
359
};
360
360
361
361
static const struct attribute_group * pyra_groups [] = {
0 commit comments