diff mbox

rtc: rtc-puv3: Add __devinit and __devexit markers for probe and remove

Message ID 1317824987.2674.1.camel@phoenix
State Accepted
Headers show

Commit Message

Axel Lin Oct. 5, 2011, 2:29 p.m. UTC
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/rtc/rtc-puv3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Axel Lin Oct. 18, 2011, 8:44 a.m. UTC | #1
hi Guan,

> For puv3_rtc_probe, I think it should be in the white-list, but warnings
> are yielded.
> For puv3_rtc_remove, the warning could be disappeared by modifying
> __devexit to __exit, however is it proper?
>

I'm not able to reproduce it on linux-next tree (20111014).
If I Enable loadable module support, I got below build error:

  CC      arch/unicore32/kernel/ksyms.o
arch/unicore32/kernel/ksyms.c:39: error: 'csum_partial_copy_nocheck'
undeclared here (not in a function)
arch/unicore32/kernel/ksyms.c:39: warning: type defaults to 'int' in
declaration of 'csum_partial_copy_nocheck'
arch/unicore32/kernel/ksyms.c:40: error: '__csum_ipv6_magic'
undeclared here (not in a function)
arch/unicore32/kernel/ksyms.c:40: warning: type defaults to 'int' in
declaration of '__csum_ipv6_magic'
arch/unicore32/kernel/ksyms.c:44: error: '__raw_readsb' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:44: warning: type defaults to 'int' in
declaration of '__raw_readsb'
arch/unicore32/kernel/ksyms.c:47: error: '__raw_readsw' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:47: warning: type defaults to 'int' in
declaration of '__raw_readsw'
arch/unicore32/kernel/ksyms.c:50: error: '__raw_readsl' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:50: warning: type defaults to 'int' in
declaration of '__raw_readsl'
arch/unicore32/kernel/ksyms.c:53: error: '__raw_writesb' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:53: warning: type defaults to 'int' in
declaration of '__raw_writesb'
arch/unicore32/kernel/ksyms.c:56: error: '__raw_writesw' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:56: warning: type defaults to 'int' in
declaration of '__raw_writesw'
arch/unicore32/kernel/ksyms.c:59: error: '__raw_writesl' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:59: warning: type defaults to 'int' in
declaration of '__raw_writesl'
arch/unicore32/kernel/ksyms.c:80: error: '__get_user_1' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:80: warning: type defaults to 'int' in
declaration of '__get_user_1'
arch/unicore32/kernel/ksyms.c:81: error: '__get_user_2' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:81: warning: type defaults to 'int' in
declaration of '__get_user_2'
arch/unicore32/kernel/ksyms.c:82: error: '__get_user_4' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:82: warning: type defaults to 'int' in
declaration of '__get_user_4'
arch/unicore32/kernel/ksyms.c:84: error: '__put_user_1' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:84: warning: type defaults to 'int' in
declaration of '__put_user_1'
arch/unicore32/kernel/ksyms.c:85: error: '__put_user_2' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:85: warning: type defaults to 'int' in
declaration of '__put_user_2'
arch/unicore32/kernel/ksyms.c:86: error: '__put_user_4' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:86: warning: type defaults to 'int' in
declaration of '__put_user_4'
arch/unicore32/kernel/ksyms.c:87: error: '__put_user_8' undeclared
here (not in a function)
arch/unicore32/kernel/ksyms.c:87: warning: type defaults to 'int' in
declaration of '__put_user_8'
make[1]: *** [arch/unicore32/kernel/ksyms.o] Error 1
make: *** [arch/unicore32/kernel] Error 2

I also try to clone unicore tree, but I got connection timed out. :-(

axel@phoenix:~/repos/git$ git clone
git://master.kernel.org/pub/scm/linux/kernel/git/epip/linux-unicore.git
Cloning into linux-unicore...
master.kernel.org[0: 140.211.167.34]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)

Regards,
Axel
Michal Marek Oct. 21, 2011, 8:32 a.m. UTC | #2
On 18.10.2011 09:22, Guan Xuetao wrote:
> Hi Axel,
> The patch yield following warnings:
> 
> WARNING: drivers/rtc/built-in.o(.data+0x90): Section mismatch in
> reference from the variable puv3_rtcdrv to the
> function .devinit.text:puv3_rtc_probe()
> The variable puv3_rtcdrv references
> the function __devinit puv3_rtc_probe()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the
> variable:
> *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one,
> *_console
[...]
> 
> For puv3_rtc_probe, I think it should be in the white-list, but warnings
> are yielded.
> For puv3_rtc_remove, the warning could be disappeared by modifying
> __devexit to __exit, however is it proper?

The warning message tries to hint at the solution. Just name the variable

static struct platform_driver puv3_rtc_driver

and modpost will know that this is simply a list of pointers to driver
functions, in which case the section mismatch is OK (the init function
will only be called at init time).

Michal
Michal Marek Oct. 21, 2011, 8:42 a.m. UTC | #3
On 21.10.2011 10:32, Michal Marek wrote:
> The warning message tries to hint at the solution. Just name the variable
> 
> static struct platform_driver puv3_rtc_driver
>
> and modpost will know that this is simply a list of pointers to driver
> functions, in which case the section mismatch is OK (the init function
> will only be called at init time).
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Correction: it's actually a probe function with __devinit, which on most
setups (with CONFIG_HOTPLUG=y) can be called any time, but then on those
setups the __devinit does not cause the section to be freed.
Nevertheless, naming the variable puv3_rtc_driver is the correct solution.

Michal
diff mbox

Patch

diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c
index b3eba3c..e4b6880 100644
--- a/drivers/rtc/rtc-puv3.c
+++ b/drivers/rtc/rtc-puv3.c
@@ -220,7 +220,7 @@  static void puv3_rtc_enable(struct platform_device *pdev, int en)
 	}
 }
 
-static int puv3_rtc_remove(struct platform_device *dev)
+static int __devexit puv3_rtc_remove(struct platform_device *dev)
 {
 	struct rtc_device *rtc = platform_get_drvdata(dev);
 
@@ -236,7 +236,7 @@  static int puv3_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
-static int puv3_rtc_probe(struct platform_device *pdev)
+static int __devinit puv3_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
 	struct resource *res;