From patchwork Tue Oct 19 10:00:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Bin X-Patchwork-Id: 12569377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C1B3C433EF for ; Tue, 19 Oct 2021 10:09:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E96661212 for ; Tue, 19 Oct 2021 10:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234840AbhJSKMJ (ORCPT ); Tue, 19 Oct 2021 06:12:09 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:26194 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234794AbhJSKMJ (ORCPT ); Tue, 19 Oct 2021 06:12:09 -0400 X-Greylist: delayed 568 seconds by postgrey-1.27 at vger.kernel.org; Tue, 19 Oct 2021 06:12:07 EDT Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app10-12010 (RichMail) with SMTP id 2eea616e972d9bc-faf41; Tue, 19 Oct 2021 18:00:15 +0800 (CST) X-RM-TRANSID: 2eea616e972d9bc-faf41 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee3616e97244be-dc5f9; Tue, 19 Oct 2021 18:00:15 +0800 (CST) X-RM-TRANSID: 2ee3616e97244be-dc5f9 From: Tang Bin To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH 1/3] iio: adc: rockchip_saradc: Use of_device_get_match_data to simplify code Date: Tue, 19 Oct 2021 18:00:11 +0800 Message-Id: <20211019100013.27312-2-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20211019100013.27312-1-tangbin@cmss.chinamobile.com> References: <20211019100013.27312-1-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Retrieve OF match data, it's better and cleaner to use 'of_device_get_match_data' over 'of_match_device'. Signed-off-by: Tang Bin --- drivers/iio/adc/rockchip_saradc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index f3eb8d2e5..e221e7aaa 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -304,7 +304,6 @@ static int rockchip_saradc_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct iio_dev *indio_dev = NULL; struct resource *mem; - const struct of_device_id *match; int ret; int irq; @@ -318,14 +317,12 @@ static int rockchip_saradc_probe(struct platform_device *pdev) } info = iio_priv(indio_dev); - match = of_match_device(rockchip_saradc_match, &pdev->dev); - if (!match) { + info->data = of_device_get_match_data(&pdev->dev); + if (!info->data) { dev_err(&pdev->dev, "failed to match device\n"); return -ENODEV; } - info->data = match->data; - /* Sanity check for possible later IP variants with more channels */ if (info->data->num_channels > SARADC_MAX_CHANNELS) { dev_err(&pdev->dev, "max channels exceeded"); From patchwork Tue Oct 19 10:00:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Bin X-Patchwork-Id: 12569379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C03FAC433F5 for ; Tue, 19 Oct 2021 10:10:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A45106134F for ; Tue, 19 Oct 2021 10:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235138AbhJSKMY (ORCPT ); Tue, 19 Oct 2021 06:12:24 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:10102 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235137AbhJSKMY (ORCPT ); Tue, 19 Oct 2021 06:12:24 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app12-12012 (RichMail) with SMTP id 2eec616e9736f35-fb483; Tue, 19 Oct 2021 18:00:23 +0800 (CST) X-RM-TRANSID: 2eec616e9736f35-fb483 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee3616e97244be-dc621; Tue, 19 Oct 2021 18:00:23 +0800 (CST) X-RM-TRANSID: 2ee3616e97244be-dc621 From: Tang Bin To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH 2/3] iio: adc: max9611: Use of_device_get_match_data to simplify code Date: Tue, 19 Oct 2021 18:00:12 +0800 Message-Id: <20211019100013.27312-3-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20211019100013.27312-1-tangbin@cmss.chinamobile.com> References: <20211019100013.27312-1-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Retrieve OF match data, it's better and cleaner to use 'of_device_get_match_data' over 'of_match_device'. Signed-off-by: Tang Bin --- drivers/iio/adc/max9611.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c index 052ab23f1..4e754c072 100644 --- a/drivers/iio/adc/max9611.c +++ b/drivers/iio/adc/max9611.c @@ -514,8 +514,6 @@ static int max9611_probe(struct i2c_client *client, { const char * const shunt_res_prop = "shunt-resistor-micro-ohms"; const struct device_node *of_node = client->dev.of_node; - const struct of_device_id *of_id = - of_match_device(max9611_of_table, &client->dev); struct max9611_dev *max9611; struct iio_dev *indio_dev; unsigned int of_shunt; @@ -545,7 +543,7 @@ static int max9611_probe(struct i2c_client *client, if (ret) return ret; - indio_dev->name = of_id->data; + indio_dev->name = of_device_get_match_data(&client->dev); indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &indio_info; indio_dev->channels = max9611_channels; From patchwork Tue Oct 19 10:00:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Bin X-Patchwork-Id: 12569325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E1A1C433EF for ; Tue, 19 Oct 2021 10:00:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75E756134F for ; Tue, 19 Oct 2021 10:00:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235161AbhJSKDA (ORCPT ); Tue, 19 Oct 2021 06:03:00 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:44690 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234955AbhJSKC7 (ORCPT ); Tue, 19 Oct 2021 06:02:59 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee1616e9737608-fa8e3; Tue, 19 Oct 2021 18:00:25 +0800 (CST) X-RM-TRANSID: 2ee1616e9737608-fa8e3 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee3616e97244be-dc62a; Tue, 19 Oct 2021 18:00:25 +0800 (CST) X-RM-TRANSID: 2ee3616e97244be-dc62a From: Tang Bin To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH 3/3] iio: adc: twl6030-gpadc: Use of_device_get_match_data to simplify code Date: Tue, 19 Oct 2021 18:00:13 +0800 Message-Id: <20211019100013.27312-4-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20211019100013.27312-1-tangbin@cmss.chinamobile.com> References: <20211019100013.27312-1-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Retrieve OF match data, it's better and cleaner to use 'of_device_get_match_data' over 'of_match_device'. Signed-off-by: Tang Bin --- drivers/iio/adc/twl6030-gpadc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index c6416ad79..0859f3f7d 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -867,17 +867,14 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct twl6030_gpadc_data *gpadc; const struct twl6030_gpadc_platform_data *pdata; - const struct of_device_id *match; struct iio_dev *indio_dev; int irq; int ret; - match = of_match_device(of_twl6030_match_tbl, dev); - if (!match) + pdata = of_device_get_match_data(dev); + if (!pdata) return -EINVAL; - pdata = match->data; - indio_dev = devm_iio_device_alloc(dev, sizeof(*gpadc)); if (!indio_dev) return -ENOMEM;