History log of /linux-master/drivers/rtc/rtc-sh.c
Revision Date Author Comments
# f4d571b3 02-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

rtc: sh: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 141626db 02-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

rtc: sh: Mark driver struct with __refdata to prevent section mismatch warning

As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# d4277fa4 11-Sep-2023 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: sh: silence warning

Silence:
drivers/rtc/rtc-sh.c:517:58: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Wformat-truncation=]

Link: https://lore.kernel.org/r/20230911095052.1292869-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <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


# 38a49742 12-Feb-2020 Geert Uytterhoeven <geert+renesas@glider.be>

rtc: sh: Restore devm_ioremap() alignment

The alignment of the continuation of the devm_ioremap() call in
sh_rtc_probe() was broken. Join the lines, as all parameters can fit on
a single line.

Fixes: 4bdc0d676a643140 ("remove ioremap_nocache and devm_ioremap_nocache")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200212084836.9511-1-geert+renesas@glider.be
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 4bdc0d67 06-Jan-2020 Christoph Hellwig <hch@lst.de>

remove ioremap_nocache and devm_ioremap_nocache

ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>


# beee05df 19-Mar-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: sh: set range

The SH RTC is a BCD RTC with some version having 4 digits for the year.

The range for the RTCs with only 2 digits for the year was unfortunately
shifted to handle 1999 to 2098.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 1097998d 19-Mar-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: sh: fix possible race condition

The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 9852023d 19-Mar-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: sh: stop resetting time to epoch

There is no point in resetting the time to epoch as this means that
userspace will never get the valuable information that time is actually
invalid.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
[Anders Roxell <anders.roxell@linaro.org>: remove unused variable r]
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 15d82d22 20-Mar-2019 Geert Uytterhoeven <geert+renesas@glider.be>

rtc: sh: Fix invalid alarm warning for non-enabled alarm

When no alarm has been programmed on RSK-RZA1, an error message is
printed during boot:

rtc rtc0: invalid alarm value: 2019-03-14T255:255:255

sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm
field that is not enabled. __rtc_read_alarm() validates the received
alarm values, and fills in missing fields when needed.
While 0xff is handled fine for the year, month, and day fields, and
corrected as considered being out-of-range, this is not the case for the
hour, minute, and second fields, where -1 is expected for missing
fields.

Fix this by returning -1 instead, as this value is handled fine for all
fields.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 4ff6f024 07-Nov-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rtc: sh: convert to SPDX identifiers

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

As original license mentioned, it is GPL-2.0 in SPDX.
Then, MODULE_LICENSE() should be "GPL v2" instead of "GPL".
See ${LINUX}/include/linux/module.h

"GPL" [GNU Public License v2 or later]
"GPL v2" [GNU Public License v2]

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 88565415 27-Jul-2018 Anders Roxell <anders.roxell@linaro.org>

rtc: sh: remove unused variable rtc_dev

When building rtc-sh, rtc_dev isn't used in function __sh_rtc_periodic.
drivers/rtc/rtc-sh.c: In function ‘__sh_rtc_periodic’:
drivers/rtc/rtc-sh.c:146:21: warning: unused variable ‘rtc_dev’ [-Wunused-variable]
struct rtc_device *rtc_dev = rtc->rtc_dev;
^~~~~~~
Remove the declaration of rtc_dev to dispose the warning.

Fixes: ec623ff014c4 ("rtc: sh: remove dead code")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# ec623ff0 25-Jul-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: sh: remove dead code

Since commit 80d4bb515b78 ("RTC: Cleanup rtc_class_ops->irq_set_state") and
commit 696160fec162 ("RTC: Cleanup rtc_class_ops->irq_set_freq()"),
sh_rtc_irq_set_state and sh_rtc_irq_set_freq are never called. Remove them
along with task handling.

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


# ac316725 19-Jun-2018 Randy Dunlap <rdunlap@infradead.org>

headers: separate linux/mod_devicetable.h from linux/platform_device.h

At over 4000 #includes, <linux/platform_device.h> is the 9th most
#included header file in the Linux kernel. It does not need
<linux/mod_devicetable.h>, so drop that header and explicitly add
<linux/mod_devicetable.h> to source files that need it.

4146 #include <linux/platform_device.h>

After this patch, there are 225 files that use <linux/mod_devicetable.h>,
for a reduction of around 3900 times that <linux/mod_devicetable.h>
does not have to be read & parsed.

225 #include <linux/mod_devicetable.h>

This patch was build-tested on 20 different arch-es.

It also makes these drivers SubmitChecklist#1 compliant.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <lkp@intel.com> # drivers/media/platform/vimc/
Reported-by: kbuild test robot <lkp@intel.com> # drivers/pinctrl/pinctrl-u300.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 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>


# 22652ba7 19-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: stop validating rtc_time in .read_time

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>


# 5d05e815 19-Apr-2017 Arnd Bergmann <arnd@arndb.de>

rtc: sh: mark PM functions as unused

The sh_rtc_set_irq_wake() function is only called from the suspend/resume handlers
that may be hidden, causing a harmless warning:

drivers/rtc/rtc-sh.c:724:13: error: 'sh_rtc_set_irq_wake' defined but not used [-Werror=unused-function]
static void sh_rtc_set_irq_wake(struct device *dev, int enabled)

The most reliable way to avoid the warning is to remove the existing #ifdef
and mark the two functions as __maybe_unused so the compiler can silently
drop all three when there is no reference.

Fixes: dab5aec64bf5 ("rtc: sh: add support for rza series")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# dab5aec6 29-Mar-2017 Chris Brandt <chris.brandt@renesas.com>

rtc: sh: add support for rza series

This same RTC is used in RZ/A series MPUs, therefore with some slight
changes, this driver can be reused. Additionally, since ARM architectures
require Device Tree configurations, device tree support has been added.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 8bc57e7f 05-Jan-2017 Bhumika Goyal <bhumirks@gmail.com>

rtc: constify rtc_class_ops structures

Declare rtc_class_ops structures as const as they are only passed
as an argument to the function devm_rtc_device_register. This argument
is of type const struct rtc_class_ops *, so rtc_class_ops structures
having this property can be declared const.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct rtc_class_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
devm_rtc_device_register(...,&i@p,...)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct rtc_class_ops i;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 8441189e 28-Jun-2016 Uwe Kleine-König <uwe@kleine-koenig.org>

rtc: sh: don't validate alarm time provided to .set_alarm

The rtc core doesn't give broken dates to a driver's .set_alarm
callback, so there should be no need for validation.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 726a54cd 28-Jun-2016 Uwe Kleine-König <uwe@kleine-koenig.org>

rtc: sh: drop bogus assignment of tm_year in .read_alarm

This rtc doesn't support triggering on years, so don't assign tm_year
instead of claiming the alarm is to trigger in year 67435.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# fa569113 31-Mar-2016 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: remove useless DRV_VERSION

Many drivers are defining a DRV_VERSION. This is often only used for
MODULE_VERSION and sometimes to print an info message at probe time. This
is kind of pointless as they are all versionned with the kernel anyway.
Also the core will print a message when a new rtc is found.

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


# 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>


# e58c18d4 12-Nov-2013 Jingoo Han <jg1.han@samsung.com>

drivers/rtc/rtc-sh.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change to make
the code simpler and enhance the readability.

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>


# 0209affa 03-Jul-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-sh: use devm_*() functions

Use devm_*() functions to make 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>


# f50c8bf7 03-Jul-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-sh: remove unnecessary platform_set_drvdata()

The driver core clears the driver data to NULL after device_release or
on probe failure, since commit 0998d063100 ("device-core: Ensure drvdata
= NULL when no driver is bound"). Thus, it is not needed to manually
clear the device driver data to NULL.

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>


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

rtc: rtc-sh: switch to using SIMPLE_DEV_PM_OPS

Switch to using the SIMPLE_DEV_PM_OPS macro to declare the driver's
pm_ops. It reduces code size. Also, CONFIG_PM_SLEEP is added to prevent
build warning when CONFIG_PM_SLEEP is not selected.

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>


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

rtc: rtc-sh: use module_platform_driver_probe()

Use module_platform_driver_probe() macro which makes the code smaller and
simpler.

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


# 2f6e5f94 23-Mar-2012 Yong Zhang <yong.zhang0@gmail.com>

drivers/rtc: remove IRQF_DISABLED

Since commit e58aa3d2d0cc ("genirq: run irq handlers with interrupts
disabled") we run all interrupt handlers with interrupts disabled and we
even check and yell when an interrupt handler returns with interrupts
enabled - see commit b738a50a2026 ("genirq: warn when handler enables
interrupts").

So now this flag is a NOOP and can be removed.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Wan ZongShun <mcuos.com@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# dced35ae 28-Mar-2011 Thomas Gleixner <tglx@linutronix.de>

drivers: Final irq namespace conversion

Scripted with coccinelle.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


# e428c6a2 04-Feb-2011 John Stultz <john.stultz@linaro.org>

RTC: Clean out UIE icotl implementations

With the generic RTC rework, the UIE mode irqs are handled
in the generic layer, and only hardware specific ioctls
get passed down to the rtc driver layer.

So this patch removes the UIE mode ioctl handling in the rtc
driver layer, which never get used.

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: John Stultz <john.stultz@linaro.org>


# 696160fe 03-Feb-2011 John Stultz <john.stultz@linaro.org>

RTC: Cleanup rtc_class_ops->irq_set_freq()

With the generic rtc code now emulating PIE mode irqs via an
hrtimer, no one calls the rtc_class_ops->irq_set_freq call.

This patch removes the hook and deletes the driver functions
if no one else calls them.

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: John Stultz <john.stultz@linaro.org>


# 80d4bb51 03-Feb-2011 John Stultz <john.stultz@linaro.org>

RTC: Cleanup rtc_class_ops->irq_set_state

With PIE mode interrupts now emulated in generic code via an hrtimer,
no one calls rtc_class_ops->irq_set_state(), so this patch removes it
along with driver implementations.

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: 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>


# 899be96d 07-Nov-2010 Axel Lin <axel.lin@gmail.com>

rtc: rtc-sh - fix a memory leak

request_mem_region() will call kzalloc to allocate memory for struct resource.
release_resource() unregisters the resource but does not free the allocated
memory, thus use release_mem_region() instead to fix the memory leak.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 47145210 14-Dec-2009 Alexey Dobriyan <adobriyan@gmail.com>

const: constify remaining dev_pm_ops

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 1043bf5c 08-Sep-2009 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Fix up oops in early periodic freq assignment.

With the reordered init order, the rtc device is not registered until
later, while sh_rtc_irq_set_freq() was attempting to assign ->irq_freq
directly, resulting in an oops. This is handled by the upper layers for
us, so just kill off the problematic dereference completely.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 5c9740a8 19-Aug-2009 Alessandro Zummo <a.zummo@towertech.it>

rtc: rtc-sh fixes

- simplifies irq set freq
- ioctl() was duplicating functionalities of rtc-dev core
- corrected initialization sequence
- use platform_driver_probe

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Angelo Castello <angelo.castello@st.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Jamie Lenehan <lenehan@twibble.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 063adc75 15-Apr-2009 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: clock framework support.

This adds clock framework support to the rtc-sh driver. With this in
place, platforms can default to leaving the clock disabled rather than
placing it in the always enabled state.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# faa9fa8e 01-Apr-2009 Magnus Damm <damm@igel.co.jp>

rtc: rtc-sh: use set_irq_wake()

Modify the sh_rtc driver to use set_irq_wake() during suspend
and resume. These functions are used to enable the rtc interrupts
in the interrupt controller so the rtc can be used to wakeup the
system from suspend.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 7a8fe8e3 19-Mar-2009 Magnus Damm <damm@igel.co.jp>

sh: sh-rtc wakeup support

Flag that the SuperH RTC supports wakeup.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# edf22477 19-Mar-2009 Magnus Damm <damm@igel.co.jp>

sh: sh-rtc invalid time rework

This patch modifies invalid time handling in the
SuperH RTC driver. Instead of zeroing the returned
value at read-out time we just return an error code
and reset invalid values during probe.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 9cd88b90 19-Mar-2009 Magnus Damm <damm@igel.co.jp>

sh: sh-rtc carry interrupt rework

This patch modifies the SuperH RTC driver to only
enable carry interrupts when needed. So by default
no interrupts are enabled with this patch. Without
this patch a suspending system will most likely
wake up by the carry interrupt regardless if the
alarm interrupt has been enabled or not.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# e26b926a 06-Mar-2009 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Bump version up to reflect single IRQ support changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 5e084a15 24-Feb-2009 Magnus Damm <damm@igel.co.jp>

rtc: sh-rtc: Add Single IRQ Support

Add support for single IRQ hardware to the sh-rtc driver.

This is useful for processors with limited interrupt masking
support such as sh7750 and sh7780. With this patch in place we
can add logic to the intc code that merges all RTC vectors into
a single linux interrupt with proper masking/unmasking support.

Specify a single IRQ in the platform data to use this new shared
IRQ feature. Separate Periodic/Carry/Alarm IRQs are still supported.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 5d2a5037 06-Jan-2009 Jonathan Cameron <jic23@cam.ac.uk>

rtc: move power of 2 periodic frequency check down into drivers

Move the power of 2 check on frequencies down into individual rtc drivers

This is to allow for non power of 2 real time clock periodic interrupts
such as those on the pxa27x to be found in the new pxa27x-rtc driver

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: 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>


# 2fac6674 06-Jan-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

rtc: bunch of drivers: fix 'no irq' case handing

This patch fixes a bunch of irq checking misuses. Most drivers were
getting irq via platform_get_irq(), which returns -ENXIO or r->start.

rtc-cmos.c is special. It is using PNP and platform bindings. Hopefully
nobody is using PNP IRQ 0 for RTC. So the changes should be safe.

rtc-sh.c is using platform_get_irq, but was storing a result into an
unsigned type, then was checking for < 0. This is fixed now.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# fe20ba70 18-Oct-2008 Adrian Bunk <bunk@kernel.org>

drivers/rtc/: use bcd2bin/bin2bcd

Change drivers/rtc/ to use the new bcd2bin/bin2bcd functions instead of
the obsolete BCD_TO_BIN/BIN_TO_BCD/BCD2BIN/BIN2BCD macros.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: 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>


# 743e6a50 15-Oct-2008 David Brownell <dbrownell@users.sourceforge.net>

rtc: file close() consistently disables repeating irqs

Make the rtc framework consistent about disabling 1/second update IRQs
that may have been activated through the /dev interface, when that /dev
file is closed. (It may have closed because of coredump, etc.) This was
previously done only for emulated update IRQs ... now, do it always.

Also comment the current policy: repeating IRQs (periodic, update) that
userspace enabled will be cleanly disabled, but alarms are left alone.
Such repeating IRQs are a constant and pointless system load.

Update some RTC drivers to remove now-needless release() methods. Most
such methods just enforce that policy. The others all seem to be buggy,
and mistreat in-kernel clients of periodic or alarm IRQs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Andrew Sharp <andy.sharp@onstor.com>
Cc: Angelo Castello <angelo.castello@st.com>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Thomas Hommel <thomas.hommel@gefanuc.com>
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>


# 2641dc92 10-Sep-2008 roel kluin <roel.kluin@gmail.com>

rtc-sh: Unsigned rtc->{periodic,carry,alarm}_irq cannot be negative

possibly since commit b420b1a7a17ea88531d0e12b2f2679a0c8365803

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 0305794c 25-Apr-2008 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Fixup for 64-bit resources.

ioremap() and friends get the size information right, so force everything
to go through there.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 2a4e2b87 28-Apr-2008 Harvey Harrison <harvey.harrison@gmail.com>

rtc: replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
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>


# b420b1a7 05-Mar-2008 Angelo Castello <angelo.castello@st.com>

rtc: rtc-sh: Add support for periodic IRQs.

This adds support for periodic IRQs to the rtc-sh driver.
RTC_IRQP_READ/RTC_IRQP_SET are added, with a number of other fixes and
reordering across the rest of the code.

Signed-off-by: Angelo Castello <angelo.castello@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# ad28a07b 10-Apr-2008 Kay Sievers <kay.sievers@vrfy.org>

rtc: fix platform driver hotplug/coldplug

Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is
prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable RTC
platform drivers, to re-enable module auto loading.

[dbrownell@users.sourceforge.net: more drivers, minor fix]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
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>


# c019fd88 28-Nov-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Split out the CPU defs to asm/cpu/.

With all of the different CPU types this was getting a but unwieldly.
Since sh64 is now integrated, we don't have to worry about multiple
architectures caring about the header definitions.

Split out the defs for each asm/cpu/ to make rtc-sh slightly less
visually offensive.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# ff1b7506 26-Nov-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: SH-2A support.

Trivial support for the SH-2A on-chip RTC.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 9a519f62 07-Nov-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: SH-5 support.

Trivial support for the SH-5 (sh64) on-chip RTC.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 0ac554b9 07-Nov-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Zero out tm value for invalid rtc states.

Follows the changes of some of the other RTC drivers. If the tm
value is bogus, just zero it out. Adds some sanity for RTC_RD_TIME.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 29dd0dae 06-Nov-2007 Paul Mundt <lethal@linux-sh.org>

rtc: sh-rtc: Handle rtc_device_register() failure properly.

Currently if rtc_device_register() fails we have an IS_ERR() on
the wrong pointer, which causes this to always be skipped. Fix
this up to actually check the right pointer. The return value
was always correct, even though the check was wrong.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# ad89f87a 02-Aug-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Support 4-digit year on SH7705/SH7710/SH7712.

All SH-4 parts have a 4-digit year, while the SH-3 parts typically
only use a 2-digit one. The SH7705, SH7710, and SH7712 SH-3 parts
however opted to extend it to 4-digit and still look and act like
an SH-3 RTC in all other ways.

This adds a capability flag (RTC_CAP_4_DIGIT_YEAR) that these
corner-case CPU subtypes can set in their platform data and cleans
up some of the ifdef mess in the driver as a result.

Reported-by: Markus Brunner <super.firetwister@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 699bc661 26-Jul-2007 Markus Brunner <super.firetwister@gmail.com>

rtc: rtc-sh: Correct sh_rtc_set_time() for some SH-3 parts.

Some SH-3 parts (SH7720 and SH7705 at least) need to have the
start bit explicitly cleared, as the reset is not enough. This
is safe across all parts, so simply clear the start bit in
the sh_rtc_set_time() path.

Signed-off-by: Markus Brunner <super.firetwister@gmail.com>
Signed-off by: Mark Jonas <toertel@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# a361a68b 08-May-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Fix rtc_dev pointer for rtc_update_irq().

When the rtc_update_irq() callsites stopped passing in the
class_dev, the rtc_dev references weren't fixed. Fix it up,
so we pass in the proper pointer.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 435c55d1 07-May-2007 Paul Mundt <lethal@linux-sh.org>

rtc: rtc-sh: Fix up dev_dbg() warnings.

Signed-off-by: Paul Mundt <lethal@linux-sh.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>


# 15c945c3 22-Jan-2007 Jamie Lenehan <lenehan@twibble.org>

[PATCH] rtc-sh: act on rtc_wkalrm.enabled when setting an alarm

This fixes the SH rtc driver correctly act on the "enabled" flag when
setting an alarm.

Signed-off-by: Jamie Lenehan <lenehan@twibble.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <alessandro.zummo@towertech.it>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 0d103e90 11-Jan-2007 David Brownell <david-b@pacbell.net>

[PATCH] rtc-sh: correctly report rtc_wkalrm.enabled

This fixes the SH rtc driver to
(a) correctly report 'enabled' status with other alarm status;
(b) not duplicate that status in its procfs dump

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


# 1b73e6ae 07-Dec-2006 Jamie Lenehan <lenehan@twibble.org>

rtc: rtc-sh: alarm support.

This adds alarm support for the RTC_ALM_SET, RTC_ALM_READ,
RTC_WKALM_SET and RTC_WKALM_RD operations to rtc-sh.

The only unusual part is the handling of the alarm interrupt. If you
clear the alarm flag (AF) while the time in the RTC still matches the
time in the alarm registers than AF is immediately re-set, and if the
alarm interrupt (AIE) is still enabled then it re-triggers. I was
originally getting around 20k+ interrupts generated during the second
when the RTC and alarm registers matches.

The solution I've used is to clear AIE when the alarm goes off and
then use the carry interrupt to re-enabled it. The carry interrupt
will check AF and re-enabled AIE if it's clear. If AF is not clear
it'll clear it and then the check will be repeated next carry
interrupt. This a bit in rtc structure that indicates that it's
waiting to have AIE re-enabled so it doesn't turn it on when it
wasn't enabled anyway.

Signed-off-by: Jamie Lenehan <lenehan@twibble.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# a1614796 07-Dec-2006 Jamie Lenehan <lenehan@twibble.org>

rtc: rtc-sh: fix rtc for out-by-one for the month.

The RMONCNT register, which holds the month in the RTC, takes a value
between 1 and 12 while the tm_mon field in the time structures takes
a value between 0 and 11. This wasn't being taken into account in
rtc-sh resulting in the month being out by one.

eg, on my board during boot the RTC is set to:

RTC is set to Thu Jul 01 09:00:00 1999

but "hwclock -r" immediately after logging in was showing:

Sun Aug 1 09:01:43 1999 0.000000 seconds

Signed-off-by: Jamie Lenehan <lenehan@twibble.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 31ccb081 07-Dec-2006 Jamie Lenehan <lenehan@twibble.org>

rtc: rtc-sh: fix for period rtc interrupts.

When testing the per second interrupt support (RTC_UIE_ON/RTC_UIE_OFF)
of the new RTC system it would die in sh_rtc_interrupt due to a null
ptr dereference. The following gets it working correctly.

Signed-off-by: Jamie Lenehan <lenehan@twibble.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 35f3c518 06-Oct-2006 Paul Mundt <lethal@linux-sh.org>

sh: Updates for IRQ handler changes.

Trivial fixes for build breakage introduced by IRQ handler changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 7d12e780 05-Oct-2006 David Howells <dhowells@redhat.com>

IRQ: Maintain regs pointer globally rather than passing to IRQ handlers

Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.

(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.

(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)


# 317a6104 27-Sep-2006 Paul Mundt <lethal@linux-sh.org>

rtc: New RTC driver for SuperH On-Chip RTC.

This replaces the old SH RTC driver, and allows us to
clean quite a lot of things up on the board-specific
side.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>