From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Smirl Subject: Re: [PATCH] mpc52xx_psc_spi: Convert to cs_control callback Date: Fri, 22 May 2009 09:29:51 -0400 Message-ID: <9e4733910905220629p6592c8acj2f5a1e6df8c48099@mail.gmail.com> References: <20090430223114.GA12571@oksana.dev.rtsoft.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: linuxppc-dev@ozlabs.org, Andrew Morton , David Brownell , spi-devel-general@lists.sourceforge.net To: Anton Vorontsov Return-path: In-Reply-To: <20090430223114.GA12571@oksana.dev.rtsoft.ru> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@ozlabs.org Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@ozlabs.org List-Id: linux-spi.vger.kernel.org On Thu, Apr 30, 2009 at 6:31 PM, Anton Vorontsov wrote: > mpc52xx_psc_spi driver is the last user of the legacy activate_cs > and deactivate_cs callbacks, so convert the driver to the cs_control This driver is missing a call to of_register_spi_devices(master, op->node); Here's how I added it, but it could be done more cleanly. diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 68c77a9..fe0658a 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -370,24 +371,24 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id) } /* bus_num is used only for the case dev->platform_data == NULL */ -static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, +static int __init mpc52xx_psc_spi_do_probe(struct of_device *op, u32 regaddr, u32 size, unsigned int irq, s16 bus_num) { - struct fsl_spi_platform_data *pdata = dev->platform_data; + struct fsl_spi_platform_data *pdata = op->dev.platform_data; struct mpc52xx_psc_spi *mps; struct spi_master *master; int ret; - master = spi_alloc_master(dev, sizeof *mps); + master = spi_alloc_master(&op->dev, sizeof *mps); if (master == NULL) return -ENOMEM; - dev_set_drvdata(dev, master); + dev_set_drvdata(&op->dev, master); mps = spi_master_get_devdata(master); mps->irq = irq; if (pdata == NULL) { - dev_warn(dev, "probe called without platform data, no " + dev_warn(&op->dev, "probe called without platform data, no " "(de)activate_cs function will be called\n"); mps->activate_cs = NULL; mps->deactivate_cs = NULL; @@ -407,7 +408,7 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, mps->psc = ioremap(regaddr, size); if (!mps->psc) { - dev_err(dev, "could not ioremap I/O port range\n"); + dev_err(&op->dev, "could not ioremap I/O port range\n"); ret = -EFAULT; goto free_master; } @@ -439,6 +440,8 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, if (ret < 0) goto unreg_master; + of_register_spi_devices(master, op->node); + return ret; unreg_master: @@ -495,7 +498,7 @@ 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, + return mpc52xx_psc_spi_do_probe(op, (u32)regaddr64, (u32)size64, irq_of_parse_and_map(op->node, 0), id); } -- Jon Smirl jonsmirl@gmail.com