From patchwork Mon Sep 30 06:59:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 2962701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 289C0BFF0B for ; Mon, 30 Sep 2013 06:59:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F28C2024F for ; Mon, 30 Sep 2013 06:59:48 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C9EFD2021E for ; Mon, 30 Sep 2013 06:59:46 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQXSH-0002pn-QQ; Mon, 30 Sep 2013 06:59:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQXSF-0002Rm-EK; Mon, 30 Sep 2013 06:59:39 +0000 Received: from mail-ea0-f173.google.com ([209.85.215.173]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQXSC-0002Pw-74 for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2013 06:59:37 +0000 Received: by mail-ea0-f173.google.com with SMTP id g10so2443283eak.32 for ; Sun, 29 Sep 2013 23:59:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :content-type; bh=AgfmxeQF1SkKMCJYXagPJjiPopDRNfufu2Hw9zsBilo=; b=b/P1IekYtjYBnV6vWJCpqk9mXRARdVq8tq4ZYEpX3rf1U1R+wEhtD2HeLyUGwSKMMm Zws1mOYggXwLLN2GXwNtN6/441mFy0BDr+bXGM85u2RfupOp/2zTy5i1cYmOnYhqfvvN GvV8G7pyb+y2gNgoFbk+LPSJtxmRxkR0/+M81d2DANOip6Db2ZT+z3S4COKuGZS0FV6O qoZTo0wyEJzRcwQT7Sz/USpIEsU78uOUfySP+a1MDdfZscY6A0NNKs0ArNUq6kunzJXX BmVwy9Hhb2jhOIs1fRIvSKR2fJoMkp+vf5A0fGQUulYP18xo2KwMp1QlM5ZSvj/+F6W/ jlSg== X-Gm-Message-State: ALoCoQlUzxybMNDQwud/D/7Em/5OTw5ufO0L8zwwAi+6YxBsaKgG6ROcEi9s4EsqfO/EDnPyYESG X-Received: by 10.15.54.199 with SMTP id t47mr11421696eew.46.1380524348222; Sun, 29 Sep 2013 23:59:08 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id bn13sm47603651eeb.11.1969.12.31.16.00.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 29 Sep 2013 23:59:07 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Subject: [PATCH] amba: Ensure drvdata is NULL Date: Mon, 30 Sep 2013 08:59:06 +0200 Message-Id: <1b2479137287fa8dfda3089ca0cb9fba8c4b1f1d.1380524337.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.8.2.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130930_025936_470741_0B78A51A X-CRM114-Status: GOOD ( 17.46 ) X-Spam-Score: 3.0 (+++) Cc: linux-fbdev@vger.kernel.org, Dmitry Torokhov , Linus Walleij , Wim Van Sebroeck , Jiri Slaby , "zhangwei\(Jovi\)" , Russell King , Vinod Koul , Tomi Valkeinen , linux-serial@vger.kernel.org, linux-input@vger.kernel.org, Chris Ball , Jean-Christophe Plagniol-Villard , linux-watchdog@vger.kernel.org, rtc-linux@googlegroups.com, Mark Brown , Dan Williams , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Greg Kroah-Hartman , Randy Dunlap , linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, Andrew Morton X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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.4 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS, 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 This patch is inpired by the patch for drvdata "device-core: Ensure drvdata = NULL when no driver is bound" (sha1: 0998d0631001288a5974afc0b2a5f568bcdecb4d) Also it fixes all occurences in drivers. Signed-off-by: Michal Simek --- This patch has been sent as RFC in this thread. http://lkml.org/lkml/2013/9/4/393 --- arch/arm/kernel/etm.c | 6 ------ drivers/amba/bus.c | 2 ++ drivers/dma/pl330.c | 3 --- drivers/input/serio/ambakmi.c | 2 -- drivers/mmc/host/mmci.c | 2 -- drivers/rtc/rtc-pl030.c | 2 -- drivers/rtc/rtc-pl031.c | 2 -- drivers/spi/spi-pl022.c | 1 - drivers/tty/serial/amba-pl010.c | 3 --- drivers/tty/serial/amba-pl011.c | 3 --- drivers/video/amba-clcd.c | 2 -- drivers/watchdog/sp805_wdt.c | 1 - 12 files changed, 2 insertions(+), 27 deletions(-) -- 1.8.2.3 diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c index 8ff0ecd..131a6ab 100644 --- a/arch/arm/kernel/etm.c +++ b/arch/arm/kernel/etm.c @@ -385,7 +385,6 @@ out: return ret; out_unmap: - amba_set_drvdata(dev, NULL); iounmap(t->etb_regs); out_release: @@ -398,8 +397,6 @@ static int etb_remove(struct amba_device *dev) { struct tracectx *t = amba_get_drvdata(dev); - amba_set_drvdata(dev, NULL); - iounmap(t->etb_regs); t->etb_regs = NULL; @@ -588,7 +585,6 @@ out: return ret; out_unmap: - amba_set_drvdata(dev, NULL); iounmap(t->etm_regs); out_release: @@ -601,8 +597,6 @@ static int etm_remove(struct amba_device *dev) { struct tracectx *t = amba_get_drvdata(dev); - amba_set_drvdata(dev, NULL); - iounmap(t->etm_regs); t->etm_regs = NULL; diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index c670727..9762090 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -373,6 +373,7 @@ static int amba_probe(struct device *dev) if (ret == 0) break; + amba_set_drvdata(pcdev, NULL); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); pm_runtime_put_noidle(dev); @@ -391,6 +392,7 @@ static int amba_remove(struct device *dev) pm_runtime_get_sync(dev); ret = drv->remove(pcdev); + amba_set_drvdata(pcdev, NULL); pm_runtime_put_noidle(dev); /* Undo the runtime PM settings in amba_probe() */ diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index a562d24..dfb2931 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -3029,8 +3029,6 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) return 0; probe_err3: - amba_set_drvdata(adev, NULL); - /* Idle the DMAC */ list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels, chan.device_node) { @@ -3064,7 +3062,6 @@ static int pl330_remove(struct amba_device *adev) of_dma_controller_free(adev->dev.of_node); dma_async_device_unregister(&pdmac->ddma); - amba_set_drvdata(adev, NULL); /* Idle the DMAC */ list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels, diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index 4e2fd44..b7c206d 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c @@ -167,8 +167,6 @@ static int amba_kmi_remove(struct amba_device *dev) { struct amba_kmi_port *kmi = amba_get_drvdata(dev); - amba_set_drvdata(dev, NULL); - serio_unregister_port(kmi->io); clk_put(kmi->clk); iounmap(kmi->base); diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index c3785ed..07e17f1 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1678,8 +1678,6 @@ static int mmci_remove(struct amba_device *dev) { struct mmc_host *mmc = amba_get_drvdata(dev); - amba_set_drvdata(dev, NULL); - if (mmc) { struct mmci_host *host = mmc_priv(mmc); diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index 22bacdb..a804f75 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c @@ -153,8 +153,6 @@ static int pl030_remove(struct amba_device *dev) { struct pl030_rtc *rtc = amba_get_drvdata(dev); - amba_set_drvdata(dev, NULL); - writel(0, rtc->base + RTC_CR); free_irq(dev->irq[0], rtc); diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 0f0609b..c9ca86e 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -305,7 +305,6 @@ static int pl031_remove(struct amba_device *adev) { struct pl031_local *ldata = dev_get_drvdata(&adev->dev); - amba_set_drvdata(adev, NULL); free_irq(adev->irq[0], ldata); rtc_device_unregister(ldata->rtc); iounmap(ldata->base); @@ -392,7 +391,6 @@ out_no_irq: rtc_device_unregister(ldata->rtc); out_no_rtc: iounmap(ldata->base); - amba_set_drvdata(adev, NULL); out_no_remap: kfree(ldata); out: diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 9c511a9..f661a7e 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2288,7 +2288,6 @@ pl022_remove(struct amba_device *adev) amba_release_regions(adev); tasklet_disable(&pl022->pump_transfers); spi_unregister_master(pl022->master); - amba_set_drvdata(adev, NULL); return 0; } diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index 8b90f0b..33bd860 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -728,7 +728,6 @@ static int pl010_probe(struct amba_device *dev, const struct amba_id *id) amba_set_drvdata(dev, uap); ret = uart_add_one_port(&amba_reg, &uap->port); if (ret) { - amba_set_drvdata(dev, NULL); amba_ports[i] = NULL; clk_put(uap->clk); unmap: @@ -745,8 +744,6 @@ static int pl010_remove(struct amba_device *dev) struct uart_amba_port *uap = amba_get_drvdata(dev); int i; - amba_set_drvdata(dev, NULL); - uart_remove_one_port(&amba_reg, &uap->port); for (i = 0; i < ARRAY_SIZE(amba_ports); i++) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index aaa2286..7203864 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2147,7 +2147,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) amba_set_drvdata(dev, uap); ret = uart_add_one_port(&amba_reg, &uap->port); if (ret) { - amba_set_drvdata(dev, NULL); amba_ports[i] = NULL; pl011_dma_remove(uap); } @@ -2160,8 +2159,6 @@ static int pl011_remove(struct amba_device *dev) struct uart_amba_port *uap = amba_get_drvdata(dev); int i; - amba_set_drvdata(dev, NULL); - uart_remove_one_port(&amba_reg, &uap->port); for (i = 0; i < ARRAY_SIZE(amba_ports); i++) diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index 0a2cce7..0bab6ab 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c @@ -594,8 +594,6 @@ static int clcdfb_remove(struct amba_device *dev) { struct clcd_fb *fb = amba_get_drvdata(dev); - amba_set_drvdata(dev, NULL); - clcdfb_disable(fb); unregister_framebuffer(&fb->fb); if (fb->fb.cmap.len) diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 58df98a..3f786ce 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -268,7 +268,6 @@ static int sp805_wdt_remove(struct amba_device *adev) struct sp805_wdt *wdt = amba_get_drvdata(adev); watchdog_unregister_device(&wdt->wdd); - amba_set_drvdata(adev, NULL); watchdog_set_drvdata(&wdt->wdd, NULL); return 0;