linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] rtc: isl12022: simplify some expressions
Date: Wed, 14 Sep 2022 17:08:49 +0200	[thread overview]
Message-ID: <YyHugb47cJPNuHbs@mail.local> (raw)
In-Reply-To: <20220830100152.698506-3-linux@rasmusvillemoes.dk>

Hi,

On 30/08/2022 12:01:48+0200, Rasmus Villemoes wrote:
> These instances of '&client->dev' might as well be spelled 'dev', since
> 'client' has been computed from 'dev' via 'client =
> to_i2c_client(dev)'.
> 
> Later patches will get rid of that local variable 'client', so remove
> these unnecessary references so those later patches become easier to
> read.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/rtc/rtc-isl12022.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
> index 2dc19061cf5f..5e6bb9153c89 100644
> --- a/drivers/rtc/rtc-isl12022.c
> +++ b/drivers/rtc/rtc-isl12022.c
> @@ -112,13 +112,13 @@ static int isl12022_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  		return ret;
>  
>  	if (buf[ISL12022_REG_SR] & (ISL12022_SR_LBAT85 | ISL12022_SR_LBAT75)) {
> -		dev_warn(&client->dev,
> +		dev_warn(dev,

While at it, I would prefer that one to also become a dev_dbg

>  			 "voltage dropped below %u%%, "
>  			 "date and time is not reliable.\n",
>  			 buf[ISL12022_REG_SR] & ISL12022_SR_LBAT85 ? 85 : 75);
>  	}
>  
> -	dev_dbg(&client->dev,
> +	dev_dbg(dev,
>  		"%s: raw data is sec=%02x, min=%02x, hr=%02x, "
>  		"mday=%02x, mon=%02x, year=%02x, wday=%02x, "
>  		"sr=%02x, int=%02x",
> @@ -141,7 +141,7 @@ static int isl12022_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  	tm->tm_mon = bcd2bin(buf[ISL12022_REG_MO] & 0x1F) - 1;
>  	tm->tm_year = bcd2bin(buf[ISL12022_REG_YR]) + 100;
>  
> -	dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
> +	dev_dbg(dev, "%s: secs=%d, mins=%d, hours=%d, "

You probably want to convert that to %ptR

>  		"mday=%d, mon=%d, year=%d, wday=%d\n",
>  		__func__,
>  		tm->tm_sec, tm->tm_min, tm->tm_hour,
> @@ -158,7 +158,7 @@ static int isl12022_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	int ret;
>  	uint8_t buf[ISL12022_REG_DW + 1];
>  
> -	dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
> +	dev_dbg(dev, "%s: secs=%d, mins=%d, hours=%d, "

ditto

>  		"mday=%d, mon=%d, year=%d, wday=%d\n",
>  		__func__,
>  		tm->tm_sec, tm->tm_min, tm->tm_hour,
> @@ -173,8 +173,7 @@ static int isl12022_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  		/* Check if WRTC (write rtc enable) is set factory default is
>  		 * 0 (not set) */
>  		if (!(buf[0] & ISL12022_INT_WRTC)) {
> -			dev_info(&client->dev,
> -				 "init write enable and 24 hour format\n");
> +			dev_info(dev, "init write enable and 24 hour format\n");

I guess that one should simply be removed

>  
>  			/* Set the write enable bit. */
>  			ret = isl12022_write_reg(client,
> -- 
> 2.37.2
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2022-09-14 15:09 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 10:01 [PATCH 0/6] rtc: isl12022: cleanups and hwmon support Rasmus Villemoes
2022-08-30 10:01 ` [PATCH 1/6] rtc: isl12022: stop using deprecated devm_rtc_device_register() Rasmus Villemoes
2022-08-30 10:01 ` [PATCH 2/6] rtc: isl12022: simplify some expressions Rasmus Villemoes
2022-09-14 15:08   ` Alexandre Belloni [this message]
2022-09-21  7:08     ` Rasmus Villemoes
2022-09-21  7:12       ` Alexandre Belloni
2022-08-30 10:01 ` [PATCH 3/6] rtc: isl12022: use dev_set_drvdata() instead of i2c_set_clientdata() Rasmus Villemoes
2022-08-30 10:01 ` [PATCH 4/6] rtc: isl12022: drop redundant write to HR register Rasmus Villemoes
2022-08-30 10:01 ` [PATCH 5/6] rtc: isl12022: switch to using regmap API Rasmus Villemoes
2022-08-30 10:01 ` [PATCH 6/6] rtc: isl12022: add support for temperature sensor Rasmus Villemoes
2022-08-30 13:13   ` Guenter Roeck
2022-09-14 15:12   ` Alexandre Belloni
2022-09-21  7:58     ` Rasmus Villemoes
2022-09-21  9:10       ` Alexandre Belloni
2022-09-09  8:15 ` [PATCH 0/6] rtc: isl12022: cleanups and hwmon support Rasmus Villemoes
2022-09-14 15:16   ` Alexandre Belloni
2022-09-21 11:46 ` [PATCH v2 0/9] " Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 1/9] rtc: isl12022: stop using deprecated devm_rtc_device_register() Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 2/9] rtc: isl12022: specify range_min and range_max Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 3/9] rtc: isl12022: drop a dev_info() Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 4/9] rtc: isl12022: simplify some expressions Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 5/9] rtc: isl12022: use %ptR Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 6/9] rtc: isl12022: use dev_set_drvdata() instead of i2c_set_clientdata() Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 7/9] rtc: isl12022: drop redundant write to HR register Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 8/9] rtc: isl12022: switch to using regmap API Rasmus Villemoes
2022-09-21 11:46   ` [PATCH v2 9/9] rtc: isl12022: add support for temperature sensor Rasmus Villemoes
2022-09-21 14:13     ` Guenter Roeck
2022-09-23  8:40       ` Rasmus Villemoes
2022-09-23 13:51         ` Guenter Roeck
2022-10-26 13:38     ` [PATCH v3 " Rasmus Villemoes
2022-10-26 14:46       ` Guenter Roeck
2022-11-04 11:02       ` [PATCH v4] " Rasmus Villemoes
2022-11-14 21:41         ` Alexandre Belloni
2022-10-07 13:51   ` [PATCH v2 0/9] rtc: isl12022: cleanups and hwmon support Rasmus Villemoes
2022-10-13 21:31   ` 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=YyHugb47cJPNuHbs@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).