All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
Date: Mon, 05 Sep 2011 18:49:21 +0200	[thread overview]
Message-ID: <4E64FD91.6000506@denx.de> (raw)
In-Reply-To: <CAOMZO5A1v5jUkXTF9nKnZh8VNewzkoMB1tMmE9cRJCJDp+y2ug@mail.gmail.com>

On 09/05/2011 05:48 PM, Fabio Estevam wrote:
> On Mon, Sep 5, 2011 at 12:40 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> ...
>

Hi Fabio,

>>> ./scripts/checkpatch.pl -F u-boot/board/karo/tx25/tx25.c
>>> ....
>>> WARNING: externs should be avoided in .c files
>>> #144: FILE: home/fabio/denx/u-boot/board/karo/tx25/tx25.c:144:
>>> +     extern void mx25_uart1_init_pins(void);
>>
>> But you're using extern in _header_ (.h) file ... so ... why ?
>>
> 
> My patch removes the extern from the C file and put it on a header
> file with other extern's.
> 
> The checkpatch warning I showed happens with the original file, and
> not after my patch is applied.
> 

I think checkpatch warnings because the original file has already some
extern. In the most of u-boot code we do not mark the prototypes with
extern.
I made this simple test - I create a new file (from sys_proto.h) and I
run checkpatch on it:

+#ifndef _SYS_PROTO_H_
+#define _SYS_PROTO_H_
+
+u32 get_cpu_rev(void);
+#define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev)
+void sdelay(unsigned long);
+void set_chipselect_size(int const);
+#endif
-- 

checpatch reports neither errors nor warnings:

checkpatch.pl --no-tree 0001-tmp.patch
total: 0 errors, 0 warnings, 31 lines checked

I think you can try moving the prototypes in sys_proto.h, and run
checkpatch on it without extern. I expect to see no warnings at all.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

      parent reply	other threads:[~2011-09-05 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02 14:02 [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Fabio Estevam
2011-09-02 14:02 ` [U-Boot] [PATCH v3 2/2] MX25: Add initial support for MX25PDK Fabio Estevam
2011-09-05 10:43 ` [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Stefano Babic
2011-09-05 11:37   ` Fabio Estevam
2011-09-05 13:05     ` Marek Vasut
2011-09-05 13:15       ` Fabio Estevam
2011-09-05 15:05         ` Marek Vasut
2011-09-05 15:38           ` Fabio Estevam
2011-09-05 15:40             ` Marek Vasut
2011-09-05 15:48               ` Fabio Estevam
2011-09-05 16:02                 ` Wolfgang Denk
2011-09-05 16:12                   ` Marek Vasut
2011-09-05 16:49                 ` Stefano Babic [this message]

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=4E64FD91.6000506@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 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.