<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/rtc/rtc-dev.c, branch v2.6.28</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.28</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.28'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2008-11-01T16:49:46Z</updated>
<entry>
<title>saner FASYNC handling on file close</title>
<updated>2008-11-01T16:49:46Z</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2008-10-31T23:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=233e70f4228e78eb2f80dc6650f65d3ae3dbf17c'/>
<id>urn:sha1:233e70f4228e78eb2f80dc6650f65d3ae3dbf17c</id>
<content type='text'>
As it is, all instances of -&gt;release() for files that have -&gt;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-&gt;f_flags and call -&gt;fasync() there if it's been set.  And lose that
crap in -&gt;release() instances - leaving it there is still valid, but we
don't have to bother anymore.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc: file close() consistently disables repeating irqs</title>
<updated>2008-10-16T18:21:40Z</updated>
<author>
<name>David Brownell</name>
<email>dbrownell@users.sourceforge.net</email>
</author>
<published>2008-10-16T05:03:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=743e6a504f81d1e2f086e726b69fb6631d11f820'/>
<id>urn:sha1:743e6a504f81d1e2f086e726b69fb6631d11f820</id>
<content type='text'>
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 &lt;dbrownell@users.sourceforge.net&gt;
Acked-by: Andrew Sharp &lt;andy.sharp@onstor.com&gt;
Cc: Angelo Castello &lt;angelo.castello@st.com&gt;
Acked-by: Atsushi Nemoto &lt;anemo@mba.ocn.ne.jp&gt;
Acked-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
Cc: Thomas Hommel &lt;thomas.hommel@gefanuc.com&gt;
Acked-by: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc: fix kernel panic on second use of SIGIO nofitication</title>
<updated>2008-10-04T01:22:17Z</updated>
<author>
<name>Marcin Slusarz</name>
<email>marcin.slusarz@gmail.com</email>
</author>
<published>2008-10-03T22:23:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2e4a75cdcb89ff53bb182dda3a6dcdc14befe007'/>
<id>urn:sha1:2e4a75cdcb89ff53bb182dda3a6dcdc14befe007</id>
<content type='text'>
When userspace uses SIGIO notification and forgets to disable it before
closing file descriptor, rtc-&gt;async_queue contains stale pointer to struct
file.  When user space enables again SIGIO notification in different
process, kernel dereferences this (poisoned) pointer and crashes.

So disable SIGIO notification on close.

Kernel panic:
(second run of qemu (requires echo 1024 &gt; /sys/class/rtc/rtc0/max_user_freq))

general protection fault: 0000 [1] PREEMPT
CPU 0
Modules linked in: af_packet snd_pcm_oss snd_mixer_oss snd_seq_oss snd_seq_midi_event snd_seq usbhid tuner tea5767 tda8290 tuner_xc2028 xc5000 tda9887 tuner_simple tuner_types mt20xx tea5761 tda9875 uhci_hcd ehci_hcd usbcore bttv snd_via82xx snd_ac97_codec ac97_bus snd_pcm snd_timer ir_common compat_ioctl32 snd_page_alloc videodev v4l1_compat snd_mpu401_uart snd_rawmidi v4l2_common videobuf_dma_sg videobuf_core snd_seq_device snd btcx_risc soundcore tveeprom i2c_viapro
Pid: 5781, comm: qemu-system-x86 Not tainted 2.6.27-rc6 #363
RIP: 0010:[&lt;ffffffff8024f891&gt;]  [&lt;ffffffff8024f891&gt;] __lock_acquire+0x3db/0x73f
RSP: 0000:ffffffff80674cb8  EFLAGS: 00010002
RAX: ffff8800224c62f0 RBX: 0000000000000046 RCX: 0000000000000002
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8800224c62f0
RBP: ffffffff80674d08 R08: 0000000000000002 R09: 0000000000000001
R10: ffffffff80238941 R11: 0000000000000001 R12: 0000000000000000
R13: 6b6b6b6b6b6b6b6b R14: ffff88003a450080 R15: 0000000000000000
FS:  00007f98b69516f0(0000) GS:ffffffff80623200(0000) knlGS:00000000f7cc86d0
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000a87000 CR3: 0000000022598000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process qemu-system-x86 (pid: 5781, threadinfo ffff880028812000, task ffff88003a450080)
Stack:  ffffffff80674cf8 0000000180238440 0000000200000002 0000000000000000
 ffff8800224c62f0 0000000000000046 0000000000000000 0000000000000002
 0000000000000002 0000000000000000 ffffffff80674d68 ffffffff8024fc7a
Call Trace:
 &lt;IRQ&gt;  [&lt;ffffffff8024fc7a&gt;] lock_acquire+0x85/0xa9
 [&lt;ffffffff8029cb62&gt;] ? send_sigio+0x2a/0x184
 [&lt;ffffffff80491d1f&gt;] _read_lock+0x3e/0x4a
 [&lt;ffffffff8029cb62&gt;] ? send_sigio+0x2a/0x184
 [&lt;ffffffff8029cb62&gt;] send_sigio+0x2a/0x184
 [&lt;ffffffff8024fb97&gt;] ? __lock_acquire+0x6e1/0x73f
 [&lt;ffffffff8029cd4d&gt;] ? kill_fasync+0x2c/0x4e
 [&lt;ffffffff8029cd10&gt;] __kill_fasync+0x54/0x65
 [&lt;ffffffff8029cd5b&gt;] kill_fasync+0x3a/0x4e
 [&lt;ffffffff80402896&gt;] rtc_update_irq+0x9c/0xa5
 [&lt;ffffffff80404640&gt;] cmos_interrupt+0xae/0xc0
 [&lt;ffffffff8025d1c1&gt;] handle_IRQ_event+0x25/0x5a
 [&lt;ffffffff8025e5e4&gt;] handle_edge_irq+0xdd/0x123
 [&lt;ffffffff8020da34&gt;] do_IRQ+0xe4/0x144
 [&lt;ffffffff8020bad6&gt;] ret_from_intr+0x0/0xf
 &lt;EOI&gt;  [&lt;ffffffff8026fdc2&gt;] ? __alloc_pages_internal+0xe7/0x3ad
 [&lt;ffffffff8033fe67&gt;] ? clear_page_c+0x7/0x10
 [&lt;ffffffff8026fc10&gt;] ? get_page_from_freelist+0x385/0x450
 [&lt;ffffffff8026fdc2&gt;] ? __alloc_pages_internal+0xe7/0x3ad
 [&lt;ffffffff80280aac&gt;] ? anon_vma_prepare+0x2e/0xf6
 [&lt;ffffffff80279400&gt;] ? handle_mm_fault+0x227/0x6a5
 [&lt;ffffffff80494716&gt;] ? do_page_fault+0x494/0x83f
 [&lt;ffffffff8049251d&gt;] ? error_exit+0x0/0xa9

Code: cc 41 39 45 28 74 24 e8 5e 1d 0f 00 85 c0 0f 84 6a 03 00 00 83 3d 8f a9 aa 00 00 be 47 03 00 00 0f 84 6a 02 00 00 e9 53 03 00 00 &lt;41&gt; ff 85 38 01 00 00 45 8b be 90 06 00 00 41 83 ff 2f 76 24 e8
RIP  [&lt;ffffffff8024f891&gt;] __lock_acquire+0x3db/0x73f
 RSP &lt;ffffffff80674cb8&gt;
---[ end trace 431877d860448760 ]---
Kernel panic - not syncing: Aiee, killing interrupt handler!

Signed-off-by: Marcin Slusarz &lt;marcin.slusarz@gmail.com&gt;
Acked-by: Alessandro Zummo &lt;alessandro.zummo@towertech.it&gt;
Acked-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Cc: &lt;stable@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc: fix double lock on UIE emulation</title>
<updated>2008-08-20T22:40:31Z</updated>
<author>
<name>Atsushi Nemoto</name>
<email>anemo@mba.ocn.ne.jp</email>
</author>
<published>2008-08-20T21:09:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1d96469a34781340b2cc9bdf97d5913eecdaa038'/>
<id>urn:sha1:1d96469a34781340b2cc9bdf97d5913eecdaa038</id>
<content type='text'>
With commit 5ad31a575157147b43fa84ef1e21471661653878 ("rtc: remove BKL
for ioctl()"), RTC_UIE_ON ioctl cause double lock on rtc-&gt;ops_lock.
The ops_lock must not be held while set_uie() calls rtc_read_time()
which takes the lock.  Also clear_uie() does not need ops_lock.  This
patch fixes return value of RTC_UIE_OFF ioctl too.

Signed-off-by: Atsushi Nemoto &lt;anemo@mba.ocn.ne.jp&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Cc: Russell King &lt;rmk@arm.linux.org.uk&gt;
Cc: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Cc: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>revert "rtc: cdev lock_kernel() pushdown"</title>
<updated>2008-08-12T23:07:28Z</updated>
<author>
<name>David Brownell</name>
<email>dbrownell@users.sourceforge.net</email>
</author>
<published>2008-08-12T22:08:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b1c3c898274334a9255445ba0636d13eda8399d7'/>
<id>urn:sha1:b1c3c898274334a9255445ba0636d13eda8399d7</id>
<content type='text'>
Revert commit 51a776fa7a7997e726d4a478eda0854c6f9143bd ("rtc: cdev
lock_kernel() pushdown").  The RTC framework does not need BKL
protection.

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Alessandro Zummo &lt;alessandro.zummo@towertech.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc-dev: stop periodic interrupts on device release</title>
<updated>2008-07-30T16:41:47Z</updated>
<author>
<name>Tomas Janousek</name>
<email>tomi@nomi.cz</email>
</author>
<published>2008-07-30T05:33:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5cdc98b8f51310f7cca05ad780f18f80dd9571de'/>
<id>urn:sha1:5cdc98b8f51310f7cca05ad780f18f80dd9571de</id>
<content type='text'>
Solves http://bugzilla.kernel.org/show_bug.cgi?id=11127

The old rtc.c driver did it and some drivers (like rtc-sh) do it in their
release function, though they should not -- because they should provide
the irq_set_state op and the rtc framework itself should care about it.
This patch makes it do so.

I am aware that some drivers, like rtc-sh, handle userspace PIE sets in
their ioctl op (instead of having the framework call the op), exporting
the irq_set_state op at the same time.  The logic in rtc_irq_set_state
should make sure it doesn't matter and the driver should not need to care
stopping periodic interrupts in its release routine any more.

The correct way, in my opinion, should be this:
1) The driver provides the irq_set_state op and does not care closing the
   interrupts in its release op.
2) If the driver does not provide the op and handles PIE in the ioctl op, it's
   reponsible for closing them in its release op.
3) Something similar for other IRQs, like UIE -- if there's no in-kernel API
   like irq_set_state, handle it in ioctl and release ops. The framework will
   be responsible either for everything or for nothing. (This will probably
   change later.)

Signed-off-by: Tomas Janousek &lt;tomi@nomi.cz&gt;
Acked-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Acked-by: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc: don't return -EBUSY when mutex_lock_interruptible() fails</title>
<updated>2008-07-30T16:41:45Z</updated>
<author>
<name>David Brownell</name>
<email>dbrownell@users.sourceforge.net</email>
</author>
<published>2008-07-30T05:33:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b68bb2632453a9ca7d10a00d79adf60968cb4c05'/>
<id>urn:sha1:b68bb2632453a9ca7d10a00d79adf60968cb4c05</id>
<content type='text'>
It was pointed out that the RTC framework handles its mutex locks oddly
...  returning -EBUSY when interrupted.  This fixes that by returning the
value of mutex_lock_interruptible() (i.e.  -EINTR).

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Acked-by: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc: remove BKL for ioctl()</title>
<updated>2008-07-24T17:47:33Z</updated>
<author>
<name>David Brownell</name>
<email>david-b@pacbell.net</email>
</author>
<published>2008-07-24T04:30:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5ad31a575157147b43fa84ef1e21471661653878'/>
<id>urn:sha1:5ad31a575157147b43fa84ef1e21471661653878</id>
<content type='text'>
Remove implicit use of BKL in ioctl() from the RTC framework.

Instead, the rtc-&gt;ops_lock is used.  That's the same lock that already
protects the RTC operations when they're issued through the exported
rtc_*() calls in drivers/rtc/interface.c ...  making this a bugfix, not
just a cleanup, since both ioctl calls and set_alarm() need to update IRQ
enable flags and that implies a common lock (which RTC drivers as a rule
do not provide on their own).

A new comment at the declaration of "struct rtc_class_ops" summarizes
current locking rules.  It's not clear to me that the exceptions listed
there should exist ...  if not, those are pre-existing problems which can
be fixed in a patch that doesn't relate to BKL removal.

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Cc: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Acked-by: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rtc: cdev lock_kernel() pushdown</title>
<updated>2008-06-20T20:03:43Z</updated>
<author>
<name>Jonathan Corbet</name>
<email>corbet@lwn.net</email>
</author>
<published>2008-05-15T15:38:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=51a776fa7a7997e726d4a478eda0854c6f9143bd'/>
<id>urn:sha1:51a776fa7a7997e726d4a478eda0854c6f9143bd</id>
<content type='text'>
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>rtc-cmos alarm acts as oneshot</title>
<updated>2008-02-06T18:41:13Z</updated>
<author>
<name>David Brownell</name>
<email>david-b@pacbell.net</email>
</author>
<published>2008-02-06T09:38:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8a0bdfd7a05f5bb0486fbe7146a2cf775957e95e'/>
<id>urn:sha1:8a0bdfd7a05f5bb0486fbe7146a2cf775957e95e</id>
<content type='text'>
Start making the rtc-cmos alarm act more like a oneshot alarm by disabling
that alarm after its IRQ fires.  (ACPI hooks are also needed.)

The Linux RTC framework has previously been a bit vague in this area, but
any other behavior is problematic and not very portable.  RTCs with full
YYYY-MM-DD HH:MM[:SS] alarms won't have a problem here.  Only ones with
partial match criteria, with the most visible example being the PC RTC, get
confused.  (Because the criteria will match repeatedly.)

Update comments relating to that oneshot behavior and timezone handling.
(Timezones are another issue that's mostly visible with rtc-cmos.  That's
because PCs often dual-boot MS-Windows, which likes its RTC to match local
wall-clock time instead of UTC.)

Signed-off-by: David Brownell &lt;dbrownell@users.sourceforge.net&gt;
Cc: Alessandro Zummo &lt;a.zummo@towertech.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
