Re: [PATCH 6/9] iio: common: cros_ec_sensors: simplify getting .driver_data
From: Wolfram Sang
Date: Tue Oct 12 2021 - 03:31:21 EST
Hi Jonathan,
> It's not something that ever bothered me that much, but we have had debates in
> the past about whether there are semantic issues around this sort of cleanup
> as it mixes
>
> platform_set_drvdata() with device_get_drvdata()
Yeah, I see this concern. Mixing the two makes reading the code a bit
more difficult. As I said, it wasn't so easy to convert set_drvdata, but
I will have another go at this.
> Whilst they access the same pointer today, in theory that isn't necessarily
> always going to be the case in future and it isn't necessarily apparent
> to the casual reader of the code.
That one I don't really see. *_get_drvdata() should always get
'dev->driver_data' and the prefix just tells from what namespace we
come. If you want to change that, a lot of things will break loose, I'd
think. Even in the unlikely case of platform_device gaining a seperate
driver_data(?), it probably should be named *_get_pdrvdata(), or?
Thanks and happy hacking,
Wolfram
Attachment:
signature.asc
Description: PGP signature