Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5473218ybi; Sun, 7 Jul 2019 05:52:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyo96QMOrxZWtTN1OQvNPtdcfKNCQAULJtk908UH+FGH5Bcz3H3iwxneZEQPZ3t5yxcHh45 X-Received: by 2002:a63:6011:: with SMTP id u17mr16407939pgb.117.1562503954324; Sun, 07 Jul 2019 05:52:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562503954; cv=none; d=google.com; s=arc-20160816; b=Kts2006QxQRqVWM3EagQCw+X3ckX73Bd+Lopk7ia+cR5ErM7k2/uOYV0aiandQT8WC hpltovyAy+m9GA68nQKgu5UVKOuMEfiRX2WXQ91rVoiPBWH1M+rpcye0kd7hc6G1QJTm b3FI1R89plmV3J98FiXYxp4CR2uM2+W6ztci7TQU4qifhpE4uGqDsyfwcRvYZJ4CNKqA DTayBkc7sYCIyHZ3WWdCTvf+qkkxKMJuz28KZ5N3gI/n3yIoKF30nBNgIlaYAFoRvyNr 3bQXMVXTDfcBTjwtpcevOp8/hQl24tl2OYAxH4Rnyz9iyK9f10+rxOmZiIEgDA/t+e/0 rJJA== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=H6Mvbb0mz3z1V1FXADTtRImccp2BjqZUgz4UuAjizeQ=; b=nclMbWpNArWA9LLO6SBOixllhHiiPHwXlFhGFbqqGrzMyp7D/YKHdXzcxMStOAc+9p lIOyhPOsjlWKEC3N1X4STl5X9KVGHqzsX3/fMyLWbWDOCtUFJWvz/B+8VxPsFTeiYgGm kAPLVnvpBxJRp14CVXUj5eUkdTMh68IZnuNC7nim5JC63yL2RMBI4j1iSVxJy3EtumEf sK50snERp51lD2oRsEWts4dt8XhEstlPkmz5mNXsJZ4XHJtO4CymlbHIJ1W1RTVyniWk iM20Frpw6sPRPsmAZzVhpcUV2QoUr7ecV37HyPQ6sESM1ZUTcPusnybHiwp3mkAqHaDA l9Cg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k4si14026188pgq.293.2019.07.07.05.51.47; Sun, 07 Jul 2019 05:52:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbfGGMLd (ORCPT + 99 others); Sun, 7 Jul 2019 08:11:33 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2235 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725867AbfGGMLd (ORCPT ); Sun, 7 Jul 2019 08:11:33 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9A1FE5D50037484CFA55; Sun, 7 Jul 2019 20:11:30 +0800 (CST) Received: from localhost (10.45.56.64) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Sun, 7 Jul 2019 20:11:26 +0800 Date: Sun, 7 Jul 2019 13:11:23 +0100 From: Jonathan Cameron To: Fuqian Huang CC: Ludovic Desroches , Eugen Hristev , Jonathan Cameron , "Nicolas Ferre" , Alexandre Belloni , , , Subject: Re: [Patch v2 05/10] iio: using dev_get_drvdata directly Message-ID: <20190707131031.00000f0a@huawei.com> In-Reply-To: <20190704023613.4643-1-huangfq.daxian@gmail.com> References: <20190704023613.4643-1-huangfq.daxian@gmail.com> Organization: Huawei X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.45.56.64] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 Jul 2019 10:36:13 +0800 Fuqian Huang wrote: > Several drivers cast a struct device pointer to a struct > platform_device pointer only to then call platform_get_drvdata(). > To improve readability, these constructs can be simplified > by using dev_get_drvdata() directly. > > Signed-off-by: Fuqian Huang Hi. I applied a version from Kefeng Wang a while back. It'll be queued up for the merge window that is about to open. Thanks, Jonathan > --- > Changes in v2: > - Make the commit message more clearly. > > drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++-------- > drivers/iio/adc/at91_adc.c | 4 ++-- > 2 files changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c > index d384cf0250ff..a2837a0e7cba 100644 > --- a/drivers/iio/adc/at91-sama5d2_adc.c > +++ b/drivers/iio/adc/at91-sama5d2_adc.c > @@ -1578,8 +1578,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st) > static ssize_t at91_adc_get_fifo_state(struct device *dev, > struct device_attribute *attr, char *buf) > { > - struct iio_dev *indio_dev = > - platform_get_drvdata(to_platform_device(dev)); > + struct iio_dev *indio_dev = dev_get_drvdata(dev); > struct at91_adc_state *st = iio_priv(indio_dev); > > return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan); > @@ -1588,8 +1587,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev, > static ssize_t at91_adc_get_watermark(struct device *dev, > struct device_attribute *attr, char *buf) > { > - struct iio_dev *indio_dev = > - platform_get_drvdata(to_platform_device(dev)); > + struct iio_dev *indio_dev = dev_get_drvdata(dev); > struct at91_adc_state *st = iio_priv(indio_dev); > > return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark); > @@ -1841,8 +1839,7 @@ static int at91_adc_remove(struct platform_device *pdev) > > static __maybe_unused int at91_adc_suspend(struct device *dev) > { > - struct iio_dev *indio_dev = > - platform_get_drvdata(to_platform_device(dev)); > + struct iio_dev *indio_dev = dev_get_drvdata(dev); > struct at91_adc_state *st = iio_priv(indio_dev); > > /* > @@ -1862,8 +1859,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev) > > static __maybe_unused int at91_adc_resume(struct device *dev) > { > - struct iio_dev *indio_dev = > - platform_get_drvdata(to_platform_device(dev)); > + struct iio_dev *indio_dev = dev_get_drvdata(dev); > struct at91_adc_state *st = iio_priv(indio_dev); > int ret; > > diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c > index d23709ed9049..32f1c4a33b20 100644 > --- a/drivers/iio/adc/at91_adc.c > +++ b/drivers/iio/adc/at91_adc.c > @@ -1359,7 +1359,7 @@ static int at91_adc_remove(struct platform_device *pdev) > #ifdef CONFIG_PM_SLEEP > static int at91_adc_suspend(struct device *dev) > { > - struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev)); > + struct iio_dev *idev = dev_get_drvdata(dev); > struct at91_adc_state *st = iio_priv(idev); > > pinctrl_pm_select_sleep_state(dev); > @@ -1370,7 +1370,7 @@ static int at91_adc_suspend(struct device *dev) > > static int at91_adc_resume(struct device *dev) > { > - struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev)); > + struct iio_dev *idev = dev_get_drvdata(dev); > struct at91_adc_state *st = iio_priv(idev); > > clk_prepare_enable(st->clk);