public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Oded Gabbay <oded.gabbay@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>
Subject: Re: Question about using #ifdef CONFIG_PPC64 in driver code
Date: Sun, 6 Oct 2019 23:48:23 -0700	[thread overview]
Message-ID: <20191007064823.GB25561@infradead.org> (raw)
In-Reply-To: <CAFCwf13AtwkWQ4Gnxi6pfKbcdEK95+X__7cFboN1FdHd1aKNQw@mail.gmail.com>

On Sun, Oct 06, 2019 at 12:33:31PM +0300, Oded Gabbay wrote:
> Hi Greg,
> a while ago we had an argument about identifying in my driver's code
> whether I'm running on x86 or powerpc. I tried to do something
> dynamically (based on parent pci bridge ID), and you and other people
> objected to it.
> 
> I see in other drivers (more then a few) that they are using #ifdef
> CONFIG_PPC64 in some places for similar things (e.g. to run code that
> is only needed in case of powerpc).

> e.g. from ocxl driver in misc:
> 
> #ifdef CONFIG_PPC64
> static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx,
> ...
> #endif
> and also:
> 
> #ifdef CONFIG_PPC64
> if (cpu_has_feature(CPU_FTR_P9_TIDR))
> arg.flags[0] |= OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT;
> #endif
> 
> Is this approach acceptable on you ?

This is a pretty horrible example and needs to be fixed up.

> Can I do something similar in my driver:
> 
> #ifdef CONFIG_PPC64
>       foo (64)
> #else
>       foo (48)
> #endif

No, you can't.

      parent reply	other threads:[~2019-10-07  6:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFCwf11-MzroWUmj4qOgwLTibqsdOmPP9cHJjXZmS0Pgr3bEOQ@mail.gmail.com>
2019-10-06  9:33 ` Question about using #ifdef CONFIG_PPC64 in driver code Oded Gabbay
2019-10-07  5:59   ` Greg Kroah-Hartman
2019-10-07  6:48   ` Christoph Hellwig [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=20191007064823.GB25561@infradead.org \
    --to=hch@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oded.gabbay@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