From: Wolfram Sang <w.sang@pengutronix.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: "Kári Davíðsson" <kari.davidsson@marel.com>,
spi-devel-general@lists.sourceforge.net, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] mpc52xx-psc-spi: refactor probe and remove to make use of of_register_spi_devices()
Date: Mon, 2 Nov 2009 14:14:27 +0100 [thread overview]
Message-ID: <20091102131427.GB4696@pengutronix.de> (raw)
In-Reply-To: <fa686aa40910311803m43504167s1ad802aecd2b4344@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3131 bytes --]
Hi Grant,
> the patch referenced above is a little ugly. Adding the call should
Agreed. I just referenced it to show there are more people wanting this
feature.
> be really simple. I've drafted a patch to do only that step and
> attached it to this mail. If this one works for you, then I'll merge
> it immediately into -next.
One minor comment, but works in general:
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
> Also, I'm resistant to changing the probe layout on this driver at
> this time. With the work being done to generalize the OF support
> code, there is a strong possibility that of_platform will be
> deprecated in favor of going back to using the platform bus directly
> (just like how OF support works for i2c, spi, etc). I'd rather not
> refactor the driver until I'm certain of the direction that things are
> going to go.
And this was possibly the best answer I could get \o/ Sounds really promising,
is there somewhere a discussion about how OF-generalization could happen?
> From 7629d40dc343ff216b752d5c68654dc9d30f0c91 Mon Sep 17 00:00:00 2001
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Sat, 31 Oct 2009 17:49:38 -0600
> Subject: [PATCH] spi/mpc5200: Register SPI devices described in device tree
>
> Add call to of_register_spi_devices() to register SPI devices described
> in the OF device tree.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> drivers/spi/mpc52xx_psc_spi.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
> index 1b74d5c..b445464 100644
> --- a/drivers/spi/mpc52xx_psc_spi.c
> +++ b/drivers/spi/mpc52xx_psc_spi.c
> @@ -17,6 +17,7 @@
> #include <linux/errno.h>
> #include <linux/interrupt.h>
> #include <linux/of_platform.h>
> +#include <linux/of_spi.h>
> #include <linux/workqueue.h>
> #include <linux/completion.h>
> #include <linux/io.h>
> @@ -464,6 +465,7 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
> const u32 *regaddr_p;
> u64 regaddr64, size64;
> s16 id = -1;
> + int rc;
>
> regaddr_p = of_get_address(op->node, 0, &size64, NULL);
> if (!regaddr_p) {
> @@ -485,8 +487,12 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
> id = *psc_nump + 1;
> }
>
> - return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
> + rc = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
> irq_of_parse_and_map(op->node, 0), id);
> + if (!rc)
A matter of taste, maybe: I'd prefer
if (rc == 0)
as (!ptr) is often used for catching errors with pointers, but here it is the
'all went OK'-path.
> + of_register_spi_devices(dev_get_drvdata(&op->dev), op->node);
> +
> + return rc;
> }
>
> static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
> --
> 1.6.3.3
>
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
[-- Attachment #2: Type: text/plain, Size: 150 bytes --]
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev
next prev parent reply other threads:[~2009-11-02 13:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-30 19:44 [PATCH] mpc52xx-psc-spi: refactor probe and remove to make use of of_register_spi_devices() Wolfram Sang
2009-10-31 5:32 ` Stephen Rothwell
2009-10-31 9:03 ` Wolfram Sang
2009-11-01 1:03 ` Grant Likely
2009-11-02 13:14 ` Wolfram Sang [this message]
2009-11-02 16:08 ` Grant Likely
[not found] ` <fa686aa40911020808n73a898ack5fb66933188555da-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-03 11:43 ` [PATCH] mpc52xx-psc-spi: Enumerate child nodes in the OF tree Kári Davíðsson
[not found] ` <4AF01751.1090806-zCUwNCi8n9MAvxtiuMwx3w@public.gmane.org>
2009-11-03 13:05 ` Wolfram Sang
[not found] ` <20091103130515.GS3571-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-11-03 13:47 ` Grant Likely
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=20091102131427.GB4696@pengutronix.de \
--to=w.sang@pengutronix.de \
--cc=grant.likely@secretlab.ca \
--cc=kari.davidsson@marel.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=spi-devel-general@lists.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;
as well as URLs for NNTP newsgroup(s).