rtc: fix W=1 warnings and errors
Subsystems (4)
Alexandre Belloni
maintainercover rtc: fix W=1 warnings and errors
This series fixes kerneldoc and unused variables issues detected when using W=1.
Alexandre Belloni (8):
rtc: sysfs: fix hctosys_show kerneldoc
rtc: ds1374: remove unused variable
rtc: ds1685: remove set but unused variables
rtc: ds1685: fix build error with make W=1
rtc: m41t80: remove excess kerneldoc
rtc: pm8xxx: update kerneldoc for struct pm8xxx_rtc
rtc: tegra: remove set but unused variable
rtc: v3020: remove set but unused variable
drivers/rtc/rtc-ds1374.c | 3 +-- drivers/rtc/rtc-ds1685.c | 12 +++++------- drivers/rtc/rtc-m41t80.c | 1 - drivers/rtc/rtc-pm8xxx.c | 2 +- drivers/rtc/rtc-tegra.c | 4 ++-- drivers/rtc/rtc-v3020.c | 3 +-- drivers/rtc/sysfs.c | 5 ++++- 7 files changed, 14 insertions(+), 16 deletions(-)
Signature · 1 line
2.23.0
Alexandre Belloni
maintainerPATCH 1/8 rtc: sysfs: fix hctosys_show kerneldoc
Fix undocumented function parameters:drivers/rtc/sysfs.c:112: warning: Function parameter or member 'dev' not described in 'hctosys_show' drivers/rtc/sysfs.c:112: warning: Function parameter or member 'attr' not described in 'hctosys_show' drivers/rtc/sysfs.c:112: warning: Function parameter or member 'buf' not described in 'hctosys_show'
--- drivers/rtc/sysfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rtc/sysfs.c +4 -1
@@ -103,8 +103,11 @@ static DEVICE_ATTR_RW(max_user_freq);/** * rtc_sysfs_show_hctosys - indicate if the given RTC set the system time +* @dev: The device that the attribute belongs to. +* @attr: The attribute being read. +* @buf: The result buffer. * -* Returns 1 if the system clock was set by this RTC at the last +* buf is "1" if the system clock was set by this RTC at the last * boot or resume event. */ static ssize_t
Signature · 1 line
2.23.0
Alexandre Belloni
maintainerPATCH 2/8 rtc: ds1374: remove unused variable
In reply to Alexandre BelloniFix warning:
drivers/rtc/rtc-ds1374.c: In function ‘ds1374_wdt_disable’:drivers/rtc/rtc-ds1374.c:442:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
--- drivers/rtc/rtc-ds1374.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-ds1374.c +1 -2
@@ -439,14 +439,13 @@ static void ds1374_wdt_ping(void)static void ds1374_wdt_disable (void ) { -int ret = -ENOIOCTLCMD ;int cr; cr =i2c_smbus_read_byte_data (save_client,DS1374_REG_CR );/* Disable watchdog timer */ cr &= ~DS1374_REG_CR_WACE ; - ret =i2c_smbus_write_byte_data (save_client,DS1374_REG_CR , cr); +i2c_smbus_write_byte_data (save_client,DS1374_REG_CR , cr); }/*
Signature · 1 line
2.23.0
Alexandre Belloni
maintainerPATCH 3/8 rtc: ds1685: remove set but unused variables
In reply to Alexandre BelloniFix the following warnings:drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_read_time’:drivers/rtc/rtc-ds1685.c:264:5: warning: variable ‘ctrlb’ set but not used [-Wunused-but-set-variable]
264 | u8 ctrlb, century;
| ^~~~~drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_proc’:drivers/rtc/rtc-ds1685.c:758:19: warning: variable ‘ctrlc’ set but not used [-Wunused-but-set-variable]
758 | u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8];
| ^~~~~
--- drivers/rtc/rtc-ds1685.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/rtc/rtc-ds1685.c +2 -4
@@ -261,7 +261,7 @@ static int ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct ds1685_priv *rtc = dev_get_drvdata(dev); -u8 ctrlb, century; +u8 century;u8 seconds, minutes, hours, wday, mday, month, years;/* Fetch the time info from the RTC registers. */
@@ -274,7 +274,6 @@ ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) month = rtc->read (rtc,RTC_MONTH ); years = rtc->read (rtc,RTC_YEAR ); century = rtc->read (rtc,RTC_CENTURY ); - ctrlb = rtc->read (rtc,RTC_CTRL_B );ds1685_rtc_end_data_access (rtc);/* bcd2bin if needed, perform fixups, and store to rtc_time. */
@@ -755,7 +754,7 @@ static int ds1685_rtc_proc(struct device *dev, struct seq_file *seq) { struct ds1685_priv *rtc = dev_get_drvdata(dev); -u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8 ]; +u8 ctrla, ctrlb, ctrld, ctrl4a, ctrl4b, ssn[8 ];char *model;/* Read all the relevant data from the control registers. */
@@ -763,7 +762,6 @@ ds1685_rtc_proc(struct device *dev, struct seq_file *seq)ds1685_rtc_get_ssn (rtc, ssn); ctrla = rtc->read (rtc,RTC_CTRL_A ); ctrlb = rtc->read (rtc,RTC_CTRL_B ); - ctrlc = rtc->read (rtc,RTC_CTRL_C ); ctrld = rtc->read (rtc,RTC_CTRL_D ); ctrl4a = rtc->read (rtc,RTC_EXT_CTRL_4A ); ctrl4b = rtc->read (rtc,RTC_EXT_CTRL_4B );
Signature · 1 line
2.23.0
Re: [PATCH 3/8] rtc: ds1685: remove set but unused variables
Quoted 47 lines · Alexandre Belloni
Fix the following warnings:
drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_read_time’:drivers/rtc/rtc-ds1685.c:264:5: warning: variable ‘ctrlb’ set but not used [-Wunused-but-set-variable]264 | u8 ctrlb, century; | ^~~~~
drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_proc’:drivers/rtc/rtc-ds1685.c:758:19: warning: variable ‘ctrlc’ set but not used [-Wunused-but-set-variable]
758 | u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8];
| ^~~~~Cc Joshua Kinard <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- drivers/rtc/rtc-ds1685.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/rtc/rtc-ds1685.c +2
-3@@ -261,7 +261,7 @@ static int ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct ds1685_priv *rtc = dev_get_drvdata(dev); -u8 ctrlb, century; +u8 century;u8 seconds, minutes, hours, wday, mday, month, years;/* Fetch the time info from the RTC registers. */ @@ -274,7 +274,6 @@ ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) month = rtc->read (rtc,RTC_MONTH ); years = rtc->read (rtc,RTC_YEAR ); century = rtc->read (rtc,RTC_CENTURY ); - ctrlb = rtc->read (rtc,RTC_CTRL_B );ds1685_rtc_end_data_access (rtc);/* bcd2bin if needed, perform fixups, and store to rtc_time. */ @@ -755,7 +754,7 @@ static int ds1685_rtc_proc(struct device *dev, struct seq_file *seq) { struct ds1685_priv *rtc = dev_get_drvdata(dev); -u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8 ]; +u8 ctrla, ctrlb, ctrld, ctrl4a, ctrl4b, ssn[8 ];char *model;/* Read all the relevant data from the control registers. */
drivers/rtc/rtc-ds1685.c ds1685_rtc_proc(struct device *dev, struct seq_file *seq) · line 767
Quoted 7 lines
drivers/rtc/rtc-ds1685.c +0
-1@@ -763,7 +762,6 @@ ds1685_rtc_proc(struct device *dev, struct seq_file *seq)ds1685_rtc_get_ssn (rtc, ssn); ctrla = rtc->read (rtc,RTC_CTRL_A ); ctrlb = rtc->read (rtc,RTC_CTRL_B ); - ctrlc = rtc->read (rtc,RTC_CTRL_C ); ctrld = rtc->read (rtc,RTC_CTRL_D ); ctrl4a = rtc->read (rtc,RTC_EXT_CTRL_4A ); ctrl4b = rtc->read (rtc,RTC_EXT_CTRL_4B );
Alexandre Belloni
maintainerPATCH 4/8 rtc: ds1685: fix build error with make W=1
In reply to Alexandre BelloniFix the following parsing errors when building with W=1:drivers/rtc/rtc-ds1685.c:1053: error: Cannot parse struct or union!drivers/rtc/rtc-ds1685.c:1062: error: Cannot parse struct or union!drivers/rtc/rtc-ds1685.c:1363: warning: cannot understand function prototype: 'struct platform_driver ds1685_rtc_driver = '
--- drivers/rtc/rtc-ds1685.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/rtc/rtc-ds1685.c +3 -3
@@ -1039,7 +1039,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev, } static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL); -/** +/* * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features. */ static struct attribute*
@@ -1050,7 +1050,7 @@ ds1685_rtc_sysfs_misc_attrs[] = { NULL, }; -/** +/* * struct ds1685_rtc_sysfs_misc_grp - attr group for misc RTC features. */ static const struct attribute_group
@@ -1355,7 +1355,7 @@ ds1685_rtc_remove(struct platform_device *pdev)return 0 ; } -/** +/* * ds1685_rtc_driver - rtc driver properties. */ static struct platform_driver ds1685_rtc_driver = {
Signature · 1 line
2.23.0
Re: [PATCH 4/8] rtc: ds1685: fix build error with make W=1
Quoted 35 lines · Alexandre Belloni
Fix the following parsing errors when building with W=1:
drivers/rtc/rtc-ds1685.c:1053: error: Cannot parse struct or union!drivers/rtc/rtc-ds1685.c:1062: error: Cannot parse struct or union!drivers/rtc/rtc-ds1685.c:1363: warning: cannot understand function prototype: 'structplatform_driverds1685_rtc_driver= 'Cc Joshua Kinard <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- drivers/rtc/rtc-ds1685.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/rtc/rtc-ds1685.c +2
-2@@ -1039,7 +1039,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev, } static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL); -/** +/* * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features. */ static struct attribute*@@ -1050,7 +1050,7 @@ ds1685_rtc_sysfs_misc_attrs[] = { NULL, }; -/** +/* * struct ds1685_rtc_sysfs_misc_grp - attr group for misc RTC features. */ static const struct attribute_group
drivers/rtc/rtc-ds1685.c ds1685_rtc_remove(struct platform_device *pdev) · line 1361
Quoted 8 lines
drivers/rtc/rtc-ds1685.c +1
-1@@ -1355,7 +1355,7 @@ ds1685_rtc_remove(struct platform_device *pdev)return 0 ; } -/** +/* * ds1685_rtc_driver - rtc driver properties. */ static struct platform_driver ds1685_rtc_driver = {
/** is for kerneldoc comments. Is this a bug in kbuild's W=1 implementation of not parsing kerneldoc on a struct correctly? I'm sure I got that syntax for structs out of the kerneldoc guide, unless it changed at some point.
Signature · 10 lines
Joshua Kinard Gentoo/MIPS [email protected] rsa6144/5C63F4E3F5C6C943 2015-04-27 177C 1972 1FB8 F254 BAD0 3E72 5C63 F4E3 F5C6 C943 "The past tempts us, the present confuses us, the future frightens us. And our lives slip away, moment by moment, lost in that vast, terrible in-between." --Emperor Turhan, Centauri Republic
Alexandre Belloni
maintainerRe: [PATCH 4/8] rtc: ds1685: fix build error with make W=1
Quoted 38 lines · Joshua Kinard
Quoted 37 lines · Alexandre Belloni
Fix the following parsing errors when building with W=1:
drivers/rtc/rtc-ds1685.c:1053: error: Cannot parse struct or union!drivers/rtc/rtc-ds1685.c:1062: error: Cannot parse struct or union!drivers/rtc/rtc-ds1685.c:1363: warning: cannot understand function prototype: 'structplatform_driverds1685_rtc_driver= 'Cc Joshua Kinard <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- drivers/rtc/rtc-ds1685.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/rtc/rtc-ds1685.c +2
-2@@ -1039,7 +1039,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev, } static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL); -/** +/* * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features. */ static struct attribute*@@ -1050,7 +1050,7 @@ ds1685_rtc_sysfs_misc_attrs[] = { NULL, }; -/** +/* * struct ds1685_rtc_sysfs_misc_grp - attr group for misc RTC features. */ static const struct attribute_group@@ -1355,7 +1355,7 @@ ds1685_rtc_remove(struct platform_device *pdev)return 0 ; }
Quoted 11 lines
drivers/rtc/rtc-ds1685.c ds1685_rtc_remove(struct platform_device *pdev) · line 1361
Quoted 6 lines
drivers/rtc/rtc-ds1685.c +1
-1-/** +/* * ds1685_rtc_driver - rtc driver properties. */ static struct platform_driver ds1685_rtc_driver = {/** is for kerneldoc comments. Is this a bug in kbuild's W=1 implementation of not parsing kerneldoc on a struct correctly? I'm sure I got that syntax for structs out of the kerneldoc guide, unless it changed at some point.
I would think it is gcc that is choking on that, probably because the members are not described.
Signature · 3 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Alexandre Belloni
maintainerPATCH 5/8 rtc: m41t80: remove excess kerneldoc
In reply to Alexandre BelloniFix the following warning:drivers/rtc/rtc-m41t80.c:716: warning: Excess function parameter 'inode' description in 'wdt_ioctl'
--- drivers/rtc/rtc-m41t80.c | 1 - 1 file changed, 1 deletion(-)
drivers/rtc/rtc-m41t80.c +0 -1
@@ -702,7 +702,6 @@ static ssize_t wdt_read(struct file *file, char __user *buf,/** * wdt_ioctl: -* @inode: inode of the device * @file: file handle to the device * @cmd: watchdog command * @arg: argument pointer
Signature · 1 line
2.23.0
Alexandre Belloni
maintainerPATCH 6/8 rtc: pm8xxx: update kerneldoc for struct pm8xxx_rtc
In reply to Alexandre BelloniThe change from u8 ctrl_reg to const struct pm8xxx_rtc_regs *regs; did not properly update the kerneldoc comment. Fixes:
drivers/rtc/rtc-pm8xxx.c:64: warning: Function parameter or member 'regs' not described in 'pm8xxx_rtc'
--- drivers/rtc/rtc-pm8xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pm8xxx.c +1 -1
@@ -49,7 +49,7 @@ struct pm8xxx_rtc_regs {* @regmap: regmap used to access RTC registers * @allow_set_time: indicates whether writing to the RTC is allowed * @rtc_alarm_irq: rtc alarm irq number. -* @ctrl_reg: rtc control register. +* @regs: rtc registers description. * @rtc_dev: device structure. * @ctrl_reg_lock: spinlock protecting access to ctrl_reg. */
Signature · 1 line
2.23.0
Alexandre Belloni
maintainerPATCH 7/8 rtc: tegra: remove set but unused variable
In reply to Alexandre BelloniFix the following warning:drivers/rtc/rtc-tegra.c: In function ‘tegra_rtc_read_time’:drivers/rtc/rtc-tegra.c:106:11: warning: variable ‘msec’ set but not used [-Wunused-but-set-variable]
--- drivers/rtc/rtc-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-tegra.c +2 -2
@@ -103,7 +103,7 @@ static int tegra_rtc_read_time(struct device *dev, struct rtc_time *tm) {struct tegra_rtc_info *info =dev_get_drvdata (dev);unsigned long flags; -u32 sec, msec; +u32 sec;/* * RTC hardware copies seconds to shadow seconds when a read of
@@ -111,7 +111,7 @@ static int tegra_rtc_read_time(struct device *dev, struct rtc_time *tm)*/ spin_lock_irqsave (&info->lock, flags); - msec =readl (info->base +TEGRA_RTC_REG_MILLI_SECONDS ); +readl (info->base +TEGRA_RTC_REG_MILLI_SECONDS ); sec =readl (info->base +TEGRA_RTC_REG_SHADOW_SECONDS );spin_unlock_irqrestore (&info->lock, flags);
Signature · 1 line
2.23.0
Re: [PATCH 7/8] rtc: tegra: remove set but unused variable
Quoted 10 lines · Alexandre Belloni
Fix the following warning:
drivers/rtc/rtc-tegra.c: In function ‘tegra_rtc_read_time’:drivers/rtc/rtc-tegra.c:106:11: warning: variable ‘msec’ set but not used [-Wunused-but-set-variable]Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- drivers/rtc/rtc-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Alexandre Belloni
maintainerPATCH 8/8 rtc: v3020: remove set but unused variable
In reply to Alexandre BelloniFix the following warning:drivers/rtc/rtc-v3020.c: In function ‘rtc_probe’:drivers/rtc/rtc-v3020.c:287:6: warning: variable ‘temp’ set but not used [-Wunused-but-set-variable]
--- drivers/rtc/rtc-v3020.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-v3020.c +1 -2
@@ -284,7 +284,6 @@ static int rtc_probe(struct platform_device *pdev)struct v3020 *chip;int retval = -EBUSY ;int i; -int temp; chip =devm_kzalloc (&pdev->dev,sizeof (*chip),GFP_KERNEL );if (!chip)
@@ -302,7 +301,7 @@ static int rtc_probe(struct platform_device *pdev)/* Make sure the v3020 expects a communication cycle * by reading 8 times */ for (i =0 ; i <8 ; i++) - temp = chip->ops->read_bit (chip); + chip->ops->read_bit (chip);/* Test chip by doing a write/read sequence * to the chip ram */
Signature · 1 line
2.23.0