History log of /linux-master/drivers/rtc/rtc-test.c
Revision Date Author Comments
# 1ae20eb1 21-Nov-2020 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: remove debug message

Remove leftover debug message

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201121230644.572419-1-alexandre.belloni@bootlin.com


# fdcfd854 09-Nov-2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>

rtc: rework rtc_register_device() resource management

rtc_register_device() is a managed interface but it doesn't use devres
by itself - instead it marks an rtc_device as "registered" and the devres
callback for devm_rtc_allocate_device() takes care of resource release.

This doesn't correspond with the design behind devres where managed
structures should not be aware of being managed. The correct solution
here is to register a separate devres callback for unregistering the
device.

While at it: rename rtc_register_device() to devm_rtc_register_device()
and add it to the list of managed interfaces in devres.rst. This way we
can avoid any potential confusion of driver developers who may expect
there to exist a corresponding unregister function.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl


# c19623db 15-May-2019 Roman Stratiienko <roman.stratiienko@globallogic.com>

rtc: test: enable wakeup flags

Alarmtimer interface uses only the RTC with wekeup flags enabled.
Allow to use rtc-test driver with alarmtimer interface.

Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 43dae505 07-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: use .set_time

Use .set_time instead of the deprecated .set_mmss64.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 540a11d8 20-Mar-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: do not use assignment in if condition

Fix checkpatch error:
drivers/rtc/rtc-test.c:155: ERROR: do not use assignment in if condition

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# c7080e20 18-Sep-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: Switch to SPDX identifier

Replace the license boilerplate by an SPDX identifier

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# fd13c930 18-Sep-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: make license text and module license match.

The license text is specifying GPL v2 only but the MODULE_LICENSE is set to
GPL which means GNU Public License v2 or later. When MODULE_LICENSE and
boiler plate does not match, go for boiler plate license.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 2b4f07e9 24-Jun-2018 Colin Ian King <colin.king@canonical.com>

rtc: test: make array pdev static

The array pdev is local to the source and does not need to be in
global scope, so make it static.

Cleans up sparse warning:
symbol 'pdev' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 1928906d 05-Jun-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: remove alarm support from the first device

To test for issues with RTCs that don't provide an alarm, remove alarm
support from the first test RTC device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 0b472ad2 05-Jun-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 696fa1d0 31-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: remove irq sysfs file

Now that alarms are emulated, remove the irq sysfs file that could be used
to send alarms.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 8be09029 31-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: emulate alarms using timers

Use timers to emulate alarms. Note that multiple alarms may happen if they
are set more than 15 days after the current RTC time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 4dc2403b 31-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: store time as an offset to system time

Store the time as an offset to system time. As the offset is in second, it
is currently always synced with system time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 5b257571 31-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: allow registering many devices

Use a loop to register RTC devices

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 9394270e 31-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: remove useless proc info

The rtc proc callback is useless for two reasosn:
- the test RTC is often not the first RTC so it will never be used
- all the info is available in the name file of the RTC sys folder

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 78417682 25-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: test: remove obsolete .set_mmss

There is no point in testing .set_mmss versus .set_mmss64 as there are both
taking the exact same argument (truncated for set_mmss though).

Also, this allows to constify struct rtc_ops.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 85368bb9 19-Apr-2018 Wolfram Sang <wsa+renesas@sang-engineering.com>

rtc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Michal Simek <michal.simek@xilinx.com> (for zynqmp)
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 4d644ab8 01-Apr-2015 Xunlei Pang <pang.xunlei@linaro.org>

drivers/rtc/test: Update driver to address y2038/y2106 issues

This driver has a number of y2038/y2106 issues.

This patch resolves them by:

- Replacing get_seconds() with ktime_get_real_seconds()
- Replacing rtc_time_to_tm() with rtc_time64_to_tm()

Also add test_rtc_set_mmss64() for testing rtc_class_ops's
set_mmss64(), which can be activated by "test_mmss64" module
parameter.

Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1427945681-29972-9-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# 0929ae37 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

rtc: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 4071ea25 03-Apr-2014 Alessandro Zummo <a.zummo@towertech.it>

rtc: fix potential race condition

RTC drivers must not return an error after device registration.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Reported-by: Ales Novak <alnovak@suse.cz>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# dd8d8137 29-Apr-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-test: use devm_rtc_device_register()

devm_rtc_device_register() is device managed and makes cleanup paths
simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 5a167f45 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Drivers: rtc: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 942bfb3e 17-Dec-2012 Wei Yongjun <yongjun_wei@trendmicro.com.cn>

drivers/rtc/rtc-test.c: avoid calling platform_device_put() twice

In case of error, test_init() needs to call platform_device_del() instead
of platform_device_unregister(). Otherwise, we may call
platform_device_put() twice.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

[akpm@linux-foundation.org: improve label naming]
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# a417493e 07-Feb-2011 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>

RTC: Fix the cross interrupt issue on rtc-test.

The rtc-test driver is meant to provide a test/debug code for the RTC
subsystem.

The rtc-test driver simulates specific interrupts by echoing to the
sys interface. Those were the update, alarm and periodic interrupts.

As a side effect of the new implementation, any interrupt generated in
the rtc-test driver would trigger the same code path in the generic
code, and thus the distinction among interrupts gets lost.

This patch preserves the previous behaviour of the rtc-test driver,
where e.g. an update interrupt would not trigger an alarm or periodic
interrupt, and vice-versa. In real world RTC drivers, this is not an
issue, but in the rtc-test driver it may be interesting to distinguish
these interrupts for testing purposes.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
CC: rtc-linux@googlegroups.com
Signed-off-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Signed-off-by: John Stultz <john.stultz@linaro.org>


# 16380c15 02-Feb-2011 John Stultz <john.stultz@linaro.org>

RTC: Convert rtc drivers to use the alarm_irq_enable method

Some rtc drivers use the ioctl method instead of the alarm_irq_enable
method for enabling alarm interupts. With the new virtualized RTC
rework, its important for drivers to use the alarm_irq_enable instead.

This patch converts the drivers that use the AIE ioctl method to
use the alarm_irq_enable method. Other ioctl cmds are left untouched.

I have not been able to test or even compile most of these drivers.
Any help to make sure this change is correct would be appreciated!

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Reported-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Tested-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Signed-off-by: John Stultz <john.stultz@linaro.org>


# e6229bec 18-Jun-2009 Atsushi Nemoto <anemo@mba.ocn.ne.jp>

rtc: make rtc_update_irq callable with irqs enabled

The rtc_update_irq() might be called with irqs enabled, if a interrupt
handler was registered without IRQF_DISABLED. Use
spin_lock_irqsave/spin_unlock_irqrestore instead of spin_lock/spin_unlock.

Also update kerneldoc and drivers which do extra work to follow the
current interface spec, as suggestted by David Brownell.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# bbccf83f 06-Jan-2009 Alessandro Zummo <a.zummo@towertech.it>

rtc: use set_mmss when set_time is not available

Drivers should only need to implement either set_mmss (counter based RTCs)
or set_time (most RTCs). The RTC subsystem will handle them
appropriately.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# c4646528 28-Apr-2008 Sam Ravnborg <sam@ravnborg.org>

rtc: silence section mismatch warning in rtc-test

Fix following warning:
WARNING: vmlinux.o(.data+0x253e28): Section mismatch in reference from the variable test_drv to the function .devexit.text:test_remove()

Fix by renaming the platfrom_driver variable from *_drv to *_driver
so modpost ignore the reference to an __devexit section.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# ab6a2d70 08-May-2007 David Brownell <david-b@pacbell.net>

rtc: rtc interfaces don't use class_device

This patch removes class_device from the programming interface that the RTC
framework exposes to the rest of the kernel. Now an rtc_device is passed,
which is more type-safe and streamlines all the relevant code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-By: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 91046a8a 06-Dec-2006 Jeff Garzik <jeff@garzik.org>

[PATCH] RTC: handle sysfs errors

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# d728b1e6 25-Nov-2006 David Brownell <david-b@pacbell.net>

[PATCH] rtc class locking bugfixes

I got a lockdep warning when running "rtctest" so I though it'd be good
to see what was up.

- The warning was for rtc->irq_task_lock, gotten from rtc_update_irq()
by irq handlerss ... but in a handful of other cases, grabbed without
blocking IRQs.

- Some callers to rtc_update_irq() were not ensuring IRQs were blocked,
yet the routine expects that; make sure all callers block IRQs.

It would appear that RTC API tests haven't been part of anyone's kernel
regression test suite recently, at least not with lockdep running.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# ff8371ac 01-Oct-2006 David Brownell <david-b@pacbell.net>

[PATCH] constify rtc_class_ops: update drivers

Update RTC framework so that drivers can constify their method tables, moving
them from ".data" to ".rodata". Then update the drivers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# b3969e58 20-May-2006 Alessandro Zummo <alessandro.zummo@towertech.it>

[PATCH] rtc subsystem: use ENOIOCTLCMD and ENOTTY where appropriate

Appropriately use -ENOIOCTLCMD and -ENOTTY when the ioctl is not
implemented by a driver.

(akpm: we're not allowed to return -ENOIOCTLCMD to userspace. This patch does
the right thing).

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# d1d65b77 10-Apr-2006 Alessandro Zummo <a.zummo@towertech.it>

[PATCH] RTC subsystem: compact error messages

Move registration error message from drivers to core.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# adfb4341 10-Apr-2006 Alessandro Zummo <a.zummo@towertech.it>

[PATCH] RTC subsystem: fix proc output

Move the "24hr: yes" proc output from drivers to rtc proc code. This is
required because the time value in the proc output is always in 24hr mode
regardless of the driver.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# a95579cd 27-Mar-2006 Alessandro Zummo <a.zummo@towertech.it>

[PATCH] RTC subsystem: test device/driver

Interrupts can be generated by

echo "alarm|tick|update" >/sys/class/rtc/rtcX/device/irq

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>