* [PATCH] prio_tree.c: quiet sparse noise
@ 2010-01-14 22:16 H Hartley Sweeten
2010-01-15 0:52 ` Li Zefan
0 siblings, 1 reply; 3+ messages in thread
From: H Hartley Sweeten @ 2010-01-14 22:16 UTC (permalink / raw)
To: Linux Kernel
prio_tree.c: quiet sparse noise
The function prio_tree_init is called during start_kernel. Since it
is an __init function it is not exposed as an exported symbol.
A sparse build produces the following warning because of this:
warning: symbol 'prio_tree_init' was not declared. Should it be static?
Quiet the warning by declaring the function as an extern before
it's definition.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
diff --git a/lib/prio_tree.c b/lib/prio_tree.c
index ccfd850..a677200 100644
--- a/lib/prio_tree.c
+++ b/lib/prio_tree.c
@@ -68,6 +68,9 @@ static void get_index(const struct prio_tree_root *root,
static unsigned long index_bits_to_maxindex[BITS_PER_LONG];
+/* Keep sparse happy since this is not an EXPORT_SYMBOL */
+extern void prio_tree_init(void);
+
void __init prio_tree_init(void)
{
unsigned int i;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] prio_tree.c: quiet sparse noise
2010-01-14 22:16 [PATCH] prio_tree.c: quiet sparse noise H Hartley Sweeten
@ 2010-01-15 0:52 ` Li Zefan
2010-01-15 1:34 ` H Hartley Sweeten
0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2010-01-15 0:52 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: Linux Kernel
H Hartley Sweeten wrote:
> prio_tree.c: quiet sparse noise
>
> The function prio_tree_init is called during start_kernel. Since it
> is an __init function it is not exposed as an exported symbol.
> A sparse build produces the following warning because of this:
>
> warning: symbol 'prio_tree_init' was not declared. Should it be static?
>
> Quiet the warning by declaring the function as an extern before
> it's definition.
>
Why don't you add a declaration of prio_tree_init() to prio_tree.h,
and let kernel/main.c include it?
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>
> ---
>
> diff --git a/lib/prio_tree.c b/lib/prio_tree.c
> index ccfd850..a677200 100644
> --- a/lib/prio_tree.c
> +++ b/lib/prio_tree.c
> @@ -68,6 +68,9 @@ static void get_index(const struct prio_tree_root *root,
>
> static unsigned long index_bits_to_maxindex[BITS_PER_LONG];
>
> +/* Keep sparse happy since this is not an EXPORT_SYMBOL */
> +extern void prio_tree_init(void);
> +
> void __init prio_tree_init(void)
> {
> unsigned int i;
> --
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] prio_tree.c: quiet sparse noise
2010-01-15 0:52 ` Li Zefan
@ 2010-01-15 1:34 ` H Hartley Sweeten
0 siblings, 0 replies; 3+ messages in thread
From: H Hartley Sweeten @ 2010-01-15 1:34 UTC (permalink / raw)
To: Li Zefan; +Cc: Linux Kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2189 bytes --]
On Thursday, January 14, 2010 5:52 PM, Li Zefan wrote:
> H Hartley Sweeten wrote:
>> prio_tree.c: quiet sparse noise
>>
>> The function prio_tree_init is called during start_kernel. Since it
>> is an __init function it is not exposed as an exported symbol.
>> A sparse build produces the following warning because of this:
>>
>> warning: symbol 'prio_tree_init' was not declared. Should it be static?
>>
>> Quiet the warning by declaring the function as an extern before
>> it's definition.
>>
>
> Why don't you add a declaration of prio_tree_init() to prio_tree.h,
> and let kernel/main.c include it?
I don't think that's a good idea.
Since the function is __init it will be reaped by free_initmem in
init_post. If the function is exposed in the header someone might
try to call it after than happens. My guess is that's a bad thing...
Maybe a new <linux/init_funcs.h> could be created that has a big
fat warning about free_initmem? Then all the various init's could
be declared to remove all the sparse warnings. These are the main
ones I see in init/main.c but there are probably others:
extern void init_IRQ(void); <- arch specific
extern void fork_init(unsigned long); <- kernel/fork.c
extern void prio_tree_init(void); <- lib/prio_tree.c
extern void radix_tree_init(void); <- lib/radix-tree.c
extern void free_initmem(void); <- arch specific
extern void time_init(void); <- arch specific
extern void softirq_init(void); <- kernel/softirq.c
Regards,
Hartley
>> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>>
>> ---
>>
>> diff --git a/lib/prio_tree.c b/lib/prio_tree.c
>> index ccfd850..a677200 100644
>> --- a/lib/prio_tree.c
>> +++ b/lib/prio_tree.c
>> @@ -68,6 +68,9 @@ static void get_index(const struct prio_tree_root *root,
>>
>> static unsigned long index_bits_to_maxindex[BITS_PER_LONG];
>>
>> +/* Keep sparse happy since this is not an EXPORT_SYMBOL */
>> +extern void prio_tree_init(void);
>> +
>> void __init prio_tree_init(void)
>> {
>> unsigned int i;
>> --
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-15 1:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14 22:16 [PATCH] prio_tree.c: quiet sparse noise H Hartley Sweeten
2010-01-15 0:52 ` Li Zefan
2010-01-15 1:34 ` H Hartley Sweeten
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.