* [PATCH v2] rtc: pcf2127: report battery switch over
@ 2020-05-11 14:03 Alexandre Belloni
2020-05-11 22:59 ` kbuild test robot
0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2020-05-11 14:03 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
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..e5e3cd128476 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;
return put_user(touser, (unsigned int __user *)arg);
+
+ case RTC_VL_CLR:
+ return regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
+ PCF2127_BIT_CTRL3_BF, 0);
+
default:
return -ENOIOCTLCMD;
}
@@ -493,7 +502,6 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
*/
ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
PCF2127_BIT_CTRL3_BTSE |
- PCF2127_BIT_CTRL3_BF |
PCF2127_BIT_CTRL3_BIE |
PCF2127_BIT_CTRL3_BLIE, 0);
if (ret) {
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] rtc: pcf2127: report battery switch over
2020-05-11 14:03 [PATCH v2] rtc: pcf2127: report battery switch over Alexandre Belloni
@ 2020-05-11 22:59 ` kbuild test robot
0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2020-05-11 22:59 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2647 bytes --]
Hi Alexandre,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.7-rc5 next-20200511]
[cannot apply to abelloni/rtc-next linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Alexandre-Belloni/rtc-pcf2127-report-battery-switch-over/20200512-024648
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ef96a5bb12be62ef75b5828c0aab838ebb29cb8
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/rtc/rtc-pcf2127.c: In function 'pcf2127_rtc_ioctl':
>> drivers/rtc/rtc-pcf2127.c:206:14: error: 'RTC_VL_BACKUP_SWITCH' undeclared (first use in this function); did you mean 'RTC_VL_BACKUP_EMPTY'?
touser |= RTC_VL_BACKUP_SWITCH;
^~~~~~~~~~~~~~~~~~~~
RTC_VL_BACKUP_EMPTY
drivers/rtc/rtc-pcf2127.c:206:14: note: each undeclared identifier is reported only once for each function it appears in
vim +206 drivers/rtc/rtc-pcf2127.c
187
188 #ifdef CONFIG_RTC_INTF_DEV
189 static int pcf2127_rtc_ioctl(struct device *dev,
190 unsigned int cmd, unsigned long arg)
191 {
192 struct pcf2127 *pcf2127 = dev_get_drvdata(dev);
193 int val, touser = 0;
194 int ret;
195
196 switch (cmd) {
197 case RTC_VL_READ:
198 ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL3, &val);
199 if (ret)
200 return ret;
201
202 if (val & PCF2127_BIT_CTRL3_BLF)
203 touser |= RTC_VL_BACKUP_LOW;
204
205 if (val & PCF2127_BIT_CTRL3_BF)
> 206 touser |= RTC_VL_BACKUP_SWITCH;
207
208 return put_user(touser, (unsigned int __user *)arg);
209
210 case RTC_VL_CLR:
211 return regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
212 PCF2127_BIT_CTRL3_BF, 0);
213
214 default:
215 return -ENOIOCTLCMD;
216 }
217 }
218 #else
219 #define pcf2127_rtc_ioctl NULL
220 #endif
221
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 72393 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-11 22:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 14:03 [PATCH v2] rtc: pcf2127: report battery switch over Alexandre Belloni
2020-05-11 22:59 ` kbuild test robot
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.