Re: [PATCH v1 1/4] rtc: ab-eoz9: make use of regmap local variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexandre,

On Mon Apr 5, 2021 at 1:36 PM EDT, Alexandre Belloni wrote:
> Hello,
>
> On 05/04/2021 10:13:31-0400, Liam Beguin wrote:
> > From: Liam Beguin <lvb@xxxxxxxxxx>
> > 
> > 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.
>

I'm not particularly attached to this change. It only started because
regmap wasn't used in abeoz9_rtc_set_time. I'll drop it.

Liam

> > Signed-off-by: Liam Beguin <lvb@xxxxxxxxxx>
> > ---
> >  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





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux