From patchwork Thu May 23 10:20:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 2606041 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 8D5B5DFB78 for ; Thu, 23 May 2013 10:20:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UfSdh-0005LB-Ay; Thu, 23 May 2013 10:20:53 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UfSde-0005L4-Iv for spi-devel-general@lists.sourceforge.net; Thu, 23 May 2013 10:20:50 +0000 X-ACL-Warn: Received: from mailout1.samsung.com ([203.254.224.24]) by sog-mx-3.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1UfSdb-00059q-Os for spi-devel-general@lists.sourceforge.net; Thu, 23 May 2013 10:20:50 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MN800D6LY25VO80@mailout1.samsung.com> for spi-devel-general@lists.sourceforge.net; Thu, 23 May 2013 19:20:40 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 21.49.11618.87DED915; Thu, 23 May 2013 19:20:40 +0900 (KST) X-AuditID: cbfee691-b7fef6d000002d62-f0-519ded78ca3f Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 5B.A4.21068.87DED915; Thu, 23 May 2013 19:20:40 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MN800BXIY2GS530@mmp2.samsung.com>; Thu, 23 May 2013 19:20:40 +0900 (KST) From: Jingoo Han To: 'Mark Brown' Subject: [PATCH] spi: use platform_{get,set}_drvdata() Date: Thu, 23 May 2013 19:20:40 +0900 Message-id: <002401ce579f$2ce7fa20$86b7ee60$@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac5XnxarHGOwjDGQQNC2+eiPk+IoRA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsVy+t8zY92Kt3MDDR4f1bWY+vAJm8WBPzsY LS4vvMRqcWRKI7sDi8emVZ1sHneu7WHz2L3gM5NH35ZVjAEsUVw2Kak5mWWpRfp2CVwZHfeu shVcSqrYPi+7gXFLcBcjJ4eEgInE/897mSBsMYkL99azdTFycQgJLGOUaGnZxgpTdPfKXTBb SGA6o8S2i+oQRb8YJR4+mcgOkmATUJP48uUwkM3BISKgKvH/lTtImFmgWmLegVVgvcICZhKH 189nAbFZgErmNe5mBrF5BSwl/p+5zQhhC0r8mHyPBaJXS2L9zuNMELa8xOY1b5kh7lGQ2HH2 NSPEKj2Jh41uECUiEvtevGMEOU1CYBO7xIbFx5khdglIfJt8iAWkXkJAVmLTAagxkhIHV9xg mcAoNgvJ5llINs9CsnkWkhULGFlWMYqmFiQXFCelF5nqFSfmFpfmpesl5+duYoTE2MQdjPcP WB9iTAZaP5FZSjQ5HxijeSXxhsZmRhamJqbGRuaWZqQJK4nzqrdYBwoJpCeWpGanphakFsUX leakFh9iZOLglGpgDNrjt7nHwHHpCsspwdFxdxW575YuOfmmUqmHLX12+55d39qWfjeXmPXk a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S X-CFilter-Loop: Reflected X-Spam-Score: -1.0 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 T_HDRS_LCASE Odd capitalization of message header 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers X-Headers-End: 1UfSdb-00059q-Os Cc: 'Grant Likely' , spi-devel-general@lists.sourceforge.net, 'Jingoo Han' X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Signed-off-by: Jingoo Han --- drivers/spi/spi-davinci.c | 4 ++-- drivers/spi/spi-fsl-spi.c | 2 +- drivers/spi/spi-mpc52xx-psc.c | 2 +- drivers/spi/spi-mpc52xx.c | 4 ++-- drivers/spi/spi-omap-100k.c | 4 ++-- drivers/spi/spi-omap-uwire.c | 4 ++-- drivers/spi/spi-omap2-mcspi.c | 4 ++-- drivers/spi/spi-orion.c | 4 ++-- drivers/spi/spi-ppc4xx.c | 6 ++---- drivers/spi/spi-rspi.c | 4 ++-- drivers/spi/spi-sh-hspi.c | 4 ++-- drivers/spi/spi-sh.c | 4 ++-- drivers/spi/spi-tegra114.c | 4 ++-- drivers/spi/spi-tegra20-sflash.c | 4 ++-- drivers/spi/spi-tegra20-slink.c | 4 ++-- 15 files changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 50b13c9..968e364 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -865,7 +865,7 @@ static int davinci_spi_probe(struct platform_device *pdev) goto err; } - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); dspi = spi_master_get_devdata(master); if (dspi == NULL) { @@ -1044,7 +1044,7 @@ static int davinci_spi_remove(struct platform_device *pdev) struct spi_master *master; struct resource *r; - master = dev_get_drvdata(&pdev->dev); + master = platform_get_drvdata(pdev); dspi = spi_master_get_devdata(master); spi_bitbang_stop(&dspi->bitbang); diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 14e202e..41e89c3 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -853,7 +853,7 @@ err: static int of_fsl_spi_remove(struct platform_device *ofdev) { - struct spi_master *master = dev_get_drvdata(&ofdev->dev); + struct spi_master *master = platform_get_drvdata(ofdev); struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); int ret; diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c index 291120b..fed0571 100644 --- a/drivers/spi/spi-mpc52xx-psc.c +++ b/drivers/spi/spi-mpc52xx-psc.c @@ -481,7 +481,7 @@ static int mpc52xx_psc_spi_of_probe(struct platform_device *op) static int mpc52xx_psc_spi_of_remove(struct platform_device *op) { - struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev)); + struct spi_master *master = spi_master_get(platform_get_drvdata(op)); struct mpc52xx_psc_spi *mps = spi_master_get_devdata(master); flush_workqueue(mps->workqueue); diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c index 29f7705..7c675fe 100644 --- a/drivers/spi/spi-mpc52xx.c +++ b/drivers/spi/spi-mpc52xx.c @@ -438,7 +438,7 @@ static int mpc52xx_spi_probe(struct platform_device *op) master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; master->dev.of_node = op->dev.of_node; - dev_set_drvdata(&op->dev, master); + platform_set_drvdata(op, master); ms = spi_master_get_devdata(master); ms->master = master; @@ -529,7 +529,7 @@ static int mpc52xx_spi_probe(struct platform_device *op) static int mpc52xx_spi_remove(struct platform_device *op) { - struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev)); + struct spi_master *master = spi_master_get(platform_get_drvdata(op)); struct mpc52xx_spi *ms = spi_master_get_devdata(master); int i; diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 78d29a1..9236764 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -510,7 +510,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev) master->num_chipselect = 2; master->mode_bits = MODEBITS; - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); spi100k = spi_master_get_devdata(master); spi100k->master = master; @@ -569,7 +569,7 @@ static int omap1_spi100k_remove(struct platform_device *pdev) unsigned long flags; int status = 0; - master = dev_get_drvdata(&pdev->dev); + master = platform_get_drvdata(pdev); spi100k = spi_master_get_devdata(master); spin_lock_irqsave(&spi100k->lock, flags); diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 102b233..a6a8f09 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c @@ -495,7 +495,7 @@ static int uwire_probe(struct platform_device *pdev) return -ENOMEM; } - dev_set_drvdata(&pdev->dev, uwire); + platform_set_drvdata(pdev, uwire); uwire->ck = clk_get(&pdev->dev, "fck"); if (IS_ERR(uwire->ck)) { @@ -538,7 +538,7 @@ static int uwire_probe(struct platform_device *pdev) static int uwire_remove(struct platform_device *pdev) { - struct uwire_spi *uwire = dev_get_drvdata(&pdev->dev); + struct uwire_spi *uwire = platform_get_drvdata(pdev); int status; // FIXME remove all child devices, somewhere ... diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 000922a..3b5131e 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1202,7 +1202,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev) master->cleanup = omap2_mcspi_cleanup; master->dev.of_node = node; - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); mcspi = spi_master_get_devdata(master); mcspi->master = master; @@ -1311,7 +1311,7 @@ static int omap2_mcspi_remove(struct platform_device *pdev) struct omap2_mcspi *mcspi; struct omap2_mcspi_dma *dma_channels; - master = dev_get_drvdata(&pdev->dev); + master = platform_get_drvdata(pdev); mcspi = spi_master_get_devdata(master); dma_channels = mcspi->dma_channels; diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 66a5f82..5d90beb 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -428,7 +428,7 @@ static int orion_spi_probe(struct platform_device *pdev) master->transfer_one_message = orion_spi_transfer_one_message; master->num_chipselect = ORION_NUM_CHIPSELECTS; - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); spi = spi_master_get_devdata(master); spi->master = master; @@ -485,7 +485,7 @@ static int orion_spi_remove(struct platform_device *pdev) struct resource *r; struct orion_spi *spi; - master = dev_get_drvdata(&pdev->dev); + master = platform_get_drvdata(pdev); spi = spi_master_get_devdata(master); clk_disable_unprepare(spi->clk); diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index 357f183..8548e57 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c @@ -406,7 +406,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) if (master == NULL) return -ENOMEM; master->dev.of_node = np; - dev_set_drvdata(dev, master); + platform_set_drvdata(op, master); hw = spi_master_get_devdata(master); hw->master = spi_master_get(master); hw->dev = dev; @@ -553,7 +553,6 @@ request_mem_error: free_gpios: free_gpios(hw); free_master: - dev_set_drvdata(dev, NULL); spi_master_put(master); dev_err(dev, "initialization failed\n"); @@ -562,11 +561,10 @@ free_master: static int spi_ppc4xx_of_remove(struct platform_device *op) { - struct spi_master *master = dev_get_drvdata(&op->dev); + struct spi_master *master = platform_get_drvdata(op); struct ppc4xx_spi *hw = spi_master_get_devdata(master); spi_bitbang_stop(&hw->bitbang); - dev_set_drvdata(&op->dev, NULL); release_mem_region(hw->mapbase, hw->mapsize); free_irq(hw->irqnum, hw); iounmap(hw->regs); diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 902f2fb..b44a6ac 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -719,7 +719,7 @@ static void rspi_release_dma(struct rspi_data *rspi) static int rspi_remove(struct platform_device *pdev) { - struct rspi_data *rspi = dev_get_drvdata(&pdev->dev); + struct rspi_data *rspi = platform_get_drvdata(pdev); spi_unregister_master(rspi->master); rspi_release_dma(rspi); @@ -759,7 +759,7 @@ static int rspi_probe(struct platform_device *pdev) } rspi = spi_master_get_devdata(master); - dev_set_drvdata(&pdev->dev, rspi); + platform_set_drvdata(pdev, rspi); rspi->master = master; rspi->addr = ioremap(res->start, resource_size(res)); diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 60cfae5..d3a62b9 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c @@ -297,7 +297,7 @@ static int hspi_probe(struct platform_device *pdev) } hspi = spi_master_get_devdata(master); - dev_set_drvdata(&pdev->dev, hspi); + platform_set_drvdata(pdev, hspi); /* init hspi */ hspi->master = master; @@ -341,7 +341,7 @@ static int hspi_probe(struct platform_device *pdev) static int hspi_remove(struct platform_device *pdev) { - struct hspi_priv *hspi = dev_get_drvdata(&pdev->dev); + struct hspi_priv *hspi = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c index 3c3600a..c120a70 100644 --- a/drivers/spi/spi-sh.c +++ b/drivers/spi/spi-sh.c @@ -434,7 +434,7 @@ static irqreturn_t spi_sh_irq(int irq, void *_ss) static int spi_sh_remove(struct platform_device *pdev) { - struct spi_sh_data *ss = dev_get_drvdata(&pdev->dev); + struct spi_sh_data *ss = platform_get_drvdata(pdev); spi_unregister_master(ss->master); destroy_workqueue(ss->workqueue); @@ -471,7 +471,7 @@ static int spi_sh_probe(struct platform_device *pdev) } ss = spi_master_get_devdata(master); - dev_set_drvdata(&pdev->dev, ss); + platform_set_drvdata(pdev, ss); switch (res->flags & IORESOURCE_MEM_TYPE_MASK) { case IORESOURCE_MEM_8BIT: diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 598eb45..e8f542a 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -1041,7 +1041,7 @@ static int tegra_spi_probe(struct platform_device *pdev) dev_err(&pdev->dev, "master allocation failed\n"); return -ENOMEM; } - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); tspi = spi_master_get_devdata(master); /* Parse DT */ @@ -1152,7 +1152,7 @@ exit_free_master: static int tegra_spi_remove(struct platform_device *pdev) { - struct spi_master *master = dev_get_drvdata(&pdev->dev); + struct spi_master *master = platform_get_drvdata(pdev); struct tegra_spi_data *tspi = spi_master_get_devdata(master); free_irq(tspi->irq, tspi); diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 09df8e2..c1d5d95 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -480,7 +480,7 @@ static int tegra_sflash_probe(struct platform_device *pdev) master->num_chipselect = MAX_CHIP_SELECT; master->bus_num = -1; - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); tsd = spi_master_get_devdata(master); tsd->master = master; tsd->dev = &pdev->dev; @@ -555,7 +555,7 @@ exit_free_master: static int tegra_sflash_remove(struct platform_device *pdev) { - struct spi_master *master = dev_get_drvdata(&pdev->dev); + struct spi_master *master = platform_get_drvdata(pdev); struct tegra_sflash_data *tsd = spi_master_get_devdata(master); free_irq(tsd->irq, tsd); diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 3faf88d..80490cc 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -1089,7 +1089,7 @@ static int tegra_slink_probe(struct platform_device *pdev) master->num_chipselect = MAX_CHIP_SELECT; master->bus_num = -1; - dev_set_drvdata(&pdev->dev, master); + platform_set_drvdata(pdev, master); tspi = spi_master_get_devdata(master); tspi->master = master; tspi->dev = &pdev->dev; @@ -1193,7 +1193,7 @@ exit_free_master: static int tegra_slink_remove(struct platform_device *pdev) { - struct spi_master *master = dev_get_drvdata(&pdev->dev); + struct spi_master *master = platform_get_drvdata(pdev); struct tegra_slink_data *tspi = spi_master_get_devdata(master); free_irq(tspi->irq, tspi);