Re: [PATCH] init.h: add some more documentation to __ref* tags

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

 



Hello Michal,

On Fri, Aug 06, 2010 at 11:23:01AM +0200, Michal Nazarewicz wrote:
> The __ref* tags may have been confusing for new kernel
> developers (I was confused by them for sure) so adding a few
> more sentences to comment to clear things up for people who
> see those for the first time.
> 
> Signed-off-by: Michal Nazarewicz <m.nazarewicz@xxxxxxxxxxx>
> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx>
> ---
>  include/linux/init.h |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> > On Fri, Aug 06, 2010 at 10:45:00AM +0200, Micha?‚ Nazarewicz wrote:
> >> I just realised that I misunderstood the __ref* tags.  The __ref*
> >> means that the thing references an __init* thing, correct?
> 
> On Fri, 06 Aug 2010 10:50:03 +0200, Uwe Kleine-K철nig wrote:
> > That's what I tried to explain earlier in this thread.  And more exact
> > it means that modpost won't warn about structures/functions that are
> > marked with it.
> 
> Yep, I now understood it.  I first thought __ref* is a replacement for
> __init* and it's not so.  Thanks for clarifying that.  I would even go
> as far as proposed the following patch.
> 
> diff --git a/include/linux/init.h b/include/linux/init.h
> index de99430..3059329 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -46,16 +46,23 @@
>  #define __exitdata	__section(.exit.data)
>  #define __exit_call	__used __section(.exitcall.exit)
>  
> -/* modpost check for section mismatches during the kernel build.
> +/*
> + * modpost check for section mismatches during the kernel build.
>   * A section mismatch happens when there are references from a
>   * code or data section to an init section (both code or data).
>   * The init sections are (for most archs) discarded by the kernel
>   * when early init has completed so all such references are potential bugs.
>   * For exit sections the same issue exists.
> + *
>   * The following markers are used for the cases where the reference to
>   * the *init / *exit section (code or data) is valid and will teach
> - * modpost not to issue a warning.
> - * The markers follow same syntax rules as __init / __initdata. */
> + * modpost not to issue a warning.  Intended semantics is that a code or
> + * data tagged __ref* can reference code or data from init section without
> + * producing warning (of course, no warning does not mean code is correct,
s/producing warning/producing a warning/ ?

> + * so this need to be checked).

and maybe add something like: So optimally document why the __ref is needed
and why it's OK.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux