From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbbJNXu3 (ORCPT ); Wed, 14 Oct 2015 19:50:29 -0400 Received: from down.free-electrons.com ([37.187.137.238]:49384 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754006AbbJNXu2 (ORCPT ); Wed, 14 Oct 2015 19:50:28 -0400 Date: Thu, 15 Oct 2015 01:50:26 +0200 From: Alexandre Belloni To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Alessandro Zummo , rtc-linux@googlegroups.com, kernel@pengutronix.de, Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 0/4] rtc: pcf2127: a fix, a cleanup and two questionable features Message-ID: <20151014235026.GB3421@piout.net> References: <1443777442-15920-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1443777442-15920-1-git-send-email-u.kleine-koenig@pengutronix.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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