All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: linux-rtc@vger.kernel.org,
	"Per Nørgaard Christensen" <per.christensen@prevas.dk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] rtc: pcf2127: report battery switch over
Date: Wed, 6 May 2020 00:09:11 +0200	[thread overview]
Message-ID: <20200505220911.GW34497@piout.net> (raw)
In-Reply-To: <e4910679-4453-f753-2c3e-4c93fd755b39@prevas.dk>

On 05/05/2020 23:30:18+0200, Rasmus Villemoes wrote:
> On 05/05/2020 22.13, Alexandre Belloni wrote:
> > Add support for the RTC_VL_BACKUP_SWITCH flag to report battery switch over
> > events.
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > ---
> >  drivers/rtc/rtc-pcf2127.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> > index 039078029bd4..967de68e1b03 100644
> > --- a/drivers/rtc/rtc-pcf2127.c
> > +++ b/drivers/rtc/rtc-pcf2127.c
> > @@ -188,18 +188,27 @@ static int pcf2127_rtc_ioctl(struct device *dev,
> >  				unsigned int cmd, unsigned long arg)
> >  {
> >  	struct pcf2127 *pcf2127 = dev_get_drvdata(dev);
> > -	int touser;
> > +	int val, touser = 0;
> >  	int ret;
> >  
> >  	switch (cmd) {
> >  	case RTC_VL_READ:
> > -		ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL3, &touser);
> > +		ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL3, &val);
> >  		if (ret)
> >  			return ret;
> >  
> > -		touser = touser & PCF2127_BIT_CTRL3_BLF ? RTC_VL_BACKUP_LOW : 0;
> > +		if (val & PCF2127_BIT_CTRL3_BLF)
> > +			touser = RTC_VL_BACKUP_LOW;
> > +
> > +		if (val & PCF2127_BIT_CTRL3_BF)
> > +			touser |= RTC_VL_BACKUP_SWITCH;
> 
> I think it's a bit easier to read if you use |= in both cases.
> 
> Re patch 3, one saves a little .text by eliding the ioctl function when,
> as you say, it cannot be called anyway. No strong opinion either way, I
> don't think anybody actually builds without CONFIG_RTC_INTF_DEV, but
> those that do are probably the ones that care about having a tiny vmlinux.
> 

Honestly, I don't think it is worth doing that. On armv7, this only
removes 248 bytes. Also, compiling without CONFIG_RTC_INTF_DEV simply
makes the RTC unusable. There are no tools actually using the sysfs
interface instead of the char device interface. I prefer keeping
CONFIG_RTC_INTF_DEV private to the core.

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

      reply	other threads:[~2020-05-05 22:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 20:13 [PATCH 1/5] rtc: add new VL flag for backup switchover Alexandre Belloni
2020-05-05 20:13 ` [PATCH 2/5] rtc: pcf2127: let the core handle rtc range Alexandre Belloni
2020-05-05 20:13 ` [PATCH 3/5] rtc: pcf2127: remove unnecessary #ifdef Alexandre Belloni
2020-05-05 20:13 ` [PATCH 4/5] rtc: pcf2127: set regmap max_register Alexandre Belloni
2020-05-05 20:13 ` [PATCH 5/5] rtc: pcf2127: report battery switch over Alexandre Belloni
2020-05-05 21:30   ` Rasmus Villemoes
2020-05-05 22:09     ` Alexandre Belloni [this message]

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=20200505220911.GW34497@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=per.christensen@prevas.dk \
    --cc=rasmus.villemoes@prevas.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 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.