summaryrefslogtreecommitdiffstats
path: root/drivers (follow)
Commit message (Collapse)AuthorAgeFilesLines
* rtc: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-0248-53/+48
| | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stop validating rtc_time after rtc_time_to_tmAlexandre Belloni2018-03-0113-13/+13
| | | | | | | rtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stop validating rtc_time after rtc_time64_to_tmAlexandre Belloni2018-03-013-3/+3
| | | | | | | rtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stk17ta8: let the core handle invalid timeAlexandre Belloni2018-03-011-4/+0
| | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rs5c348: let the core handle invalid timeAlexandre Belloni2018-03-011-5/+0
| | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: cmos: let the core handle invalid timeAlexandre Belloni2018-03-011-12/+0
| | | | | | | Setting the rtc to a valid time when the time is invalid is a bad practice, because then userspace doesn't know it shouldn't trust the RTC. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1553: let the core handle invalid timeAlexandre Belloni2018-03-011-4/+0
| | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1511: let the core handle invalid timeAlexandre Belloni2018-03-011-4/+0
| | | | | | | | Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tx4939: avoid unintended sign extension on a 24 bit shiftColin Ian King2018-03-011-2/+4
| | | | | | | | | | | | | | The shifting of buf[5] by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an unsigned long. If the top bit of buf[5] is set then all then all the upper bits sec end up as also being set because of the sign-extension. Fix this by casting buf[5] to an unsigned long before the shift. Detected by CoverityScan, CID#1465292 ("Unintended sign extension") Fixes: 0e1492330cd2 ("rtc: add rtc-tx4939 driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* char: rtc: remove unused rtc_control() APIAlexandre Belloni2018-03-011-83/+0
| | | | | | | | | | Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the rtc_register/rtc_control/rtc_unregister API is unused. As it is highly unlikely to be needed again, remove it. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: mxc_v2: Fix _iomem pointer notationFabio Estevam2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | Fix the iomem pointer notation in order to fix the following sparse warnings: drivers/rtc/rtc-mxc_v2.c:280:18: warning: incorrect type in argument 1 (different address spaces) drivers/rtc/rtc-mxc_v2.c:280:18: expected void const volatile [noderef] <asn:2>*addr drivers/rtc/rtc-mxc_v2.c:280:18: got void *[noderef] <asn:2>ioaddr drivers/rtc/rtc-mxc_v2.c:329:44: warning: incorrect type in argument 1 (different address spaces) drivers/rtc/rtc-mxc_v2.c:329:44: expected void *[noderef] <asn:2>ioaddr drivers/rtc/rtc-mxc_v2.c:329:44: got void [noderef] <asn:2>* drivers/rtc/rtc-mxc_v2.c:339:44: warning: incorrect type in argument 1 (different address spaces) drivers/rtc/rtc-mxc_v2.c:339:44: expected void *[noderef] <asn:2>ioaddr drivers/rtc/rtc-mxc_v2.c:339:44: got void [noderef] <asn:2>* Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: isl1208: Fix unintended clear of SR bitsDenis Osterland2018-03-011-0/+5
| | | | | | | | | | | | | | | | | | After successful sr = isl1208_i2c_set_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN); sr will be 0. As a result sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr & ~ISL1208_REG_SR_WRTC); is equal to sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, 0); which clears all flags in SR. Add an additional read of SR, to have value of SR in sr again. Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tx4939: use generic nvmemAlexandre Belloni2018-03-011-33/+26
| | | | | | | Instead of adding a binary sysfs attribute from the driver, use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tx4939: fix possible race conditionAlexandre Belloni2018-03-011-2/+3
| | | | | | | The probe function is not allowed to fail after registering the RTC. Call rtc_register_device() at the end. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tx4939: switch to rtc_register_deviceAlexandre Belloni2018-03-011-2/+8
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tx4939: extend test coverageAlexandre Belloni2018-03-011-1/+1
| | | | | | | The rtc-tx4939 driver now compiles correctly on other architectures, add COMPILE_TEST to improve code coverage. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tx4939: remove arch/mips dependencyAlexandre Belloni2018-03-011-1/+24
| | | | | | | Copy RTC definitions from arch/mips/include/asm/txx9/tx4939.h to the RTC driver so it doesn't depend on arch/mips anymore. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stk17ta8: use generic nvmemAlexandre Belloni2018-03-011-40/+24
| | | | | | | Instead of adding a binary sysfs attribute from the driver, use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stk17ta8: fix possible race conditionAlexandre Belloni2018-03-011-2/+2
| | | | | | | The probe function is not allowed to fail after registering the RTC. Call rtc_register_device() at the end. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stk17ta8: switch to rtc_register_deviceAlexandre Belloni2018-03-011-2/+7
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: stk17ta8: make alarms usefulAlexandre Belloni2018-03-011-4/+1
| | | | | | | | Currently, the IRQs are disabled when the rtc driver is removed (e.g. when shutting down the platform). This means that the RTC will be unable to wakeup the platform. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rp5c01: use generic nvmemAlexandre Belloni2018-03-011-41/+24
| | | | | | | Instead of adding a binary sysfs attribute from the driver, use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rp5c01: fix possible race conditionAlexandre Belloni2018-03-011-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The probe function is not allowed to fail after registering the RTC because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc as late as possible. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1742: use generic nvmemAlexandre Belloni2018-03-011-41/+26
| | | | | | | | Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1742: switch to rtc_register_deviceAlexandre Belloni2018-03-011-2/+8
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: cmos: use generic nvmemAlexandre Belloni2018-03-011-43/+30
| | | | | | | | Instead of adding a binary sysfs attribute from the driver, use the core to register an nvmem device. This allows to use the in-kernel interface to access the nvram. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: cmos: fix possible race conditionAlexandre Belloni2018-03-011-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The probe function is not allowed to fail after registering the RTC because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc as late as possible. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1553: make alarms usefulAlexandre Belloni2018-03-011-10/+0
| | | | | | | | Currently, the IRQs are disabled when the rtc driver is removed (e.g. when shutting down the platform). This means that the RTC will be unable to wakeup the platform. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1553: use generic nvmemAlexandre Belloni2018-03-011-31/+24
| | | | | | | | Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1553: switch to rtc_register_deviceAlexandre Belloni2018-03-011-2/+7
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: sirfsoc: remove useless sirfsoc_rtc_ioctlAlexandre Belloni2018-03-011-18/+0
| | | | | | sirfsoc_rtc_ioctl() doesn't implement any actual ioctl, remove it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: m48t59: use generic nvmemAlexandre Belloni2018-03-011-32/+24
| | | | | | | | Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: m48t59: switch to rtc_register_deviceAlexandre Belloni2018-03-011-2/+7
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1343: use generic nvmemAlexandre Belloni2018-03-011-46/+20
| | | | | | | | Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1343: remove undocumented and useless sysfs filesAlexandre Belloni2018-03-011-95/+1
| | | | | | | A documented ABI already exists to get information about the alarm. It is the only one that is used. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1343: switch to rtc_register_deviceAlexandre Belloni2018-03-011-5/+8
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1343: simplify regmap initializationAlexandre Belloni2018-03-011-6/+2
| | | | | | Avoid using memset as gcc can properly initialize structures. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: remove nvmem_configAlexandre Belloni2018-03-011-2/+0
| | | | | | | | | | Because nvmem_config is only used and copied at nvmem registration, remove it from struct rtc_device. All the rtc drivers using nvmem are now calling rtc_nvmem_register directly. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv8803: fix possible race conditionAlexandre Belloni2018-03-011-8/+8
| | | | | | | The probe function is not allowed to fail after registering the RTC. Call rtc_register_device() at the end. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv8803: put struct nvmem_config on the stackAlexandre Belloni2018-03-011-10/+10
| | | | | | Avoid allocating memory for struct nvmem_config. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv8803: call rtc_nvmem_register()Alexandre Belloni2018-03-011-1/+2
| | | | | | | Call rtc_nvmem_register instead of letting the core do it and stop using the nvmem_config member of struct rtc_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: pcf85363: put struct nvmem_config on the stackAlexandre Belloni2018-03-011-9/+10
| | | | | | Avoid allocating memory for struct nvmem_config. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: pcf85363: call rtc_nvmem_register()Alexandre Belloni2018-03-011-2/+6
| | | | | | | Call rtc_nvmem_register instead of letting the core do it and stop using the nvmem_config member of struct rtc_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: omap: call rtc_nvmem_register()Alexandre Belloni2018-03-011-1/+2
| | | | | | | Call rtc_nvmem_register instead of letting the core do it and stop using the nvmem_config member of struct rtc_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: m48t86: put m48t86_nvmem_cfg on the stackAlexandre Belloni2018-03-011-11/+9
| | | | | | | | | | | | Move m48t86_nvmem_cfg to the stack of m48t86_rtc_probe. This results in a very small code size reduction and make it safer on systems with two similar RTCs: text data bss dec hex filename 1733 164 0 1897 769 drivers/rtc/rtc-m48t86.o.before 1793 100 0 1893 765 drivers/rtc/rtc-m48t86.o.after Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: m48t86: call rtc_nvmem_register()Alexandre Belloni2018-03-011-1/+2
| | | | | | | Call rtc_nvmem_register instead of letting the core do it and stop using the nvmem_config member of struct rtc_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1511: put ds1511_nvmem_cfg on the stackAlexandre Belloni2018-03-011-10/+9
| | | | | | | | | | | | Move ds1511_nvmem_cfg to the stack of ds1511_rtc_probe. This results in a very small code size reduction and make it safer on systems with two similar RTCs: text data bss dec hex filename 2128 164 4 2296 8f8 drivers/rtc/rtc-ds1511.o.before 2175 100 4 2279 8e7 drivers/rtc/rtc-ds1511.o.after Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1511: call rtc_nvmem_register()Alexandre Belloni2018-03-011-1/+2
| | | | | | | Call rtc_nvmem_register instead of letting the core do it and stop using the nvmem_config member of struct rtc_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1307: put struct nvmem_config on the stackAlexandre Belloni2018-03-011-9/+10
| | | | | | | Avoid allocating memory for struct nvmem_config as it is only necessary at the nvmem registration. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: ds1307: call rtc_nvmem_register()Alexandre Belloni2018-03-011-6/+6
| | | | | | | Call rtc_nvmem_register instead of letting the core do it and stop using the nvmem_config member of struct rtc_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>