Received: by 10.192.165.156 with SMTP id m28csp832987imm; Thu, 19 Apr 2018 08:16:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/lrm9zz4KKwjilCxtc/eP8+fS4AON5w8ebXrHoZxFGFOA6mTeN7kSYE4frvwBvKmARFa+V X-Received: by 10.98.144.205 with SMTP id q74mr6117268pfk.55.1524150982502; Thu, 19 Apr 2018 08:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524150982; cv=none; d=google.com; s=arc-20160816; b=bmc2xCTriTMHYbKonxSO5kxbKymRdwtNR/HycehkRMTV/P/Iukfh5uuacytf88fZA7 AuhOfUFLM1P70meRYQkNfDxnfrhHxLG9QqPmVfw3hj3WzYMrLBYp+XjPIHwRo6wh/pVz rGhptOf7zJ+kZg4INRPh9nu5apOQFeQen9sSTS3rk3B3nmTAoPtC8uN0CHDILwYiYDEA rVM0/Zfi/BaSAYd+g4VgpOT3WZlmwRXGn91yvk09XU4Wu6hgXH0ZTAcEN1U9jLGNjtrV CT58I2PiDtM1ycZ17dx9fYfnjhrg52BW2go1rZLgnC/S+nmxJSCpt5cA54hgaSvV7Jzs RIZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=TgjfvRMFDlSd1IEKWtNVGMT8jrstOy7tGKiJwmsb5rs=; b=Kg3/8i2HFJLl31TOXinZpc6GiT35Ya+qBVd4pYS6NivZHXC7f8buPAEh362dkyuNqj Yqlk6uYnO8qd2WEiX91QswrgKlYoTkRUmDOX7SnmISiSX147A5WD+wuRq02WhcI0Gcif ACDtHRtDuFGxWGQvDjEt2Ee6+dtOr1Y+D4lf1AXYp0xpyp4zor1mWdiEGGKAdli+XwFm urCR+r9InYqHtmnn1ePIEMzSmUdmykZJw75J/donIn68bGCKlbGQ2q9oKFmmTjQnjHFn 0B+HN2h5geowNLy0AXraP0uLqzpmCu46BTUIdjF/md3Nm8JVycc9x0JugAFSlgd68A1w asxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=U004Wm8V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12-v6si3699109plt.336.2018.04.19.08.16.08; Thu, 19 Apr 2018 08:16:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=U004Wm8V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753088AbeDSPOy (ORCPT + 99 others); Thu, 19 Apr 2018 11:14:54 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:22317 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbeDSPOu (ORCPT ); Thu, 19 Apr 2018 11:14:50 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3JFECEP017093; Thu, 19 Apr 2018 10:14:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524150852; bh=q4spPhwiVW2ZlG0DX9JgZ7YQ3hwJwtZJJjR9eYOl2gg=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=U004Wm8Vm8OPQC3F0LW0QBRedvaDoEtsSlA9MBP53VojH0bgGInpJ6xzRBLRctfq5 e2ghGXhgWl+dy7TxanT0G3H4e2XGyKxaJg6UlQx3GpVIMew4zrXyhz6dqmsqBNozFI tPG/gXBDGCOyUl/+iHIb1wDzdAO0yFKuEloy4M1M= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3JFECst002572; Thu, 19 Apr 2018 10:14:12 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 19 Apr 2018 10:14:11 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 19 Apr 2018 10:14:11 -0500 Received: from [128.247.59.147] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3JFEBpe017088; Thu, 19 Apr 2018 10:14:11 -0500 Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata To: Wolfram Sang , CC: , , Hoan Tran , Linus Walleij , Santosh Shilimkar , Kevin Hilman , Thierry Reding , Jonathan Hunter , Michal Simek , , , , References: <20180419140641.27926-1-wsa+renesas@sang-engineering.com> <20180419140641.27926-11-wsa+renesas@sang-engineering.com> From: Grygorii Strashko Message-ID: Date: Thu, 19 Apr 2018 10:14:11 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180419140641.27926-11-wsa+renesas@sang-engineering.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/19/2018 09:05 AM, Wolfram Sang wrote: > We should get drvdata from struct device directly. Going via > platform_device is an unneeded step back and forth. > > Signed-off-by: Wolfram Sang > --- > > Build tested only. buildbot is happy. Please apply individually. for gpio-omap.c: Reviewed-by: Grygorii Strashko > > drivers/gpio/gpio-dwapb.c | 6 ++---- > drivers/gpio/gpio-lynxpoint.c | 3 +-- > drivers/gpio/gpio-omap.c | 12 ++++-------- > drivers/gpio/gpio-tegra.c | 6 ++---- > drivers/gpio/gpio-zynq.c | 6 ++---- > 5 files changed, 11 insertions(+), 22 deletions(-) > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 226977f78482..caaabb79e31f 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -732,8 +732,7 @@ static int dwapb_gpio_remove(struct platform_device *pdev) > #ifdef CONFIG_PM_SLEEP > static int dwapb_gpio_suspend(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct dwapb_gpio *gpio = platform_get_drvdata(pdev); > + struct dwapb_gpio *gpio = dev_get_drvdata(dev); > struct gpio_chip *gc = &gpio->ports[0].gc; > unsigned long flags; > int i; > @@ -777,8 +776,7 @@ static int dwapb_gpio_suspend(struct device *dev) > > static int dwapb_gpio_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct dwapb_gpio *gpio = platform_get_drvdata(pdev); > + struct dwapb_gpio *gpio = dev_get_drvdata(dev); > struct gpio_chip *gc = &gpio->ports[0].gc; > unsigned long flags; > int i; > diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c > index 1e557b10d73e..55fa33b7209f 100644 > --- a/drivers/gpio/gpio-lynxpoint.c > +++ b/drivers/gpio/gpio-lynxpoint.c > @@ -408,8 +408,7 @@ static int lp_gpio_runtime_resume(struct device *dev) > > static int lp_gpio_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct lp_gpio *lg = platform_get_drvdata(pdev); > + struct lp_gpio *lg = dev_get_drvdata(dev); > unsigned long reg; > int i; > > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c > index 35971a341c40..b4f8a048a2a1 100644 > --- a/drivers/gpio/gpio-omap.c > +++ b/drivers/gpio/gpio-omap.c > @@ -856,8 +856,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d) > > static int omap_mpuio_suspend_noirq(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct gpio_bank *bank = platform_get_drvdata(pdev); > + struct gpio_bank *bank = dev_get_drvdata(dev); > void __iomem *mask_reg = bank->base + > OMAP_MPUIO_GPIO_MASKIT / bank->stride; > unsigned long flags; > @@ -871,8 +870,7 @@ static int omap_mpuio_suspend_noirq(struct device *dev) > > static int omap_mpuio_resume_noirq(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct gpio_bank *bank = platform_get_drvdata(pdev); > + struct gpio_bank *bank = dev_get_drvdata(dev); > void __iomem *mask_reg = bank->base + > OMAP_MPUIO_GPIO_MASKIT / bank->stride; > unsigned long flags; > @@ -1284,8 +1282,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank); > > static int omap_gpio_runtime_suspend(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct gpio_bank *bank = platform_get_drvdata(pdev); > + struct gpio_bank *bank = dev_get_drvdata(dev); > u32 l1 = 0, l2 = 0; > unsigned long flags; > u32 wake_low, wake_hi; > @@ -1352,8 +1349,7 @@ static void omap_gpio_init_context(struct gpio_bank *p); > > static int omap_gpio_runtime_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct gpio_bank *bank = platform_get_drvdata(pdev); > + struct gpio_bank *bank = dev_get_drvdata(dev); > u32 l = 0, gen, gen0, gen1; > unsigned long flags; > int c; > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c > index 94396caaca75..04c963f03b68 100644 > --- a/drivers/gpio/gpio-tegra.c > +++ b/drivers/gpio/gpio-tegra.c > @@ -403,8 +403,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc) > #ifdef CONFIG_PM_SLEEP > static int tegra_gpio_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct tegra_gpio_info *tgi = platform_get_drvdata(pdev); > + struct tegra_gpio_info *tgi = dev_get_drvdata(dev); > unsigned long flags; > unsigned int b, p; > > @@ -443,8 +442,7 @@ static int tegra_gpio_resume(struct device *dev) > > static int tegra_gpio_suspend(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct tegra_gpio_info *tgi = platform_get_drvdata(pdev); > + struct tegra_gpio_info *tgi = dev_get_drvdata(dev); > unsigned long flags; > unsigned int b, p; > > diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c > index 75ee877e5cd5..49534241bb1e 100644 > --- a/drivers/gpio/gpio-zynq.c > +++ b/drivers/gpio/gpio-zynq.c > @@ -697,8 +697,7 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev) > > static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct zynq_gpio *gpio = platform_get_drvdata(pdev); > + struct zynq_gpio *gpio = dev_get_drvdata(dev); > > clk_disable_unprepare(gpio->clk); > > @@ -707,8 +706,7 @@ static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev) > > static int __maybe_unused zynq_gpio_runtime_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct zynq_gpio *gpio = platform_get_drvdata(pdev); > + struct zynq_gpio *gpio = dev_get_drvdata(dev); > > return clk_prepare_enable(gpio->clk); > } > -- regards, -grygorii