From patchwork Fri May 22 13:29:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jonsmirl@gmail.com" X-Patchwork-Id: 27523 X-Patchwork-Delegate: grant.likely@secretlab.ca Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 1BB94B6F35 for ; Fri, 22 May 2009 23:30:54 +1000 (EST) Received: by ozlabs.org (Postfix) id 73283DE361; Fri, 22 May 2009 23:30:24 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 6FE56DE266 for ; Fri, 22 May 2009 23:30:24 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-qy0-f128.google.com (mail-qy0-f128.google.com [209.85.221.128]) by ozlabs.org (Postfix) with ESMTP id 39E2CDE1B7 for ; Fri, 22 May 2009 23:29:55 +1000 (EST) Received: by qyk34 with SMTP id 34so3166595qyk.17 for ; Fri, 22 May 2009 06:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=EIyhpWeJZ4CL5lqqROI3zN2qztO1FSUHW9Vw6enh8n8=; b=Va0OW023v1MHb/qsVmuXDRaR4BhQZHBIZI8qFCEnxo8q/zFZcr121DdMhFSZ5E6TRt jVPHBUi/K++K6pM3p2qxXzTSjPI5wUsK5OXHGcHMaBB2xT5uVqbJbPYvtUpU9QoYkp31 t/CjxAb468irlgz4GnB7Tomv1VnKpW9NXTkEw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=bUlegiM4m8zBzFSruOySAB7fXC9SCUG0iRgUY+4rPAvzUNRjFMeWJpLDVPx240RXKZ D7pfZo07IDD99VVhHryobmqLmdl34TUd3MvAdzne2vm7DObXem/jlG3hzICErF+LbiM0 UnOE+FzLz2OzdxrrwMmT8XprmRR8Q0oOQcyK4= MIME-Version: 1.0 Received: by 10.220.86.135 with SMTP id s7mr3867303vcl.88.1242998991979; Fri, 22 May 2009 06:29:51 -0700 (PDT) In-Reply-To: <20090430223114.GA12571@oksana.dev.rtsoft.ru> References: <20090430223114.GA12571@oksana.dev.rtsoft.ru> Date: Fri, 22 May 2009 09:29:51 -0400 Message-ID: <9e4733910905220629p6592c8acj2f5a1e6df8c48099@mail.gmail.com> Subject: Re: [PATCH] mpc52xx_psc_spi: Convert to cs_control callback From: Jon Smirl To: Anton Vorontsov Cc: linuxppc-dev@ozlabs.org, Andrew Morton , David Brownell , spi-devel-general@lists.sourceforge.net X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.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. 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); } 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;