@@ -1163,6 +1163,8 @@ static void hid_apply_multiplier(struct hid_device *hid,
11631163 while (multiplier_collection -> parent_idx != -1 &&
11641164 multiplier_collection -> type != HID_COLLECTION_LOGICAL )
11651165 multiplier_collection = & hid -> collection [multiplier_collection -> parent_idx ];
1166+ if (multiplier_collection -> type != HID_COLLECTION_LOGICAL )
1167+ multiplier_collection = NULL ;
11661168
11671169 effective_multiplier = hid_calculate_multiplier (hid , multiplier );
11681170
@@ -2174,9 +2176,9 @@ static bool hid_hiddev(struct hid_device *hdev)
21742176
21752177
21762178static ssize_t
2177- read_report_descriptor (struct file * filp , struct kobject * kobj ,
2178- struct bin_attribute * attr ,
2179- char * buf , loff_t off , size_t count )
2179+ report_descriptor_read (struct file * filp , struct kobject * kobj ,
2180+ const struct bin_attribute * attr ,
2181+ char * buf , loff_t off , size_t count )
21802182{
21812183 struct device * dev = kobj_to_dev (kobj );
21822184 struct hid_device * hdev = to_hid_device (dev );
@@ -2193,24 +2195,17 @@ read_report_descriptor(struct file *filp, struct kobject *kobj,
21932195}
21942196
21952197static ssize_t
2196- show_country (struct device * dev , struct device_attribute * attr ,
2197- char * buf )
2198+ country_show (struct device * dev , struct device_attribute * attr ,
2199+ char * buf )
21982200{
21992201 struct hid_device * hdev = to_hid_device (dev );
22002202
22012203 return sprintf (buf , "%02x\n" , hdev -> country & 0xff );
22022204}
22032205
2204- static struct bin_attribute dev_bin_attr_report_desc = {
2205- .attr = { .name = "report_descriptor" , .mode = 0444 },
2206- .read = read_report_descriptor ,
2207- .size = HID_MAX_DESCRIPTOR_SIZE ,
2208- };
2206+ static const BIN_ATTR_RO (report_descriptor , HID_MAX_DESCRIPTOR_SIZE ) ;
22092207
2210- static const struct device_attribute dev_attr_country = {
2211- .attr = { .name = "country" , .mode = 0444 },
2212- .show = show_country ,
2213- };
2208+ static const DEVICE_ATTR_RO (country );
22142209
22152210int hid_connect (struct hid_device * hdev , unsigned int connect_mask )
22162211{
@@ -2800,13 +2795,13 @@ static struct attribute *hid_dev_attrs[] = {
28002795 & dev_attr_modalias .attr ,
28012796 NULL ,
28022797};
2803- static struct bin_attribute * hid_dev_bin_attrs [] = {
2804- & dev_bin_attr_report_desc ,
2798+ static const struct bin_attribute * hid_dev_bin_attrs [] = {
2799+ & bin_attr_report_descriptor ,
28052800 NULL
28062801};
28072802static const struct attribute_group hid_dev_group = {
28082803 .attrs = hid_dev_attrs ,
2809- .bin_attrs = hid_dev_bin_attrs ,
2804+ .bin_attrs_new = hid_dev_bin_attrs ,
28102805};
28112806__ATTRIBUTE_GROUPS (hid_dev );
28122807
0 commit comments