From patchwork Tue Aug 18 21:05:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7033651 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4EDA89F344 for ; Tue, 18 Aug 2015 21:08:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4921A20528 for ; Tue, 18 Aug 2015 21:08:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 750AD20790 for ; Tue, 18 Aug 2015 21:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753926AbbHRVI2 (ORCPT ); Tue, 18 Aug 2015 17:08:28 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:33698 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753602AbbHRVI1 (ORCPT ); Tue, 18 Aug 2015 17:08:27 -0400 Received: by wijp15 with SMTP id p15so110662307wij.0; Tue, 18 Aug 2015 14:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=S0esiAtvR0EYlNA7g0gzoXdxuHXAsAVtmK9Rtcv6eWw=; b=zljKVDVIapM0SYfVPkjmkUuMA/6342SXQaLISdOlTcgACKfbv9oORaIoa46YL0EVSu 8EYoHB7atn0EEIgNriie/dLeH8RnngK5WkUOz32rxFMI0HHWvI+oj+eseusw/tt3imPX oq187ScErQ5KoUql/Ji5Gn4Tj0LXT/FOOTLv9BISgiBU5x5/FBkFgIrB3uxE3TJIoW68 fi3VDLjr4gdMQCzWlrxKhRlGVFGfz4CoakIr2ytDR7r4/Ncmf+oZKPS6Nhf0vc1l7XXi 992PpxVaTPMGOZtJmArxpr4YmcYp/+zmvkkhYZ7aiZFOegJTyXNsrpIhLwqmpDUtE/my lXLg== X-Received: by 10.180.21.169 with SMTP id w9mr47677744wie.73.1439932105439; Tue, 18 Aug 2015 14:08:25 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:704e:482e:50f5:2dd? (p200300625F33D300704E482E50F502DD.dip0.t-ipconnect.de. [2003:62:5f33:d300:704e:482e:50f5:2dd]) by smtp.googlemail.com with ESMTPSA id s1sm22969432wix.13.2015.08.18.14.08.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Aug 2015 14:08:24 -0700 (PDT) Message-ID: <55D39E07.9040700@gmail.com> Date: Tue, 18 Aug 2015 23:05:11 +0200 From: Heiner Kallweit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: linux-samsung-soc@vger.kernel.org CC: "linux-spi@vger.kernel.org" , Krzysztof Kozlowski Subject: [PATCH 1/3] spi: s3c64xx: simplify probe function by using local variable for &pdev->dev Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the probe function by replacing all occurrences of &pdev->dev with a local variable. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-s3c64xx.c | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index cd1cfac..c4d3b06 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1024,39 +1024,39 @@ static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( static int s3c64xx_spi_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct resource *mem_res; struct resource *res; struct s3c64xx_spi_driver_data *sdd; - struct s3c64xx_spi_info *sci = dev_get_platdata(&pdev->dev); + struct s3c64xx_spi_info *sci = dev_get_platdata(dev); struct spi_master *master; int ret, irq; char clk_name[16]; - if (!sci && pdev->dev.of_node) { - sci = s3c64xx_spi_parse_dt(&pdev->dev); + if (!sci && dev->of_node) { + sci = s3c64xx_spi_parse_dt(dev); if (IS_ERR(sci)) return PTR_ERR(sci); } if (!sci) { - dev_err(&pdev->dev, "platform_data missing!\n"); + dev_err(dev, "platform_data missing!\n"); return -ENODEV; } mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (mem_res == NULL) { - dev_err(&pdev->dev, "Unable to get SPI MEM resource\n"); + dev_err(dev, "Unable to get SPI MEM resource\n"); return -ENXIO; } irq = platform_get_irq(pdev, 0); if (irq < 0) { - dev_warn(&pdev->dev, "Failed to get IRQ: %d\n", irq); + dev_warn(dev, "Failed to get IRQ: %d\n", irq); return irq; } - master = spi_alloc_master(&pdev->dev, - sizeof(struct s3c64xx_spi_driver_data)); + master = spi_alloc_master(dev, sizeof(struct s3c64xx_spi_driver_data)); if (master == NULL) { dev_err(&pdev->dev, "Unable to allocate SPI Master\n"); return -ENOMEM; @@ -1071,9 +1071,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->pdev = pdev; sdd->sfr_start = mem_res->start; if (pdev->dev.of_node) { - ret = of_alias_get_id(pdev->dev.of_node, "spi"); + ret = of_alias_get_id(dev->of_node, "spi"); if (ret < 0) { - dev_err(&pdev->dev, "failed to get alias id, errno %d\n", + dev_err(dev, "failed to get alias id, errno %d\n", ret); goto err0; } @@ -1087,14 +1087,14 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) if (!sdd->pdev->dev.of_node) { res = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!res) { - dev_warn(&pdev->dev, "Unable to get SPI tx dma resource. Switching to poll mode\n"); + dev_warn(dev, "Unable to get SPI tx dma resource. Switching to poll mode\n"); sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL; } else sdd->tx_dma.dmach = res->start; res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { - dev_warn(&pdev->dev, "Unable to get SPI rx dma resource. Switching to poll mode\n"); + dev_warn(dev, "Unable to get SPI rx dma resource. Switching to poll mode\n"); sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL; } else sdd->rx_dma.dmach = res->start; @@ -1103,7 +1103,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->tx_dma.direction = DMA_MEM_TO_DEV; sdd->rx_dma.direction = DMA_DEV_TO_MEM; - master->dev.of_node = pdev->dev.of_node; + master->dev.of_node = dev->of_node; master->bus_num = sdd->port_id; master->setup = s3c64xx_spi_setup; master->cleanup = s3c64xx_spi_cleanup; @@ -1121,43 +1121,43 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) if (!is_polling(sdd)) master->can_dma = s3c64xx_spi_can_dma; - sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res); + sdd->regs = devm_ioremap_resource(dev, mem_res); if (IS_ERR(sdd->regs)) { ret = PTR_ERR(sdd->regs); goto err0; } if (sci->cfg_gpio && sci->cfg_gpio()) { - dev_err(&pdev->dev, "Unable to config gpio\n"); + dev_err(dev, "Unable to config gpio\n"); ret = -EBUSY; goto err0; } /* Setup clocks */ - sdd->clk = devm_clk_get(&pdev->dev, "spi"); + sdd->clk = devm_clk_get(dev, "spi"); if (IS_ERR(sdd->clk)) { - dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n"); + dev_err(dev, "Unable to acquire clock 'spi'\n"); ret = PTR_ERR(sdd->clk); goto err0; } if (clk_prepare_enable(sdd->clk)) { - dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n"); + dev_err(dev, "Couldn't enable clock 'spi'\n"); ret = -EBUSY; goto err0; } sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr); - sdd->src_clk = devm_clk_get(&pdev->dev, clk_name); + sdd->src_clk = devm_clk_get(dev, clk_name); if (IS_ERR(sdd->src_clk)) { - dev_err(&pdev->dev, + dev_err(dev, "Unable to acquire clock '%s'\n", clk_name); ret = PTR_ERR(sdd->src_clk); goto err2; } if (clk_prepare_enable(sdd->src_clk)) { - dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name); + dev_err(dev, "Couldn't enable clock '%s'\n", clk_name); ret = -EBUSY; goto err2; } @@ -1168,10 +1168,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) spin_lock_init(&sdd->lock); init_completion(&sdd->xfer_completion); - ret = devm_request_irq(&pdev->dev, irq, s3c64xx_spi_irq, 0, + ret = devm_request_irq(dev, irq, s3c64xx_spi_irq, 0, "spi-s3c64xx", sdd); if (ret != 0) { - dev_err(&pdev->dev, "Failed to request IRQ %d: %d\n", + dev_err(dev, "Failed to request IRQ %d: %d\n", irq, ret); goto err3; } @@ -1180,18 +1180,18 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, sdd->regs + S3C64XX_SPI_INT_EN); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); - ret = devm_spi_register_master(&pdev->dev, master); + ret = devm_spi_register_master(dev, master); if (ret != 0) { - dev_err(&pdev->dev, "cannot register SPI master: %d\n", ret); + dev_err(dev, "cannot register SPI master: %d\n", ret); goto err3; } - dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n", + dev_dbg(dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n", sdd->port_id, master->num_chipselect); - dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\tDMA=[Rx-%d, Tx-%d]\n", + dev_dbg(dev, "\tIOmem=[%pR]\tFIFO %dbytes\tDMA=[Rx-%d, Tx-%d]\n", mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1, sdd->rx_dma.dmach, sdd->tx_dma.dmach);