@@ -128,17 +128,17 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj,
128128
129129#define KONEPLUS_SYSFS_W (thingy , THINGY ) \
130130static ssize_t koneplus_sysfs_write_ ## thingy(struct file *fp, \
131- struct kobject *kobj, struct bin_attribute *attr, char *buf , \
132- loff_t off, size_t count) \
131+ struct kobject *kobj, const struct bin_attribute *attr, \
132+ char *buf, loff_t off, size_t count) \
133133{ \
134134 return koneplus_sysfs_write(fp, kobj, buf, off, count, \
135135 KONEPLUS_SIZE_ ## THINGY, KONEPLUS_COMMAND_ ## THINGY); \
136136}
137137
138138#define KONEPLUS_SYSFS_R (thingy , THINGY ) \
139139static ssize_t koneplus_sysfs_read_ ## thingy(struct file *fp, \
140- struct kobject *kobj, struct bin_attribute *attr, char *buf , \
141- loff_t off, size_t count) \
140+ struct kobject *kobj, const struct bin_attribute *attr, \
141+ char *buf, loff_t off, size_t count) \
142142{ \
143143 return koneplus_sysfs_read(fp, kobj, buf, off, count, \
144144 KONEPLUS_SIZE_ ## THINGY, KONEPLUS_COMMAND_ ## THINGY); \
@@ -150,27 +150,27 @@ KONEPLUS_SYSFS_R(thingy, THINGY)
150150
151151#define KONEPLUS_BIN_ATTRIBUTE_RW (thingy , THINGY ) \
152152KONEPLUS_SYSFS_RW(thingy, THINGY); \
153- static struct bin_attribute bin_attr_##thingy = { \
153+ static const struct bin_attribute bin_attr_##thingy = { \
154154 .attr = { .name = #thingy, .mode = 0660 }, \
155155 .size = KONEPLUS_SIZE_ ## THINGY, \
156- .read = koneplus_sysfs_read_ ## thingy, \
157- .write = koneplus_sysfs_write_ ## thingy \
156+ .read_new = koneplus_sysfs_read_ ## thingy, \
157+ .write_new = koneplus_sysfs_write_ ## thingy \
158158}
159159
160160#define KONEPLUS_BIN_ATTRIBUTE_R (thingy , THINGY ) \
161161KONEPLUS_SYSFS_R(thingy, THINGY); \
162- static struct bin_attribute bin_attr_##thingy = { \
162+ static const struct bin_attribute bin_attr_##thingy = { \
163163 .attr = { .name = #thingy, .mode = 0440 }, \
164164 .size = KONEPLUS_SIZE_ ## THINGY, \
165- .read = koneplus_sysfs_read_ ## thingy, \
165+ .read_new = koneplus_sysfs_read_ ## thingy, \
166166}
167167
168168#define KONEPLUS_BIN_ATTRIBUTE_W (thingy , THINGY ) \
169169KONEPLUS_SYSFS_W(thingy, THINGY); \
170- static struct bin_attribute bin_attr_##thingy = { \
170+ static const struct bin_attribute bin_attr_##thingy = { \
171171 .attr = { .name = #thingy, .mode = 0220 }, \
172172 .size = KONEPLUS_SIZE_ ## THINGY, \
173- .write = koneplus_sysfs_write_ ## thingy \
173+ .write_new = koneplus_sysfs_write_ ## thingy \
174174}
175175KONEPLUS_BIN_ATTRIBUTE_W (control , CONTROL );
176176KONEPLUS_BIN_ATTRIBUTE_W (talk , TALK );
@@ -183,8 +183,8 @@ KONEPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
183183KONEPLUS_BIN_ATTRIBUTE_RW (profile_buttons , PROFILE_BUTTONS );
184184
185185static ssize_t koneplus_sysfs_read_profilex_settings (struct file * fp ,
186- struct kobject * kobj , struct bin_attribute * attr , char * buf ,
187- loff_t off , size_t count )
186+ struct kobject * kobj , const struct bin_attribute * attr ,
187+ char * buf , loff_t off , size_t count )
188188{
189189 struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
190190 struct usb_device * usb_dev = interface_to_usbdev (to_usb_interface (dev ));
@@ -201,8 +201,8 @@ static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp,
201201}
202202
203203static ssize_t koneplus_sysfs_read_profilex_buttons (struct file * fp ,
204- struct kobject * kobj , struct bin_attribute * attr , char * buf ,
205- loff_t off , size_t count )
204+ struct kobject * kobj , const struct bin_attribute * attr ,
205+ char * buf , loff_t off , size_t count )
206206{
207207 struct device * dev = kobj_to_dev (kobj )-> parent -> parent ;
208208 struct usb_device * usb_dev = interface_to_usbdev (to_usb_interface (dev ));
@@ -219,16 +219,16 @@ static ssize_t koneplus_sysfs_read_profilex_buttons(struct file *fp,
219219}
220220
221221#define PROFILE_ATTR (number ) \
222- static struct bin_attribute bin_attr_profile##number##_settings = { \
222+ static const struct bin_attribute bin_attr_profile##number##_settings = { \
223223 .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
224224 .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \
225- .read = koneplus_sysfs_read_profilex_settings, \
225+ .read_new = koneplus_sysfs_read_profilex_settings, \
226226 .private = &profile_numbers[number-1], \
227227}; \
228- static struct bin_attribute bin_attr_profile##number##_buttons = { \
228+ static const struct bin_attribute bin_attr_profile##number##_buttons = { \
229229 .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
230230 .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \
231- .read = koneplus_sysfs_read_profilex_buttons, \
231+ .read_new = koneplus_sysfs_read_profilex_buttons, \
232232 .private = &profile_numbers[number-1], \
233233};
234234PROFILE_ATTR (1 );
@@ -321,7 +321,7 @@ static struct attribute *koneplus_attrs[] = {
321321 NULL ,
322322};
323323
324- static struct bin_attribute * koneplus_bin_attributes [] = {
324+ static const struct bin_attribute * const koneplus_bin_attributes [] = {
325325 & bin_attr_control ,
326326 & bin_attr_talk ,
327327 & bin_attr_macro ,
@@ -346,7 +346,7 @@ static struct bin_attribute *koneplus_bin_attributes[] = {
346346
347347static const struct attribute_group koneplus_group = {
348348 .attrs = koneplus_attrs ,
349- .bin_attrs = koneplus_bin_attributes ,
349+ .bin_attrs_new = koneplus_bin_attributes ,
350350};
351351
352352static const struct attribute_group * koneplus_groups [] = {
0 commit comments