Re: [PATCH v3] staging: HID: Add ShanWan USB WirelessGamepad driver

From: Benjamin Tissoires
Date: Tue Apr 25 2023 - 05:05:40 EST


On Apr 19 2023, Mubashshir wrote:
> On Thu, Apr 13 2023 at 06:13:05 PM +02:00:00, Benjamin Tissoires
> <benjamin.tissoires@xxxxxxxxxx> wrote:
> > What's the point of keeping it opened for the lifetime of the device? Do
> > you really need this?
> >
> > > + if (error) {
> > > + dev_err(&hdev->dev, "hw open failed\n");
> > > + hid_hw_stop(hdev);
> > > + return error;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static void shanwan_remove(struct hid_device *hdev)
> > > +{
> > > + hid_hw_close(hdev);
> >
> > If you can drop the last hid_hw_open/close, then you can entirely skip
> > the ->remove().
>
> Would hid_hw_request work without open device?

No, it won't work if the device is not opened. But what's the point of
sending rumble data to the joystick if the device is not opened (so used)
by anybody? open() is called whenever a client opens the device, by
accessing the evdev node, so I think it should be fine.

Cheers,
Benjamin