mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>, mingo@elte.hu
Subject: Re: [PATCH] profile: further Codying Style fixes, take 2
Date: Fri, 4 Jan 2008 21:37:45 +0100	[thread overview]
Message-ID: <20080104203745.GB32174@uranus.ravnborg.org> (raw)
In-Reply-To: <20080104185209.111adeed@paolo-desktop>

On Fri, Jan 04, 2008 at 06:52:09PM +0100, Paolo Ciarrocchi wrote:
> Further fixes to profile.c, checkpatch.pl now reports:
> 
> 	total: 0 errors, 2 warnings, 601 lines checked
> 
>   WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
>   #410: FILE: profile.c:410:
>   +EXPORT_SYMBOL_GPL(profile_hits);
> I cannot fix this without changing the funtionality in case of non-SMP build.

If you look a bit more you will see two functions named
profile_hits.
So you just add the export twice - like this:
diff --git a/kernel/profile.c b/kernel/profile.c
index 5e95330..fc4570d 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -337,6 +337,7 @@ out:
        local_irq_restore(flags);
        put_cpu();
 }
+EXPORT_SYMBOL_GPL(profile_hits);

 static int __devinit profile_cpu_callback(struct notifier_block *info,
                                        unsigned long action, void *__cpu)
@@ -408,9 +409,8 @@ void profile_hits(int type, void *__pc, unsigned int nr_hits)
        pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;
        atomic_add(nr_hits, &prof_buffer[min(pc, prof_len - 1)]);
 }
-#endif /* !CONFIG_SMP */
-
 EXPORT_SYMBOL_GPL(profile_hits);
+#endif /* !CONFIG_SMP */

 void profile_tick(int type)
 {

Which has the added benefit that it is now documented for
both implementations that they are exported.

> 
> 
>   WARNING: externs should be avoided in .c files
>   #509: FILE: profile.c:509:
>   +       extern int setup_profiling_timer(unsigned int multiplier);
> I don't know what to do with this warning.

Stick the prototype in profile.h maybe?
I can see that not all implementers of this function
includes profile.h so it is not foolproof.

	Sam

  reply	other threads:[~2008-01-04 20:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-04 17:52 Paolo Ciarrocchi
2008-01-04 20:37 ` Sam Ravnborg [this message]
2008-01-05  0:18   ` Paolo Ciarrocchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080104203745.GB32174@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paolo.ciarrocchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®