Re: __initdata query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 15 Mar 2008, Thomas Petazzoni wrote:

> Le Fri, 14 Mar 2008 12:30:53 -0400 (EDT),
> "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> a écrit :
>
> > yes, i think we've established what's happening.  as long as a
> > module parameter is defined with access rights of zero, it can be
> > tagged as __initdata.
>
> No, I don't think so. A module parameter can be marked __initdata if
> it's only used during initialization of the module (call to the
> function specified by module_init()).
>
> So you could imagine a module parameter with access rights != 0, but
> used outside of the initialization code. In that case, it should not
> be marked __initdata.

well, if we can sum up based on what got us here in the first place
:-), under what circumstances can module parameters be tagged as
__initdata, and as an example, let me again use drivers/scsi/gdth.c.

that driver declares the module params:

===
module_param_array(irq, int, NULL, 0);
module_param(disable, int, 0);
module_param(reserve_mode, int, 0);
module_param_array(reserve_list, int, NULL, 0);
module_param(reverse_scan, int, 0);
module_param(hdr_channel, int, 0);
module_param(max_ids, int, 0);
module_param(rescan, int, 0);
module_param(shared_access, int, 0);
module_param(probe_eisa_isa, int, 0);
module_param(force_dma32, int, 0);
===

  first, note that all of those parameters, given that they have perms
of 0, are non-displayable.  also, if you look just above that in the
source file, they seem to all be declared as "static," which means
they can't possibly be accessed from outside the source file.  and
finally, if we pick on, say, "reserve_mode" as an example, its only
references in the source file are from within routines that are
themselves tagged as __init.

  under these circumstances, is there any conceivable reason why
"reserve_mode" *shouldn't* be tagged as __initdata?  again,

  * it's non-displayable under /sys

  * it's static

  * it is used only in __init-tagged code in the file

am i missing anything else that would need to be taken into account?

rday
--


========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux