From patchwork Sun Jun 29 16:21:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 4444751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 313769F32E for ; Sun, 29 Jun 2014 16:25:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46F5F20379 for ; Sun, 29 Jun 2014 16:25:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC8D52034E for ; Sun, 29 Jun 2014 16:25:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1Hs5-0003UA-2q; Sun, 29 Jun 2014 16:22:29 +0000 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1Hrt-0003Nj-Nf for linux-arm-kernel@lists.infradead.org; Sun, 29 Jun 2014 16:22:18 +0000 Received: by mail-wg0-f50.google.com with SMTP id m15so7171957wgh.9 for ; Sun, 29 Jun 2014 09:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sObyyh8jIaG+7CqRxkaikrtGNLCygNujqMvpR83rA6E=; b=bQh+Z1AGDcx98q7OPrNCY5ig+0/9SeL36YS4OV0CIZVwpd+C6YTFhGIqW4iPjTjdHo sUrljzLV4jK7HGC/pgNdiE8o+kzy9IdG+0HtsaEFnEKBQINIgdS1+mv4tR9MCqpyxgSM m4uqvmj9qKEbO3Ihdn+EI2QXI69JVF9aWEBsu91B3A6NxAUaB9NS4lfjfakOCYPT8SJq 0YSmtzYGgmcoJoYXDu4UmsJyuaqOpwGR5jrCWn1mOJyivU28WaKrO/1960I1W5FWFIoY hY3LEGYTWMwbDboQU3fUZKhYQhD/vAIQLcDsHo3IwhqMjIKfVreg6m2khpOxIMY39ELy JKdw== X-Received: by 10.180.10.168 with SMTP id j8mr24165185wib.73.1404058914875; Sun, 29 Jun 2014 09:21:54 -0700 (PDT) Received: from mamamia.internal (a89-182-10-130.net-htp.de. [89.182.10.130]) by mx.google.com with ESMTPSA id gh16sm21137573wic.3.2014.06.29.09.21.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Jun 2014 09:21:54 -0700 (PDT) From: Andre Heider To: linux-omap@vger.kernel.org Subject: [PATCH 01/13] uio: uio_pruss: use struct device Date: Sun, 29 Jun 2014 18:21:35 +0200 Message-Id: <1404058907-21112-2-git-send-email-a.heider@gmail.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1404058907-21112-1-git-send-email-a.heider@gmail.com> References: <1404058907-21112-1-git-send-email-a.heider@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140629_092217_931956_3DE1B3F4 X-CRM114-Status: GOOD ( 14.75 ) X-Spam-Score: -0.8 (/) Cc: devicetree@vger.kernel.org, Paul Walmsley , Tony Lindgren , Greg Kroah-Hartman , Matt Porter , "Hans J . Koch" , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no 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 Get rid of the repeating &dev->dev constructs and prevent introducing new ones. Signed-off-by: Andre Heider --- drivers/uio/uio_pruss.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index 96c4a19..c28d6e2 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -91,8 +91,7 @@ static irqreturn_t pruss_handler(int irq, struct uio_info *info) return IRQ_HANDLED; } -static void pruss_cleanup(struct platform_device *dev, - struct uio_pruss_dev *gdev) +static void pruss_cleanup(struct device *dev, struct uio_pruss_dev *gdev) { int cnt; struct uio_info *p = gdev->info; @@ -103,7 +102,7 @@ static void pruss_cleanup(struct platform_device *dev, } iounmap(gdev->prussio_vaddr); if (gdev->ddr_vaddr) { - dma_free_coherent(&dev->dev, extram_pool_sz, gdev->ddr_vaddr, + dma_free_coherent(dev, extram_pool_sz, gdev->ddr_vaddr, gdev->ddr_paddr); } if (gdev->sram_vaddr) @@ -115,13 +114,14 @@ static void pruss_cleanup(struct platform_device *dev, kfree(gdev); } -static int pruss_probe(struct platform_device *dev) +static int pruss_probe(struct platform_device *pdev) { struct uio_info *p; struct uio_pruss_dev *gdev; struct resource *regs_prussio; + struct device *dev = &pdev->dev; int ret = -ENODEV, cnt = 0, len; - struct uio_pruss_pdata *pdata = dev_get_platdata(&dev->dev); + struct uio_pruss_pdata *pdata = dev_get_platdata(dev); gdev = kzalloc(sizeof(struct uio_pruss_dev), GFP_KERNEL); if (!gdev) @@ -132,10 +132,11 @@ static int pruss_probe(struct platform_device *dev) kfree(gdev); return -ENOMEM; } + /* Power on PRU in case its not done as part of boot-loader */ - gdev->pruss_clk = clk_get(&dev->dev, "pruss"); + gdev->pruss_clk = clk_get(dev, "pruss"); if (IS_ERR(gdev->pruss_clk)) { - dev_err(&dev->dev, "Failed to get clock\n"); + dev_err(dev, "Failed to get clock\n"); ret = PTR_ERR(gdev->pruss_clk); kfree(gdev->info); kfree(gdev); @@ -144,14 +145,14 @@ static int pruss_probe(struct platform_device *dev) clk_enable(gdev->pruss_clk); } - regs_prussio = platform_get_resource(dev, IORESOURCE_MEM, 0); + regs_prussio = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs_prussio) { - dev_err(&dev->dev, "No PRUSS I/O resource specified\n"); + dev_err(dev, "No PRUSS I/O resource specified\n"); goto out_free; } if (!regs_prussio->start) { - dev_err(&dev->dev, "Invalid memory resource\n"); + dev_err(dev, "Invalid memory resource\n"); goto out_free; } @@ -161,27 +162,27 @@ static int pruss_probe(struct platform_device *dev) (unsigned long)gen_pool_dma_alloc(gdev->sram_pool, sram_pool_sz, &gdev->sram_paddr); if (!gdev->sram_vaddr) { - dev_err(&dev->dev, "Could not allocate SRAM pool\n"); + dev_err(dev, "Could not allocate SRAM pool\n"); goto out_free; } } - gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, + gdev->ddr_vaddr = dma_alloc_coherent(dev, extram_pool_sz, &(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA); if (!gdev->ddr_vaddr) { - dev_err(&dev->dev, "Could not allocate external memory\n"); + dev_err(dev, "Could not allocate external memory\n"); goto out_free; } len = resource_size(regs_prussio); gdev->prussio_vaddr = ioremap(regs_prussio->start, len); if (!gdev->prussio_vaddr) { - dev_err(&dev->dev, "Can't remap PRUSS I/O address range\n"); + dev_err(dev, "Can't remap PRUSS I/O address range\n"); goto out_free; } gdev->pintc_base = pdata->pintc_base; - gdev->hostirq_start = platform_get_irq(dev, 0); + gdev->hostirq_start = platform_get_irq(pdev, 0); for (cnt = 0, p = gdev->info; cnt < MAX_PRUSS_EVT; cnt++, p++) { p->mem[0].addr = regs_prussio->start; @@ -204,12 +205,12 @@ static int pruss_probe(struct platform_device *dev) p->handler = pruss_handler; p->priv = gdev; - ret = uio_register_device(&dev->dev, p); + ret = uio_register_device(dev, p); if (ret < 0) goto out_free; } - platform_set_drvdata(dev, gdev); + platform_set_drvdata(pdev, gdev); return 0; out_free: @@ -221,7 +222,7 @@ static int pruss_remove(struct platform_device *dev) { struct uio_pruss_dev *gdev = platform_get_drvdata(dev); - pruss_cleanup(dev, gdev); + pruss_cleanup(&dev->dev, gdev); return 0; }