mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: "Miguel Botón" <mboton.lkml@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	tglx@linutronix.de
Subject: Re: [PATCH] x86: ioport_{32|64}.c unification
Date: Sun, 06 Jan 2008 00:55:53 -0500	[thread overview]
Message-ID: <26046.1199598953@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Sun, 06 Jan 2008 02:20:45 +0100." <200801060220.45669.mboton@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

On Sun, 06 Jan 2008 02:20:45 +0100, Miguel =?utf-8?q?Bot=C3=B3n?= said:
> #ifdef CONFIG_X86_32
> asmlinkage long sys_iopl(unsigned long regsp)
> {
> 	volatile struct pt_regs *regs = (struct pt_regs *)&regsp;
> 	unsigned int level = regs->bx;
> #else
> asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
> {
> #endif
> 	return do_iopl(level, (long *)&regs->flags);
> }

That looks like an unholy marriage between the preprocessor, a function
definition, and a Duff Device.  :)

Do it like this:
 #ifdef CONFIG_X86_32
 asmlinkage sys_iopl( prototype_needed)
 {
	/* the whole thing */
 }
 #else
 asmlinkage long sys_iopl(alternate_prototype)
 {
	/* the entire body */
 }
 #endif 

You'll still need some ad-croc ifdef-ery at the call site to make it use
the correct prototype (unless you can come up with some clever way of making
the two use the same prototype, possibly by passing a dummy argument on
some architectures...

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

  reply	other threads:[~2008-01-06  5:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-05 23:59 Miguel Botón
2008-01-06  0:47 ` Arnd Bergmann
2008-01-06  1:00   ` Miguel Botón
2008-01-06  1:20   ` Miguel Botón
2008-01-06  5:55     ` Valdis.Kletnieks [this message]
2008-01-06 15:30       ` Arnd Bergmann

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=26046.1199598953@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mboton.lkml@gmail.com \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.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 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®