Skip to content

Commit b20d6bf

Browse files
committed
Input: ati-remote2 - use driver core to instantiate device attributes
Instead of manually creating driver-specific device attributes set struct usb_driver->dev_groups pointer to have the driver core do it. Reviewed-by: Ville Syrjälä <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 2d7877d commit b20d6bf

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed

drivers/input/misc/ati_remote2.c

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -204,26 +204,7 @@ struct ati_remote2 {
204204
unsigned int mode_mask;
205205
};
206206

207-
static int ati_remote2_probe(struct usb_interface *interface, const struct usb_device_id *id);
208-
static void ati_remote2_disconnect(struct usb_interface *interface);
209-
static int ati_remote2_suspend(struct usb_interface *interface, pm_message_t message);
210-
static int ati_remote2_resume(struct usb_interface *interface);
211-
static int ati_remote2_reset_resume(struct usb_interface *interface);
212-
static int ati_remote2_pre_reset(struct usb_interface *interface);
213-
static int ati_remote2_post_reset(struct usb_interface *interface);
214-
215-
static struct usb_driver ati_remote2_driver = {
216-
.name = "ati_remote2",
217-
.probe = ati_remote2_probe,
218-
.disconnect = ati_remote2_disconnect,
219-
.id_table = ati_remote2_id_table,
220-
.suspend = ati_remote2_suspend,
221-
.resume = ati_remote2_resume,
222-
.reset_resume = ati_remote2_reset_resume,
223-
.pre_reset = ati_remote2_pre_reset,
224-
.post_reset = ati_remote2_post_reset,
225-
.supports_autosuspend = 1,
226-
};
207+
static struct usb_driver ati_remote2_driver;
227208

228209
static int ati_remote2_submit_urbs(struct ati_remote2 *ar2)
229210
{
@@ -791,10 +772,7 @@ static struct attribute *ati_remote2_attrs[] = {
791772
&dev_attr_mode_mask.attr,
792773
NULL,
793774
};
794-
795-
static struct attribute_group ati_remote2_attr_group = {
796-
.attrs = ati_remote2_attrs,
797-
};
775+
ATTRIBUTE_GROUPS(ati_remote2);
798776

799777
static int ati_remote2_probe(struct usb_interface *interface, const struct usb_device_id *id)
800778
{
@@ -861,22 +839,16 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
861839

862840
strlcat(ar2->name, "ATI Remote Wonder II", sizeof(ar2->name));
863841

864-
r = sysfs_create_group(&udev->dev.kobj, &ati_remote2_attr_group);
865-
if (r)
866-
goto fail3;
867-
868842
r = ati_remote2_input_init(ar2);
869843
if (r)
870-
goto fail4;
844+
goto fail3;
871845

872846
usb_set_intfdata(interface, ar2);
873847

874848
interface->needs_remote_wakeup = 1;
875849

876850
return 0;
877851

878-
fail4:
879-
sysfs_remove_group(&udev->dev.kobj, &ati_remote2_attr_group);
880852
fail3:
881853
ati_remote2_urb_cleanup(ar2);
882854
fail2:
@@ -900,8 +872,6 @@ static void ati_remote2_disconnect(struct usb_interface *interface)
900872

901873
input_unregister_device(ar2->idev);
902874

903-
sysfs_remove_group(&ar2->udev->dev.kobj, &ati_remote2_attr_group);
904-
905875
ati_remote2_urb_cleanup(ar2);
906876

907877
usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
@@ -1032,4 +1002,18 @@ static int ati_remote2_post_reset(struct usb_interface *interface)
10321002
return r;
10331003
}
10341004

1005+
static struct usb_driver ati_remote2_driver = {
1006+
.name = "ati_remote2",
1007+
.probe = ati_remote2_probe,
1008+
.disconnect = ati_remote2_disconnect,
1009+
.dev_groups = ati_remote2_groups,
1010+
.id_table = ati_remote2_id_table,
1011+
.suspend = ati_remote2_suspend,
1012+
.resume = ati_remote2_resume,
1013+
.reset_resume = ati_remote2_reset_resume,
1014+
.pre_reset = ati_remote2_pre_reset,
1015+
.post_reset = ati_remote2_post_reset,
1016+
.supports_autosuspend = 1,
1017+
};
1018+
10351019
module_usb_driver(ati_remote2_driver);

0 commit comments

Comments
 (0)