Linux M68K Architecture development
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Finn Thain <fthain@telegraphics.com.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@ozlabs.org, linux-m68k@vger.kernel.org
Subject: Re: [PATCH 1/2] pmac-zilog: add platform driver
Date: Thu, 7 Jan 2010 22:12:12 +0100	[thread overview]
Message-ID: <10f740e81001071312p451de3c0r93d8d9d2782abde8@mail.gmail.com> (raw)
In-Reply-To: <alpine.OSX.2.00.0911171657290.371@silk.local>

On Tue, Nov 17, 2009 at 10:04, Finn Thain <fthain@telegraphics.com.au> wrote:
> Add platform driver to the pmac-zilog driver for mac 68k, putting the
> powermac-specific bits inside #ifdef CONFIG_PPC_PMAC.

> --- linux-2.6.31.orig/drivers/serial/pmac_zilog.c       2009-11-17 17:07:28.000000000 +1100
> +++ linux-2.6.31/drivers/serial/pmac_zilog.c    2009-11-17 17:07:38.000000000 +1100

> +static int pmz_attach(struct platform_device *pdev)

__devinit (or __init, see platform_driver_probe() below)

BTW, the same is true for the PowerMac version.

> +{
> +       int i;
> +
> +       for (i = 0; i < pmz_ports_count; i++)
> +               if (pmz_ports[i].node == pdev)
> +                       return 0;
> +       return -ENODEV;
> +}
> +
> +static int pmz_detach(struct platform_device *pdev)

__devexit (or __exit, see platform_driver_probe() below)

Idem ditto for PowerMac.

> +{
> +       return 0;
> +}
> +
> +#endif /* !CONFIG_PPC_PMAC */

> +static struct platform_driver pmz_driver = {
> +       .probe          = pmz_attach,
> +       .remove         = __devexit_p(pmz_detach),
> +       .driver         = {
> +               .name           = "scc",
> +               .owner          = THIS_MODULE,
> +       },
> +};
> +
> +#endif /* !CONFIG_PPC_PMAC */
> +
>  static int __init init_pmz(void)
>  {
>        int rc, i;
> @@ -1942,15 +2053,23 @@ static int __init init_pmz(void)
>        /*
>         * Then we register the macio driver itself
>         */
> +#ifdef CONFIG_PPC_PMAC
>        return macio_register_driver(&pmz_driver);
> +#else
> +       return platform_driver_register(&pmz_driver);

Since this device is not hot-pluggable, you could use
platform_driver_probe() instead (and leave pmz_driver.probe() empty).

> --- linux-2.6.31.orig/drivers/serial/pmac_zilog.h       2009-11-17 17:07:28.000000000 +1100
> +++ linux-2.6.31/drivers/serial/pmac_zilog.h    2009-11-17 17:07:38.000000000 +1100
> @@ -1,7 +1,15 @@
>  #ifndef __PMAC_ZILOG_H__
>  #define __PMAC_ZILOG_H__
>
> +#ifdef CONFIG_PPC_PMAC
>  #define pmz_debug(fmt, arg...) dev_dbg(&uap->dev->ofdev.dev, fmt, ## arg)
> +#define pmz_error(fmt, arg...) dev_err(&uap->dev->ofdev.dev, fmt, ## arg)
> +#define pmz_info(fmt, arg...)  dev_info(&uap->dev->ofdev.dev, fmt, ## arg)
> +#else
> +#define pmz_debug(fmt, arg...) do { } while (0)
> +#define pmz_error(fmt, arg...) printk(KERN_ERR fmt, ## arg)
> +#define pmz_info(fmt, arg...)  printk(KERN_INFO fmt, ## arg)

Any chance you can sneak the platform device in and use dev_*()?

Anyway, I'm gonna take it, and feed it upstream if BenH adds his ack. Ben?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

  parent reply	other threads:[~2010-01-07 21:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17  9:04 [PATCH 1/2] pmac-zilog: add platform driver Finn Thain
2009-12-23 20:16 ` Geert Uytterhoeven
2010-01-02 12:43 ` Geert Uytterhoeven
2010-01-02 16:39   ` Finn Thain
2010-01-07 21:05     ` Geert Uytterhoeven
2010-01-08 19:17     ` Geert Uytterhoeven
2010-01-09  3:14       ` fthain
2010-01-07 21:12 ` Geert Uytterhoeven [this message]
2010-01-10 12:48   ` [PATCH 1/2] pmac-zilog: add platform driver, version 2 fthain
2010-01-10 16:29     ` [PATCH 1/2] pmac-zilog: add platform driver, version 3 Finn Thain
2010-01-14 13:38       ` Geert Uytterhoeven
2010-01-31  7:25         ` ping, was " fthain
2010-01-31  9:03           ` Geert Uytterhoeven

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=10f740e81001071312p451de3c0r93d8d9d2782abde8@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=benh@kernel.crashing.org \
    --cc=fthain@telegraphics.com.au \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    /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