All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org
Subject: [rtc-linux] Re: [PATCH 1/3] rtc: initialize rtc name early
Date: Wed, 1 Apr 2015 05:01:05 +0200	[thread overview]
Message-ID: <20150401030105.GN3849@piout.net> (raw)
In-Reply-To: <1427576976-22353-1-git-send-email-aaro.koskinen@iki.fi>

On 28/03/2015 at 23:09:34 +0200, Aaro Koskinen wrote :
> In some error cases RTC name is used before it is initialized:
> 
> 	rtc-rs5c372 0-0032: clock needs to be set
> 	rtc-rs5c372 0-0032: rs5c372b found, 24hr, driver version 0.6
> 	rtc (null): read_time: fail to read
> 	rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0
> 
> Fix by initializing the name early.
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/rtc/class.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index 472a5ad..014ecbc 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c
> @@ -225,15 +225,15 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
>  	rtc->pie_timer.function = rtc_pie_update_irq;
>  	rtc->pie_enabled = 0;
>  
> +	strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
> +	dev_set_name(&rtc->dev, "rtc%d", id);
> +
>  	/* Check to see if there is an ALARM already set in hw */
>  	err = __rtc_read_alarm(rtc, &alrm);
>  
>  	if (!err && !rtc_valid_tm(&alrm.time))
>  		rtc_initialize_alarm(rtc, &alrm);
>  
> -	strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
> -	dev_set_name(&rtc->dev, "rtc%d", id);
> -
>  	rtc_dev_prepare(rtc);
>  
>  	err = device_register(&rtc->dev);
> -- 
> 2.2.0
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] rtc: initialize rtc name early
Date: Wed, 1 Apr 2015 05:01:05 +0200	[thread overview]
Message-ID: <20150401030105.GN3849@piout.net> (raw)
In-Reply-To: <1427576976-22353-1-git-send-email-aaro.koskinen@iki.fi>

On 28/03/2015 at 23:09:34 +0200, Aaro Koskinen wrote :
> In some error cases RTC name is used before it is initialized:
> 
> 	rtc-rs5c372 0-0032: clock needs to be set
> 	rtc-rs5c372 0-0032: rs5c372b found, 24hr, driver version 0.6
> 	rtc (null): read_time: fail to read
> 	rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0
> 
> Fix by initializing the name early.
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/rtc/class.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index 472a5ad..014ecbc 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c
> @@ -225,15 +225,15 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
>  	rtc->pie_timer.function = rtc_pie_update_irq;
>  	rtc->pie_enabled = 0;
>  
> +	strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
> +	dev_set_name(&rtc->dev, "rtc%d", id);
> +
>  	/* Check to see if there is an ALARM already set in hw */
>  	err = __rtc_read_alarm(rtc, &alrm);
>  
>  	if (!err && !rtc_valid_tm(&alrm.time))
>  		rtc_initialize_alarm(rtc, &alrm);
>  
> -	strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
> -	dev_set_name(&rtc->dev, "rtc%d", id);
> -
>  	rtc_dev_prepare(rtc);
>  
>  	err = device_register(&rtc->dev);
> -- 
> 2.2.0
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  parent reply	other threads:[~2015-04-01  3:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-28 21:09 [rtc-linux] [PATCH 1/3] rtc: initialize rtc name early Aaro Koskinen
2015-03-28 21:09 ` Aaro Koskinen
2015-03-28 21:09 ` [rtc-linux] [PATCH 2/3] rtc: __rtc_read_time: reduce log level Aaro Koskinen
2015-03-28 21:09   ` Aaro Koskinen
2015-04-01  3:21   ` [rtc-linux] " Alexandre Belloni
2015-04-01  3:21     ` Alexandre Belloni
2015-04-01  3:25     ` [rtc-linux] " Joe Perches
2015-04-01  3:25       ` Joe Perches
2015-04-01  9:55       ` [rtc-linux] " Alexandre Belloni
2015-04-01  9:55         ` Alexandre Belloni
2015-03-28 21:09 ` [rtc-linux] [PATCH 3/3] rtc: hctosys: use function name in the error log Aaro Koskinen
2015-03-28 21:09   ` Aaro Koskinen
2015-04-01  3:01   ` [rtc-linux] " Alexandre Belloni
2015-04-01  3:01     ` Alexandre Belloni
2015-04-01  3:18     ` [rtc-linux] " Joe Perches
2015-04-01  3:18       ` Joe Perches
2015-04-01  7:05       ` [rtc-linux] " Alessandro Zummo
2015-04-01  7:05         ` Alessandro Zummo
2015-04-01  7:15         ` Joe Perches
2015-04-01  7:15           ` Joe Perches
2015-04-01 10:42       ` Alexandre Belloni
2015-04-01 10:42         ` Alexandre Belloni
2015-04-01 16:12         ` [rtc-linux] [PATCH] rtc: Use more standard kernel logging styles Joe Perches
2015-04-01 16:12           ` Joe Perches
2015-04-02  7:47           ` [rtc-linux] " Krzysztof Kozlowski
2015-04-02  7:47             ` Krzysztof Kozlowski
2015-04-05 10:17           ` [rtc-linux] " Alexandre Belloni
2015-04-05 10:17             ` Alexandre Belloni
2015-04-01  3:01 ` Alexandre Belloni [this message]
2015-04-01  3:01   ` [PATCH 1/3] rtc: initialize rtc name early Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150401030105.GN3849@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=aaro.koskinen@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.