public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Paul Menzel <paulepanter@users.sourceforge.net>,
	Andy Whitcroft <apw@canonical.com>
Cc: linux-kernel@vger.kernel.org, coreboot@coreboot.org
Subject: Re: checkpatch: Question regarding asmlinkage and storage class
Date: Sun, 19 Mar 2017 01:31:01 -0700	[thread overview]
Message-ID: <1489912261.13953.22.camel@perches.com> (raw)
In-Reply-To: <1489839338.9183.68.camel@users.sourceforge.net>

On Sat, 2017-03-18 at 13:15 +0100, Paul Menzel wrote:
> Dear checkpatch developers,
> 
> 
> The coreboot project started using checkpatch.pl, and now some effort
> is going into fixing issues pointed out by `checkpatch.pl`.
> 
> The file `src/arch/x86/acpi_s3.c` in coreboot contains the code below.
> 
> ```
>    205	void (*acpi_do_wakeup)(uintptr_t vector, u32 backup_source, u32 backup_target,
>    206		u32 backup_size) asmlinkage = (void *)WAKEUP_BASE;
> ```
> 
> The warning is
> 
> > WARNING: storage class should be at the beginning of the declaration
> 
> which raised the question below [2].
> 
> > And I am waiting for someone to answer why checkpatch.pl claims
> > asmlinkage as a storage-class in the first place.
[]
> In coreboot the macro is defined similarly to Linux.
> 
> ```
> #define asmlinkage __attribute__((regparm(0)))
> #define alwaysinline inline __attribute__((always_inline))
> ```

Are they similar?

$ git grep -i "define.*ASMLINKAGE\b" include
include/linux/linkage.h:#define CPP_ASMLINKAGE extern "C"
include/linux/linkage.h:#define CPP_ASMLINKAGE
include/linux/linkage.h:#define asmlinkage CPP_ASMLINKAGE

I believe asmlinkage is defined just to avoid
possible asm/c++ symbol decorations.

> In Linux, commit 9c0ca6f9 (update checkpatch.pl to version 0.10) seems
> to have introduced the check. The commit message contains “asmlinkage
> is also a storage type”.
> 
> Furthermore, `checkpatch.pl` doesn’t seem to warn about the code below.
> 
> ```
> void __attribute__((weak)) mainboard_suspend_resume(void)
> ```
> 
> This raises the question below.
> 
> > It appears coreboot proper mostly followed this placement for
> > function attributes before. It would be nice if we were consistent,
> > specially if checkpatch starts to complaint about these.
> 
> Is there another reason, besides not having that implemented?
> 
> I am looking forward to your answers.
> 
> 
> Kind regards,
> 
> Paul
> 
> 
> [1] https://review.coreboot.org/#/c/18865/1/src/arch/x86/acpi_s3.c@205
> [2] https://review.coreboot.org/18865/
> [3] https://review.coreboot.org/#/c/18865/1/src/arch/x86/acpi_s3.c@244

  reply	other threads:[~2017-03-19  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-18 12:15 checkpatch: Question regarding asmlinkage and storage class Paul Menzel
2017-03-19  8:31 ` Joe Perches [this message]
2017-03-19  9:24   ` [coreboot] " Paul Menzel

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=1489912261.13953.22.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=coreboot@coreboot.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulepanter@users.sourceforge.net \
    /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