Skip to content

Commit cb7c02e

Browse files
committed
Merge branch 'for-6.1/google' into for-linus
- convert to use dev_groups (Greg Kroah-Hartman)
2 parents 1145c3d + 9f4441f commit cb7c02e

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

drivers/hid/hid-google-hammer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,11 @@ static struct hid_driver hammer_driver = {
608608
.probe = hammer_probe,
609609
.remove = hammer_remove,
610610
.feature_mapping = vivaldi_feature_mapping,
611-
.input_configured = vivaldi_input_configured,
612611
.input_mapping = hammer_input_mapping,
613612
.event = hammer_event,
613+
.driver = {
614+
.dev_groups = vivaldi_attribute_groups,
615+
},
614616
};
615617

616618
static int __init hammer_init(void)

drivers/hid/hid-vivaldi-common.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,26 @@ static struct attribute *vivaldi_sysfs_attrs[] = {
116116
NULL
117117
};
118118

119-
static const struct attribute_group vivaldi_attribute_group = {
120-
.attrs = vivaldi_sysfs_attrs,
121-
};
122-
123-
/**
124-
* vivaldi_input_configured - Complete initialization of device using vivaldi map
125-
* @hdev: HID device to which vivaldi attributes should be attached
126-
* @hidinput: HID input device (unused)
127-
*/
128-
int vivaldi_input_configured(struct hid_device *hdev,
129-
struct hid_input *hidinput)
119+
static umode_t vivaldi_is_visible(struct kobject *kobj, struct attribute *attr,
120+
int n)
130121
{
122+
struct hid_device *hdev = to_hid_device(kobj_to_dev(kobj));
131123
struct vivaldi_data *data = hid_get_drvdata(hdev);
132124

133125
if (!data->num_function_row_keys)
134126
return 0;
135-
136-
return devm_device_add_group(&hdev->dev, &vivaldi_attribute_group);
127+
return attr->mode;
137128
}
138-
EXPORT_SYMBOL_GPL(vivaldi_input_configured);
129+
130+
static const struct attribute_group vivaldi_attribute_group = {
131+
.attrs = vivaldi_sysfs_attrs,
132+
.is_visible = vivaldi_is_visible,
133+
};
134+
135+
const struct attribute_group *vivaldi_attribute_groups[] = {
136+
&vivaldi_attribute_group,
137+
NULL,
138+
};
139+
EXPORT_SYMBOL_GPL(vivaldi_attribute_groups);
139140

140141
MODULE_LICENSE("GPL");

drivers/hid/hid-vivaldi-common.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
struct hid_device;
66
struct hid_field;
7-
struct hid_input;
87
struct hid_usage;
98

109
void vivaldi_feature_mapping(struct hid_device *hdev,
1110
struct hid_field *field, struct hid_usage *usage);
1211

13-
int vivaldi_input_configured(struct hid_device *hdev,
14-
struct hid_input *hidinput);
12+
extern const struct attribute_group *vivaldi_attribute_groups[];
1513

1614
#endif /* _HID_VIVALDI_COMMON_H */

drivers/hid/hid-vivaldi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ static struct hid_driver hid_vivaldi = {
4545
.id_table = vivaldi_table,
4646
.probe = vivaldi_probe,
4747
.feature_mapping = vivaldi_feature_mapping,
48-
.input_configured = vivaldi_input_configured,
48+
.driver = {
49+
.dev_groups = vivaldi_attribute_groups,
50+
},
4951
};
5052

5153
module_hid_driver(hid_vivaldi);

0 commit comments

Comments
 (0)