linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/3] hd eliminate bad section references
@ 2005-04-04 18:11 maximilian attems
  2005-04-04 22:12 ` Randy.Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: maximilian attems @ 2005-04-04 18:11 UTC (permalink / raw)
  To: lkml; +Cc: Randy.Dunlap, akpm

Fix hd section references:
make parse_hd_setup() __init

Error: ./drivers/ide/legacy/hd.o .text refers to 00000943 R_386_PC32
.init.text

Signed-off-by: maximilian attems <janitor@sternwelten.at>


--- linux-2.6.12-rc1-bk5/drivers/ide/legacy/hd.c.orig	2005-04-04 18:39:04.000000000 +0200
+++ linux-2.6.12-rc1-bk5/drivers/ide/legacy/hd.c	2005-04-04 19:02:57.908576221 +0200
@@ -851,7 +851,7 @@
 	goto out;
 }
 
-static int parse_hd_setup (char *line) {
+static int __init parse_hd_setup (char *line) {
 	int ints[6];
 
 	(void) get_options(line, ARRAY_SIZE(ints), ints);

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

* Re: [patch 2/3] hd eliminate bad section references
  2005-04-04 18:11 [patch 2/3] hd eliminate bad section references maximilian attems
@ 2005-04-04 22:12 ` Randy.Dunlap
  2005-04-04 23:05   ` maximilian attems
  0 siblings, 1 reply; 4+ messages in thread
From: Randy.Dunlap @ 2005-04-04 22:12 UTC (permalink / raw)
  To: maximilian attems; +Cc: lkml, akpm, B.Zolnierkiewicz, rusty

maximilian attems wrote:
> Fix hd section references:
> make parse_hd_setup() __init
> 
> Error: ./drivers/ide/legacy/hd.o .text refers to 00000943 R_386_PC32
> .init.text
> 
> Signed-off-by: maximilian attems <janitor@sternwelten.at>
> 
> 
> --- linux-2.6.12-rc1-bk5/drivers/ide/legacy/hd.c.orig	2005-04-04 18:39:04.000000000 +0200
> +++ linux-2.6.12-rc1-bk5/drivers/ide/legacy/hd.c	2005-04-04 19:02:57.908576221 +0200
> @@ -851,7 +851,7 @@
>  	goto out;
>  }
>  
> -static int parse_hd_setup (char *line) {
> +static int __init parse_hd_setup (char *line) {
>  	int ints[6];
>  
>  	(void) get_options(line, ARRAY_SIZE(ints), ints);

This one is fairly interesting and needs some resolution by someone
who knows....

On the surface, the patch is correct.

Rusty, can you explain when __setup functions are called relative
to in-kernel init functions?  or put another way, can a __setup
function safely call in __init function?

Here's the function in question:

static int parse_hd_setup (char *line) {
	int ints[6];

	(void) get_options(line, ARRAY_SIZE(ints), ints);
	hd_setup(NULL, ints);

	return 1;
}
__setup("hd=", parse_hd_setup);



Should we make parse_hd_setup() __init,
or make hd_setup() non-__init, or something else?

{time passes, he looks]

OK, I looked at include/linux/init.h.  From what I can see
there, __setup() causes an .init.setup section to be emitted,
so marking __setup() function as __init would make sense.
I think that this patch is good.

Thanks.
-- 
~Randy

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

* Re: [patch 2/3] hd eliminate bad section references
  2005-04-04 22:12 ` Randy.Dunlap
@ 2005-04-04 23:05   ` maximilian attems
  2005-04-05  0:00     ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: maximilian attems @ 2005-04-04 23:05 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: lkml, akpm, B.Zolnierkiewicz, rusty

On Mon, 04 Apr 2005, Randy.Dunlap wrote:

> >-static int parse_hd_setup (char *line) {
> >+static int __init parse_hd_setup (char *line) {
.. 
> This one is fairly interesting and needs some resolution by someone
> who knows....

thanks a lot for your quick and profund feedback.
 
> On the surface, the patch is correct.
> 
> Rusty, can you explain when __setup functions are called relative
> to in-kernel init functions?  or put another way, can a __setup
> function safely call in __init function?
> 
> Here's the function in question:
> 
> static int parse_hd_setup (char *line) {
> 	int ints[6];
> 
> 	(void) get_options(line, ARRAY_SIZE(ints), ints);
> 	hd_setup(NULL, ints);
> 
> 	return 1;
> }
> __setup("hd=", parse_hd_setup);
> 
> 
> 
> Should we make parse_hd_setup() __init,
> or make hd_setup() non-__init, or something else?
> 
> {time passes, he looks]
> 
> OK, I looked at include/linux/init.h.  From what I can see
> there, __setup() causes an .init.setup section to be emitted,
> so marking __setup() function as __init would make sense.
> I think that this patch is good.

i saw that ide_setup() is __init as a bunch of lots others.
yes init.h confirms that. :)

--
maks
kernel janitor  	http://janitor.kernelnewbies.org/


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

* Re: [patch 2/3] hd eliminate bad section references
  2005-04-04 23:05   ` maximilian attems
@ 2005-04-05  0:00     ` Rusty Russell
  0 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2005-04-05  0:00 UTC (permalink / raw)
  To: maximilian attems
  Cc: Randy.Dunlap, lkml - Kernel Mailing List, akpm,
	Bartlomiej Zolnierkiewicz

On Tue, 2005-04-05 at 01:05 +0200, maximilian attems wrote:
> On Mon, 04 Apr 2005, Randy.Dunlap wrote:
> > Rusty, can you explain when __setup functions are called relative
> > to in-kernel init functions?  or put another way, can a __setup
> > function safely call in __init function?

Yes.  init sections are discarded just before "init" is exec'ed, ie. at
the last moment in the boot process.  __setup() functions are called at
the same time as module_param() parsing, which is all done before the
various initcall/module_init calls.

Cheers,
Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


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

end of thread, other threads:[~2005-04-05  0:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-04 18:11 [patch 2/3] hd eliminate bad section references maximilian attems
2005-04-04 22:12 ` Randy.Dunlap
2005-04-04 23:05   ` maximilian attems
2005-04-05  0:00     ` Rusty Russell

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).