linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier.adi@gmail.com>
To: David Brownell <david-b@pacbell.net>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Paulius Zaleckas <paulius.zaleckas@teltonika.lt>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk,
	linux-embedded@vger.kernel.org,
	Laurent Pinchart <laurentp@cse-semaphore.com>
Subject: Re: [PATCH] phylib: make mdio-gpio work without OF (v2)
Date: Tue, 4 Nov 2008 19:09:05 -0500	[thread overview]
Message-ID: <8bd0f97a0811041609l3bd474afh7e526be368d4c5cf@mail.gmail.com> (raw)
In-Reply-To: <200811041604.22947.david-b@pacbell.net>

On Tue, Nov 4, 2008 at 19:04, David Brownell wrote:
> On Tuesday 04 November 2008, Grant Likely wrote:
>> At this point, instead of #ifdeffing the function signature, I would
>> much rather see this generalized as something like
>> 'mdio_gpio_setup()'.  Then move the OF and non-OF specific bits into
>> two new functions; mdio_ofgpio_probe() and mdio_gpio_probe().  The two
>> new functions should be placed with the appropriate bus binding in the
>> #ifdef/#else block at the bottom of the file.
>
> Or if possible something that creates a single #ifdef that
> ensures dead code elimination will remove the "other" branch,
> but ensures all platforms will build both versions:
>
>    #ifdef OF
>    #define using_of    true
>    #else
>    #define using_of    false
>    #endif
>
>    ...
>
>    static int __init mdio_gpio_init(void)
>    {
>        if (using_of)
>                return register mdio_ofgpio driver;
>        else
>                return register mdio_gpio driver;
>    }
>    subsys_initcall(mdio_gpio_init);
>
>    ...
>
> That's generally the preferred way to handle #ifdeffery.
> But I could imagine OF isn't (yet?) set up to handle it.

i agree completely with the inclination to do it all in C as you've
suggested and let the compiler do dead code elimination, but that only
works if the functions in question are defined everywhere (in other
words, there's a linux/ api for it).  i dont think that's the case for
OF (which is what you were implying?) ...
-mike

  reply	other threads:[~2008-11-05  0:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 14:45 [PATCH] phylib: make mdio-gpio work without OF (v2) Paulius Zaleckas
2008-11-04 15:45 ` Marc Pignat
2008-11-04 15:57   ` Grant Likely
2008-11-04 16:24 ` Grant Likely
2008-11-05  0:04   ` David Brownell
2008-11-05  0:09     ` Mike Frysinger [this message]
2008-11-05  4:45       ` David Brownell
2008-11-05  5:34         ` Mike Frysinger
2008-11-05  8:11           ` David Brownell
2008-11-05  8:32             ` Mike Frysinger
2008-11-05  8:57               ` Marc Pignat
2008-11-05 23:03                 ` David Brownell
2008-11-05  8:57               ` Paulius Zaleckas
2008-11-05  9:04                 ` Paulius Zaleckas
2008-11-05 15:04                 ` Grant Likely
2008-11-05 22:59                   ` David Brownell

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=8bd0f97a0811041609l3bd474afh7e526be368d4c5cf@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=david-b@pacbell.net \
    --cc=grant.likely@secretlab.ca \
    --cc=laurentp@cse-semaphore.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-embedded@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulius.zaleckas@teltonika.lt \
    /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;
as well as URLs for NNTP newsgroup(s).