All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Liam Beguin <liambeguin@gmail.com>
Cc: a.zummo@towertech.it, panfilov.artyom@gmail.com,
	linux-rtc@vger.kernel.org
Subject: Re: [PATCH v1 1/4] rtc: ab-eoz9: make use of regmap local variable
Date: Mon, 5 Apr 2021 19:36:57 +0200	[thread overview]
Message-ID: <YGtKuSbNVKm9aYau@piout.net> (raw)
In-Reply-To: <20210405141334.3884528-2-liambeguin@gmail.com>

Hello,

On 05/04/2021 10:13:31-0400, Liam Beguin wrote:
> From: Liam Beguin <lvb@xiphos.com>
> 
> Make use of the regmap local variable to shorten long lines.
> 

As you are still using data->regmap in the subsequent patches, I don't
see the point of this one. Moreover, you could have everything on one
line without the intermediate variable.

> Signed-off-by: Liam Beguin <lvb@xiphos.com>
> ---
>  drivers/rtc/rtc-ab-eoz9.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ab-eoz9.c b/drivers/rtc/rtc-ab-eoz9.c
> index b20d8f26dcdb..2568984fb8d3 100644
> --- a/drivers/rtc/rtc-ab-eoz9.c
> +++ b/drivers/rtc/rtc-ab-eoz9.c
> @@ -124,6 +124,7 @@ static int abeoz9_reset_validity(struct regmap *regmap)
>  static int abeoz9_rtc_get_time(struct device *dev, struct rtc_time *tm)
>  {
>  	struct abeoz9_rtc_data *data = dev_get_drvdata(dev);
> +	struct regmap *regmap = data->regmap;
>  	u8 regs[ABEOZ9_SEC_LEN];
>  	int ret;
>  
> @@ -131,9 +132,7 @@ static int abeoz9_rtc_get_time(struct device *dev, struct rtc_time *tm)
>  	if (ret)
>  		return ret;
>  
> -	ret = regmap_bulk_read(data->regmap, ABEOZ9_REG_SEC,
> -			       regs,
> -			       sizeof(regs));
> +	ret = regmap_bulk_read(regmap, ABEOZ9_REG_SEC, regs, sizeof(regs));
>  	if (ret) {
>  		dev_err(dev, "reading RTC time failed (%d)\n", ret);
>  		return ret;
> @@ -174,10 +173,7 @@ static int abeoz9_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	regs[ABEOZ9_REG_MONTHS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_mon + 1);
>  	regs[ABEOZ9_REG_YEARS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_year - 100);
>  
> -	ret = regmap_bulk_write(data->regmap, ABEOZ9_REG_SEC,
> -				regs,
> -				sizeof(regs));
> -
> +	ret = regmap_bulk_write(regmap, ABEOZ9_REG_SEC, regs, sizeof(regs));
>  	if (ret) {
>  		dev_err(dev, "set RTC time failed (%d)\n", ret);
>  		return ret;
> -- 
> 2.30.1.489.g328c10930387
> 

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

  reply	other threads:[~2021-04-05 17:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 14:13 [PATCH v1 0/4] add alarm support for the rtc-ab-eoz9 Liam Beguin
2021-04-05 14:13 ` [PATCH v1 1/4] rtc: ab-eoz9: make use of regmap local variable Liam Beguin
2021-04-05 17:36   ` Alexandre Belloni [this message]
2021-04-05 20:19     ` Liam Beguin
2021-04-05 14:13 ` [PATCH v1 2/4] rtc: ab-eoz9: set regmap max_register Liam Beguin
2021-04-05 14:13 ` [PATCH v1 3/4] rtc: ab-eoz9: add alarm support Liam Beguin
2021-04-05 17:42   ` Alexandre Belloni
2021-04-05 20:21     ` Liam Beguin
2021-04-05 14:13 ` [PATCH v1 4/4] rtc: ab-eoz9: make use of RTC_FEATURE_ALARM Liam Beguin
2021-04-05 17:43   ` Alexandre Belloni
2021-04-05 20:24     ` Liam Beguin

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=YGtKuSbNVKm9aYau@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=liambeguin@gmail.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=panfilov.artyom@gmail.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.