Re: [PATCH] HID: force setting drvdata to NULL when removing the driver

From: Hans de Goede
Date: Tue Apr 02 2019 - 10:02:58 EST


Hi,

On 02-04-19 16:00, Benjamin Tissoires wrote:
On Tue, Apr 2, 2019 at 3:52 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:

Hi,

On 02-04-19 15:44, Benjamin Tissoires wrote:
Hi Dmitry,

On Fri, Mar 29, 2019 at 11:26 PM Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:

Hi Benjamin,

On Thu, Mar 28, 2019 at 8:52 AM Benjamin Tissoires
<benjamin.tissoires@xxxxxxxxxx> wrote:

Or when the probe failed.

This is a common pattern in the HID drivers to reset the drvdata. Some
do it properly, some do it only in case of failure.
Anyway, it's never a good thing to have breadcrumbs, so force a clean
state when removing or when probe is failing.

Just a data point: driver core already clears drvdata, so as long as
dev_get/set_drvdata() is the same as hid_get/set_drvdata() no special
handling is needed in HID core.

You are correct (as always ;-P). I'll drop the hid-core changes and
send a v2 ASAP.

I was just looking at the same thing. I should have known about this
since I wrote the patch to make the core clear drvdata. I should have
mentioned that, but I was assuming that the hid code was special somehow,
however now I see it just uses a regular device_add, so indeed the core
changes are not necessary.

Given the large hid-logitech-*.c patch-set it might be easier for
Jiri if you split out the hid-logitech-*.c changes into a separate
patch, then he can keep that on his logitech branch (just a thought).


I do not expect the logitech changes to now create some big conflict.
But looking at the current for-5.2* branches, I should probably split
the series per driver given that there is no more dependency on
hid-core. This way, we can take the logitech changes in the
for-5.2/logitech branch, and you can rebase your work on top of it.

Great, thank you.

Regards,

Hans