Re: [PATCH v1 0/4] rtc: pcf2127: a fix, a cleanup and two questionable features
From: Alexandre Belloni
Date: Wed Oct 14 2015 - 19:50:33 EST
On 02/10/2015 at 11:17:18 +0200, Uwe Kleine-König wrote :
> Hello,
>
> the fix and the cleanup should be fine. Patches 3 and 4 are probably
> wrong (but still state of the art for other in-tree drivers) because
> sysfs_create_file is called too late. See
> http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
> for some details.
>
> I failed to find how to do it correctly though:
> - the attributes are device specific, so device_driver::groups is wrong
> - for using the i2c's device group it's too late in .probe
> - the rtc's device is only malloc'd in rtc_device_register and when
> this returns it's already too late again.
> - these are neither class nor bus attributes, so these are ruled out, too.
>
Most of the drivers currently don't care about that race condition so I
could merge them as-is.
I currently have a PoC that creates the nvram file with the rest of the
sysfs files which solves that. I think this could also be extended to
support battery status.
> Uwe Kleine-König (4):
> rtc: pcf2127: fix reading uninitialized value on RTC_READ_VL ioctl
> rtc: pcf2127: remove useless driver version
> rtc: pcf2127: implement reading battery status bits
> rtc: pcf2127: implement access to nvram
>
> drivers/rtc/rtc-pcf2127.c | 285 ++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 261 insertions(+), 24 deletions(-)
>
> --
> 2.6.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/