LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] remove __devinit markings from rtc_sysfs_add_device()
@ 2007-01-20 16:11 Mike Frysinger
  2007-01-21 10:04 ` Alessandro Zummo
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2007-01-20 16:11 UTC (permalink / raw)
  To: a.zummo; +Cc: linux-kernel, rtc-linux


[-- Attachment #1.1: Type: text/plain, Size: 856 bytes --]

the sysfs interface from the rtc framework seems to incorrectly label the add 
function with __devinit ... the proc and dev interfaces do not have this 
label on their add functions

ive been trying to develop a rtc module and it kept crashing ... after 
debugging it, i'm pretty sure ive traced it back to the devinit markings ... 
dropping this lets my module load nicely :)

the crash would happen after my rtc called rtc_device_register ... down in 
class_device_add in drivers/base/class.c, the active class interface list is 
walked and the add function is checked ... if it's non-null (aka in some 
interface would like to be notified of additions), then it's called with the 
new device information

on my board, this add pointer would seemingly point into garbage because the 
memory it refers to was freed by the kernel :(
-mike

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: linux-rtc-sysfs-no-devinit-add.patch --]
[-- Type: text/x-diff, Size: 577 bytes --]

rtc_sysfs_add_device is needed even after dev initialization, so drop __devinit.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 9418a59..2ddd0cf 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -78,7 +78,7 @@ static struct attribute_group rtc_attr_group = {
 	.attrs = rtc_attrs,
 };
 
-static int __devinit rtc_sysfs_add_device(struct class_device *class_dev,
+static int rtc_sysfs_add_device(struct class_device *class_dev,
 					struct class_interface *class_intf)
 {
 	int err;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] remove __devinit markings from rtc_sysfs_add_device()
  2007-01-20 16:11 [patch] remove __devinit markings from rtc_sysfs_add_device() Mike Frysinger
@ 2007-01-21 10:04 ` Alessandro Zummo
  0 siblings, 0 replies; 2+ messages in thread
From: Alessandro Zummo @ 2007-01-21 10:04 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kernel, rtc-linux, akpm

On Sat, 20 Jan 2007 11:11:02 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> the sysfs interface from the rtc framework seems to incorrectly label the add 
> function with __devinit ... the proc and dev interfaces do not have this 
> label on their add functions
> 
> ive been trying to develop a rtc module and it kept crashing ... after 
> debugging it, i'm pretty sure ive traced it back to the devinit markings ... 
> dropping this lets my module load nicely :)

 thanks for spotting it!

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>


-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-21 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-20 16:11 [patch] remove __devinit markings from rtc_sysfs_add_device() Mike Frysinger
2007-01-21 10:04 ` Alessandro Zummo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).