History log of /drivers/char/rtc.c
Revision Date Author Comments
d88ed628f83449bd6c1e9f37bfde08088823bde3 13-Oct-2013 Michael Opdenacker <michael.opdenacker@free-electrons.com> various char drivers: remove deprecated IRQF_DISABLED

This patch proposes to remove the use of the IRQF_DISABLED flag

It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a151427ed086952cc28f1d5f1cda84c33e48e358 14-Jun-2013 Joe Perches <joe@perches.com> char: Convert use of typedef ctl_table to struct ctl_table

This typedef is unnecessary and should just be removed.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f8885c26d59e683185002271108e8acb812fcd07 12-Sep-2012 Peter Senna Tschudin <peter.senna@gmail.com> drivers/char: removes unnecessary semicolon

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9ffc93f203c18a70623f21950f1dd473c9ec48cd 28-Mar-2012 David Howells <dhowells@redhat.com> Remove all #inclusions of asm/system.h

Remove all #inclusions of asm/system.h preparatory to splitting and killing
it. Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>
5196d20305d5e30d871111d3a876cf067dd94255 24-Jan-2012 Michael Witten <mfwitten@gmail.com> drivers/char: comment fix: CMOS RTC update code is now in kernel/time/ntp.c

This commit updates some comments to reflect the fact that code
for periodically updating the CMOS RTC was moved to:

kernel/time/ntp.c

probably by this commit:

commit 82644459c592a28a3eab682f9b88d81019ddfe8b
Author: Thomas Gleixner <tglx@linutronix.de>
Date: Sat Jul 21 04:37:37 2007 -0700

NTP: move the cmos update code into ntp.c

i386 and sparc64 have the identical code to update the cmos clock. Move it
into kernel/time/ntp.c as there are other architectures coming along with the
same requirements.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
a28ee477e5e5e183fa0289841fd90f350a6e0415 04-Jun-2011 Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de> drivers/char/rtc: use printk_ratelimited instead of printk_ratelimit

Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.

Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2dc11581376829303b98eadb2de253bee065a56a 06-Aug-2010 Grant Likely <grant.likely@secretlab.ca> of/device: Replace struct of_device with struct platform_device

of_device is just an alias for platform_device, so remove it entirely. Also
replace to_of_device() with to_platform_device() and update comment blocks.

This patch was initially generated from the following semantic patch, and then
edited by hand to pick up the bits that coccinelle didn't catch.

@@
@@
-struct of_device
+struct platform_device

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: David S. Miller <davem@davemloft.net>
6d4561110a3e9fa742aeec6717248a491dfb1878 16-Nov-2009 Eric W. Biederman <ebiederm@xmission.com> sysctl: Drop & in front of every proc_handler.

For consistency drop & in front of every proc_handler. Explicity
taking the address is unnecessary and it prevents optimizations
like stubbing the proc_handlers to NULL.

Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
894d2491153a9f8270dbed21175d06fde4eba6c7 05-Nov-2009 Eric W. Biederman <ebiederm@xmission.com> sysctl drivers: Remove dead binary sysctl support

Now that sys_sysctl is a wrapper around /proc/sys all of
the binary sysctl support elsewhere in the tree is
dead code.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Corey Minyard <minyard@acm.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Neil Brown <neilb@suse.de>
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
Acked-by: Clemens Ladisch <clemens@ladisch.de> for drivers/char/hpet.c
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
86ae13b006e48959981248493efd3ff4b2828b3d 12-Oct-2009 Ingo Molnar <mingo@elte.hu> headers: Fix build after <linux/sched.h> removal

Commit d43c36dc6b357fa1806800f18aa30123c747a6d1 ("headers: remove
sched.h from interrupt.h") left some build errors in some configurations
due to drivers having depended on getting header files "accidentally".

Signed-off-by: Ingo Molnar <mingo@elte.hu>
[ Combined several one-liners from Ingo into one single patch - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
048cd5888f81713af4597bde5815f32d58fdf5b0 23-Oct-2008 David John <davidjon@xenontk.org> RTC: Remove the BKL.

Remove calls to the BKL since concurrent access is protected
by the spin lock rtc_lock.

Signed-off-by: David John <davidjon@xenontk.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
233e70f4228e78eb2f80dc6650f65d3ae3dbf17c 01-Nov-2008 Al Viro <viro@ZenIV.linux.org.uk> saner FASYNC handling on file close

As it is, all instances of ->release() for files that have ->fasync()
need to remember to evict file from fasync lists; forgetting that
creates a hole and we actually have a bunch that *does* forget.

So let's keep our lives simple - let __fput() check FASYNC in
file->f_flags and call ->fasync() there if it's been set. And lose that
crap in ->release() instances - leaving it there is still valid, but we
don't have to bother anymore.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
357c6e63590895dc87cc9300f5a1c27544ea69e8 19-Oct-2008 Adrian Bunk <bunk@kernel.org> rtc: use bcd2bin/bin2bcd

Change various rtc related code 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>
0f4d3fd8ac76122675de900d67a470306647374b 16-Oct-2008 David Brownell <dbrownell@users.sourceforge.net> legacy rtc: remove needless/confusing HPET_RTC_IRQ option

HPET_RTC_IRQ is no longer needed; HPET_EMULATE_RTC suffices and is more
correct. (http://bugzilla.kernel.org/show_bug.cgi?id=11111)

Note that when using the legacy RTC driver, platforms don't really do a
dynamic switch between HPET and non-HPET modes based on whether HPET
hardware actually exists ... only rtc-cmos (using the new RTC framework)
currently switches that way.

So this reflects bitrot in that legacy code, for x86/ia64: kernels with
HPET support configured (e.g. for a clocksource) can't get IRQs from the
legacy RTC driver unless they really have HPET hardware. (The obvious
workaround is to not use the legacy RTC driver on those platforms when you
configure HPET ... unless you know the target really has a HPET.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
75081322c9d0d56f8880178f9fcc93778bcf0220 30-Aug-2008 David S. Miller <davem@davemloft.net> sparc32: Convert PC RTC probing to pure OF driver.

Signed-off-by: David S. Miller <davem@davemloft.net>
98b0da43079740ecd07197dacd9720d54bb4dce0 13-Aug-2008 Huang Weiyi <weiyi.huang@gmail.com> drivers/char/rtc.c: removed duplicated include

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9580d85f9cdb076c4bfb467bc6c0d3c5e499957a 26-Jul-2008 Adrian Bunk <bunk@kernel.org> drivers/char/rtc.c: make 2 functions static

The following functions can now become static:
- rtc_interrupt()
- rtc_get_rtc_time()

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Bernhard Walle <bwalle@suse.de>
Acked-by: Paul Gortmaker <p_gortmaker@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c68d07b2da54c941bb36c9d6d35fe8f263ee10ef 24-Jul-2008 Carlos R. Mafra <crmafra@ift.unesp.br> rtc: remove and clarify unneeded externs

When CONFIG_HPET_EMULATE_RTC is defined the external declaration of
hpet_rtc_interrupt is redundant due to the inclusion of hpet.h.

When !CONFIG_HPET_EMULATE_RTC we make it clear that hpet_rtc_interrupt is
not used by defining it to return zero.

Signed-off-by: Carlos R. Mafra <crmafra@ift.unesp.br>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
53f1b1433da7eac2607a4a0898a221a4485fd732 24-Jul-2008 Alan Cox <alan@lxorguk.ukuu.org.uk> rtc: push the BKL down into the driver ioctl method

For now just wrap the main logic, but this driver is a prime candidate for
someone wanting to eliminate the lock entirely

[lizf@cn.fujitsu.com: fix build failure]
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
61ca9daa2ca3022dc9cb22bd98e69c1b61e412ad 11-Jul-2008 Paul Gortmaker <paul.gortmaker@windriver.com> rtc: fix reported IRQ rate for when HPET is enabled

The IRQ rate reported back by the RTC is incorrect when HPET is enabled.

Newer hardware that has HPET to emulate the legacy RTC device gets this value
wrong since after it sets the rate, it returns before setting the variable
used to report the IRQ rate back to users of the device -- so the set rate and
the reported rate get out of sync.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David Brownell <david-b@pacbell.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4333deee6b7a5a82afb9e700e76cb46e68fde68d 20-May-2008 Arnd Bergmann <arnd@arndb.de> rtc: BKL pushdown

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1b50221738108c438d5f25c7a043fb89e9e27044 29-Apr-2008 Denis V. Lunev <den@openvz.org> drivers: use non-racy method for proc entries creation

Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
be setup before gluing PDE to main tree.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
dca03a51549bc645685fb8a77efa64df531666c3 28-Apr-2008 Julia Lawall <julia@diku.dk> drivers/char/rtc.c: use time_before, time_before_eq, etc

The functions time_before, time_before_eq, time_after, and time_after_eq
are more robust for comparing jiffies against other values.

A simplified version of the semantic patch making this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@ change_compare_np @
expression E;
@@

(
- jiffies <= E
+ time_before_eq(jiffies,E)
|
- jiffies >= E
+ time_after_eq(jiffies,E)
|
- jiffies < E
+ time_before(jiffies,E)
|
- jiffies > E
+ time_after(jiffies,E)
)

@ include depends on change_compare_np @
@@

#include <linux/jiffies.h>

@ no_include depends on !include && change_compare_np @
@@

#include <linux/...>
+ #include <linux/jiffies.h>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
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>
32fa458688fa2e68bc433929b2d4941eef7efe39 28-Feb-2008 David Howells <dhowells@redhat.com> Fix hpet_(un)register_irq_handler() for emulation

Fix hpet_(un)register_irq_handler() for when CONFIG_HPET_EMULATE_RTC=n. They
are provided macros that substitute value 0, but if they are called as
functions and the return value isn't checked, the following warnings appear:

drivers/char/rtc.c: In function `rtc_init':
drivers/char/rtc.c:1063: warning: statement with no effect
drivers/char/rtc.c: In function `rtc_exit':
drivers/char/rtc.c:1157: warning: statement with no effect

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f8f76481bc2803aea03ff213c7e1405b53f7e488 30-Jan-2008 Bernhard Walle <bwalle@suse.de> rtc: use the IRQ callback interface in (old) RTC driver

the previous patch in the old RTC driver. It also removes the direct
rtc_interrupt() call from arch/x86/kernel/hpetc.c so that there's finally no
(code) dependency to CONFIG_RTC in arch/x86/kernel/hpet.c.

Because of this, it's possible to compile the drivers/char/rtc.ko driver as
module and still use the HPET emulation functionality. This is also expressed
in Kconfig.

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: Andi Kleen <ak@suse.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Robert Picco <Robert.Picco@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
5fd1fe9c582e00ca0a98f852cd693dc3caf607a0 30-Jan-2008 Ingo Molnar <mingo@elte.hu> x86: clean up drivers/char/rtc.c

tons of style cleanup in drivers/char/rtc.c - no code changed:

text data bss dec hex filename
6400 384 32 6816 1aa0 rtc.o.before
6400 384 32 6816 1aa0 rtc.o.after

since we seem to have a number of open breakages in this code we might
as well start with making the code more readable and maintainable.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
9626f1f117be21b6e4b7a1cb49814fc065dd3d2d 15-Nov-2007 Bjorn Helgaas <bjorn.helgaas@hp.com> rtc: fall back to requesting only the ports we actually use

Firmware like PNPBIOS or ACPI can report the address space consumed by the
RTC. The actual space consumed may be less than the size (RTC_IO_EXTENT)
assumed by the RTC driver.

The PNP core doesn't request resources yet, but I'd like to make it do so.
If/when it does, the RTC_IO_EXTENT request may fail, which prevents the RTC
driver from loading.

Since we only use the RTC index and data registers at RTC_PORT(0) and
RTC_PORT(1), we can fall back to requesting just enough space for those.

If the PNP core requests resources, this results in typical I/O port usage
like this:

0070-0073 : 00:06 <-- PNP device 00:06 responds to 70-73
0070-0071 : rtc <-- RTC driver uses only 70-71

instead of the current:

0070-0077 : rtc <-- RTC_IO_EXTENT == 8

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4c06be10c790008aa2b2d19df2872ff39990b7bd 15-Nov-2007 Bjorn Helgaas <bjorn.helgaas@hp.com> rtc: release correct region in error path

The misc_register() error path always released an I/O port region,
even if the region was memory-mapped (only mips uses memory-mapped RTC,
as far as I can see).

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
55f93afd89fe6b9b9e12cfb2d3eb1a68e21f529e 21-Jul-2007 Chris Wright <chrisw@sous-sol.org> x86_64: Untangle asm/hpet.h from asm/timex.h

When making changes to x86_64 timers, I noticed that touching hpet.h triggered
an unreasonably large rebuild. Untangling it from timex.h quiets the extra
rebuild quite a bit.

Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cdee99d7461d928815db6219fb14d37f99241d44 19-Jul-2007 David S. Miller <davem@sunset.davemloft.net> [SPARC64]: Stop using drivers/char/rtc.c

The existing sparc64 mini_rtc driver can handle CMOS based
rtcs trivially with just a few lines of code and the simplifies
things tremendously.

Tested on SB1500.

Signed-off-by: David S. Miller <davem@davemloft.net>
b2ff457b09554813a7df9e0cd30d5a169a257419 16-Jul-2007 Ben Collins <bcollins@ubuntu.com> RTC: Ratelimit "lost interrupts" message

We gets lots of these when the kernel is running on a hypervisor. Zach says
"a guest kernel trying to get high frequency RTC will also be inaccurate, and
inevitably will have unhidable interrupt lateness."

Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cc0a8fbb7ce00f65dc337dd91389b7151f44ed30 08-May-2007 Milind Arun Choudhary <milindchoudhary@gmail.com> drivers/char: use __set_current_state()

use __set_current_state(TASK_*) instead of current->state = TASK_*,

Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0b4d414714f0d2f922d39424b0c5c82ad900a381 14-Feb-2007 Eric W. Biederman <ebiederm@xmission.com> [PATCH] sysctl: remove insert_at_head from register_sysctl

The semantic effect of insert_at_head is that it would allow new registered
sysctl entries to override existing sysctl entries of the same name. Which is
pain for caching and the proc interface never implemented.

I have done an audit and discovered that none of the current users of
register_sysctl care as (excpet for directories) they do not register
duplicate sysctl entries.

So this patch simply removes the support for overriding existing entries in
the sys_sysctl interface since no one uses it or cares and it makes future
enhancments harder.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Corey Minyard <minyard@acm.org>
Cc: Neil Brown <neilb@suse.de>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jan Kara <jack@ucw.cz>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: David Chinner <dgc@sgi.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7735362ac32062725ba08ece014d669b9bede505 14-Feb-2007 Eric W. Biederman <ebiederm@xmission.com> [PATCH] sysctl: remove sys_sysctl support from drivers/char/rtc.c

The real time clock driver was using the binary number reserved for cdroms in
the sysctl binary number interface, which is a no-no. So since the sysctl
binary interface is wrong remove it.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
40565f1962c5be9b9e285e05af01ab7771534868 12-Feb-2007 Jiri Slaby <jirislaby@gmail.com> [PATCH] Char: timers cleanup

- Use timer macros to set function and data members and to modify
expiration time.
- Use DEFINE_TIMER for global timers and do not init them at run-time in
these cases.
- del_timer_sync is common in most cases -- we want to wait for timer
function if it's still running.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Dmitry Torokhov <dtor@mail.ru> (Input bits)
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
533ffc289db9f44c0633d3a7b87243b5740b02b2 22-Dec-2006 Andrew Morton <akpm@osdl.org> [PATCH] rtc warning fix

drivers/char/rtc.c:116: warning: 'hpet_rtc_interrupt' defined but not used

Cc: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9cef779ec3643e6c846f86a32d8c44daff16a336 13-Dec-2006 Jan Beulich <jbeulich@novell.com> [PATCH] RTC driver init adjustment

- conditionalizes procfs code upon CONFIG_PROC_FS (to reduce code size when
that option is not enabled)

- make initialization no longer fail when the procfs entry can't be
allocated (namely would initialization always have failed when
CONFIG_PROC_FS was not set)

- move the formerly file-scope static variable rtc_int_handler_ptr into
the only function using it, and makes it automatic.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f3e92d355e1251fb6d1a15508f2a5448d2354727 13-Dec-2006 Jan Beulich <jbeulich@novell.com> [PATCH] rtc: fx error case

Ensure RTC driver doesn't use its timer when it doesn't get to set it up
(as it cannot currently prevent other of its functions to be called from
outside when not built as a module - probably this should also be
addressed).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
12a0a703b3f07e5b01c81fe4f5d2a221c9318f16 10-Oct-2006 Ralf Baechle <ralf@linux-mips.org> [RTC] Consistently use of tabs for formatting.
7d12e780e003f93433d49ce78cfedf4b4c52adc5 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)
358333a0cb4a6d279806e38d0368b79066dbe5e7 29-Sep-2006 Steven Rostedt <rostedt@goodmis.org> [PATCH] remove unnecessary barrier in rtc_get_rtc_time

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
0b16f21f144010aa627c58b3a33be49ebfd685dc 26-Sep-2006 Peter Zijlstra <a.p.zijlstra@chello.nl> [PATCH] rtc: lockdep fix/workaround

BUG: warning at kernel/lockdep.c:1816/trace_hardirqs_on() (Not tainted)
[<c04051ee>] show_trace_log_lvl+0x58/0x171
[<c0405802>] show_trace+0xd/0x10
[<c040591b>] dump_stack+0x19/0x1b
[<c043abee>] trace_hardirqs_on+0xa2/0x11e
[<c06143c3>] _spin_unlock_irq+0x22/0x26
[<c0541540>] rtc_get_rtc_time+0x32/0x176
[<c0419ba4>] hpet_rtc_interrupt+0x92/0x14d
[<c0450f94>] handle_IRQ_event+0x20/0x4d
[<c0451055>] __do_IRQ+0x94/0xef
[<c040678d>] do_IRQ+0x9e/0xbd
[<c0404a49>] common_interrupt+0x25/0x2c
DWARF2 unwinder stuck at common_interrupt+0x25/0x2c

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
0f74964627e0ece4ac8da0e2cd01906ec322b4fe 12-Jul-2006 Ingo Molnar <mingo@elte.hu> [PATCH] lockdep: HPET/RTC fix

Joseph Fannin reported that hpet_rtc_interrupt() enables hardirqs
in irq context:

[ 25.628000] [<c014af4e>] trace_hardirqs_on+0xce/0x200
[ 25.628000] [<c036cf21>] _spin_unlock_irq+0x31/0x70
[ 25.628000] [<c0296584>] rtc_get_rtc_time+0x44/0x1a0
[ 25.628000] [<c01198bb>] hpet_rtc_interrupt+0x21b/0x280
[ 25.628000] [<c0161141>] handle_IRQ_event+0x31/0x70
[ 25.628000] [<c0162d37>] handle_edge_irq+0xe7/0x210
[ 25.628000] [<c0106192>] do_IRQ+0x92/0x120
[ 25.628000] [<c0104121>] common_interrupt+0x25/0x2c

the call of rtc_get_rtc_time() is highly suspect. At a minimum we
need the patch below to save/restore hardirq state.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Joseph Fannin <jfannin@gmail.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
38e0e8c0550eaed1af48ec5ad9ddb8a25e8b04ae 10-Jul-2006 Maciej W. Rozycki <macro@linux-mips.org> [PATCH] char/rtc: Handle memory-mapped chips properly

Handle memory-mapped chips properly, needed for example on DECstations.
This support was in Linux 2.4 but for some reason got lost in 2.6. This
patch is taken directly from the linux-mips repository.

[akpm@osdl.org: cleanup]
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Cc: Paul Gortmaker <penguin@muskoka.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
62322d2554d2f9680c8ace7bbf1f97d8fa84ad1a 03-Jul-2006 Arjan van de Ven <arjan@infradead.org> [PATCH] make more file_operation structs static

Mark the static struct file_operations in drivers/char as const. Making
them const prevents accidental bugs, and moves them to the .rodata section
so that they no longer do any false sharing; in addition with the proper
debug option they are then protected against corruption..

[akpm@osdl.org: build fix]
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
0f2ed4c6bae23d2b7ef0ea2d272377e3de700c0c 02-Jul-2006 Thomas Gleixner <tglx@linutronix.de> [PATCH] irq-flags: drivers/char: Use the new IRQF_ constants

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6ab3d5624e172c553004ecc862bfeac16d9d68b7 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de> Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
690c8fd31f1e35985d0f35772fde514da59ec9d1 23-Jun-2006 David S. Miller <davem@sunset.davemloft.net> [SPARC64]: Use in-kernel PROM tree for EBUS and ISA.

Signed-off-by: David S. Miller <davem@davemloft.net>
c6387a48cf5958e43c201fc27a158c328927531a 20-Jun-2006 David S. Miller <davem@davemloft.net> [SPARC]: Kill __irq_itoa().

This ugly hack was long overdue to die.

It was a way to print out Sparc interrupts in a more freindly format,
since IRQ numbers were arbitrary opaque 32-bit integers which vectored
into PIL levels. These 32-bit integers were not necessarily in the
0-->NR_IRQS range, but the PILs they vectored to were.

The idea now is that we will increase NR_IRQS a little bit and use a
virtual<-->real IRQ number mapping scheme similar to PowerPC.

That makes this IRQ printing hack irrelevant, and furthermore only a
handful of drivers actually used __irq_itoa() making it even less
useful.

Signed-off-by: David S. Miller <davem@davemloft.net>
b7599587faea9403edf4d7f74e80b3c9ea217930 11-Jan-2006 Alan Cox <alan@lxorguk.ukuu.org.uk> [PATCH] Allow reading CMOS day of week register

Someone wanted access to this usually unused (and unused by Linux) value
for the day of week. Existing kernels have the field in the struct but
return 0 always. This updates the kernel to fill in the field. The usual
case of 'not set' conveniently is 0.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
c3348760aaffd268f7e91b2185999025fdc5607f 07-Nov-2005 Takashi Iwai <tiwai@suse.de> [PATCH] Fix wrong irq enable via rtc_control()

rtc_control() may be called in the interrupt context in ALSA rtc-timer
driver. The patch fixes the wrong irq enable in rtc.c, and also fixes
the possible race of bit flags.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
53d0fc27af3a3ab22c0ffb67857adfa18977e681 06-Sep-2005 David S. Miller <davem@sunset.davemloft.net> [RTC]: Use SA_SHIRQ in sparc specific code.

Based upon a report from Jason Wever.

Signed-off-by: David S. Miller <davem@davemloft.net>
403fe5ae57c831968c3dbbaba291ae825a1c5aaa 05-Aug-2005 Petr Vandrovec <vandrove@vc.cvut.cz> [PATCH] rtc: msleep() cannot be used from interrupt

Since the beginning of July my Opteron box was randomly crashing and
being rebooted by hardware watchdog. Today it finally did it in front
of me, and this patch will hopefully fix it.

The problem is that at the end of June (the 28th, to be exact: commit
47f176fdaf8924bc83fddcf9658f2fd3ef60d573, "[PATCH] Using msleep()
instead of HZ") rtc_get_rtc_time was converted to use msleep() instead
of busy waiting. But rtc_get_rtc_time is used by hpet_rtc_interrupt,
and scheduling is not allowed during interrupt. So I'm reverting this
part of original change, replacing msleep() back with busy loop.

The original code was busy waiting for up to 20ms, but on my hardware in
the worst case update-in-progress bit was asserted for at most 363
passes through loop (on 2GHz dual Opteron), much less than even one
jiffie, not even talking about 20ms. So I changed code to just wait
only as long as necessary. Otherwise when RTC was set to generate
8192Hz timer, it stopped doing anything for 20ms (160 pulses were
skipped!) from time to time, and this is rather suboptimal as far as I
can tell.

Signed-off-by: Petr Vandrovec <vandrove@vc.cvut.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
47f176fdaf8924bc83fddcf9658f2fd3ef60d573 29-Jun-2005 Luca Falavigna <dktrkranz@gmail.com> [PATCH] Using msleep() instead of HZ

Use msleep() in a few places.

Signed-off-by: Luca Falavigna <dktrkranz@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!