From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.trumtrar@pengutronix.de (Steffen Trumtrar) Date: Tue, 5 Mar 2013 09:02:52 +0100 Subject: [PATCH 6/9] rtc: stmp3xxx: add sysfs entries for persistent regs In-Reply-To: References: <1362405948-12992-1-git-send-email-s.trumtrar@pengutronix.de> <1362405948-12992-7-git-send-email-s.trumtrar@pengutronix.de> Message-ID: <20130305080252.GA7042@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Grant! On Mon, Mar 04, 2013 at 11:14:54PM +0800, Grant Likely wrote: > On Mon, Mar 4, 2013 at 10:05 PM, Steffen Trumtrar > wrote: > > The persistent registers 1-5 are completely software defined. To have access > > from userspace, export them via sysfs. > > > > Signed-off-by: Steffen Trumtrar > > Hi Steffen, > > A few comments on this. First and foremost, any additions to the > kernel sysfs interface must be accompanied with documentation in > Documentation/ABI/. Second, adding attributes to an existing device Okay. I forgot that and will add it in the next version. > that has already been registered is almost guaranteed to be wrong. The > attributes need to be added all at the same time so they are available > immediately when the new device uevent is issued by the kernel. > > Instead, the correct thing to do is add an attribute_group to the > child device before the device gets registered. See the 'attributes' > section of Documentation/driver-model/device.txt to see how to do > this. > > (I also see that the rtc core code is doing the wrong thing here also. > rtc_sysfs_add_device(), rtc_sysfs_add_device() should also be replaced > with an attribute group so that the sysfs files get added > automatically; but that is outside the scope of this patch) > Hm, I modeled it after other rtcs and the rtc_sysfs. Seems that I have to rework this. Thanks, Steffen -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |