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: 12569313 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 5B613C433EF for ; Tue, 19 Oct 2021 10:02:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 206B360C51 for ; Tue, 19 Oct 2021 10:02:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 206B360C51 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GJ+eYjuIwWbad+83RZc11iL+vysKOrXvCvJVdU+855I=; b=jj9P9LMW9vgNzk mGoXRyKCF8nH79D9VoqLwIVY2t6sNCXWXiLxYx8O3JW5Iq0/3eiZB9d9Y5YBDtEfAji1OeBzE5S88 WA96evGNjAlmzCI1T0PXeyjwKUE0cabVFSJ4QXNqRkwsfM6Qe403bkKuZ9CXbK8IJ6rUAIixH+1kc 6ZGZ17LyzpGwtjoU6QhNQ23OVNHCOWjh/i91RW5Pdp2/YQrXiwIoRl84Sn3BlSlTTmYU/qPl4Q+r6 xscwC9CIcYe5ppjlROu/MlDc7tuaKRiD4okT/Iz0M0rXLmLswLoEckCEe0eP7phNnqtfOMH8ZEGCz E0oCTfoW+Djy0rxcc4uA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mclvG-000k0R-GI; Tue, 19 Oct 2021 10:00:42 +0000 Received: from cmccmta1.chinamobile.com ([221.176.66.79]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mclv0-000jxw-6N; Tue, 19 Oct 2021 10:00:30 +0000 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app02-12002 (RichMail) with SMTP id 2ee2616e972dcc0-fb04b; Tue, 19 Oct 2021 18:00:15 +0800 (CST) X-RM-TRANSID: 2ee2616e972dcc0-fb04b 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_030026_756585_41AAA87A X-CRM114-Status: GOOD ( 10.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 12569315 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 7A887C433F5 for ; Tue, 19 Oct 2021 10:02:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 436E560FDA for ; Tue, 19 Oct 2021 10:02:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 436E560FDA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aIGkp9MHOXUlQkVGAXmkiirgaukMCJzIeoaayCjKqdM=; b=It6CNrJqeSIMh2 re2igAhHv9Kl/Htviw/L/TYYDc1iT1CYw6InO36NMlKAWPVg1KrAHJ2CWd/1KbargAIaaxyR+bSE7 R7MbniM5Xb/Su+p88y4SDr/V9BDGOMFJ6uKJ5ihMOw5Gn+okUnXMC/zHS4G2WhSG8X+cHtdBcue2d PpanFAjjSor/SPsX8c1O1cgcnigQ1oGy5uJ2HkLN5y/YHdcGJWpVOYVX8bkIaZtbndsJdi4gwsHDj fgt+QHNpIDCmBeSOMOD9+RxNY80BS0TuIKXPTBPcAT3oiuKPthS0Q38VnftUBlhapGlUAq6xTlaet Pykv8AyPXXfKDBTKEtmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mclv7-000jzO-3K; Tue, 19 Oct 2021 10:00:33 +0000 Received: from cmccmta1.chinamobile.com ([221.176.66.79]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mclv0-000jy8-A6; Tue, 19 Oct 2021 10:00:30 +0000 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app02-12002 (RichMail) with SMTP id 2ee2616e9736ccd-fb058; Tue, 19 Oct 2021 18:00:23 +0800 (CST) X-RM-TRANSID: 2ee2616e9736ccd-fb058 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_030026_963459_0EAA1F85 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 12569319 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 1C5A6C433F5 for ; Tue, 19 Oct 2021 10:02:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D612160FDA for ; Tue, 19 Oct 2021 10:02:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D612160FDA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ARmmhPG+Fzyd4Wuc/lGupBchyni2vPu+0FzXqAniUUc=; b=Qag5E33Ha05d5F 1UzaqYFI8Dmbg4uCQBJepLfLZKmQCQ+518OD5LTRj9/jzdn+fyiwSKuGqlhTSvuKSE0AOV5QsynLW TeDtUoh8u5G7yk13MDBFRVm1E4rUgZ7tHmRbjKZBojErN+2VCz73kLQpyyhT3Fdz2+652/a6LrwOw iqBul3eAWQpZFXxxCi0yiwsecKKCZiCCwIPGh5XrEvsycTFbsWudCPIAhh16XnDH3JYOLi8ZnS0Eg i4x9Qrwmvf3VHjpWXwp/JO1MO43bOnSktqj+xed6upTe1VmL24mAPKRBxX5YWjU/jBkrlSwachTqG X4XZiXtfT4rqyo1qypUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mclvd-000k6r-HR; Tue, 19 Oct 2021 10:01:05 +0000 Received: from cmccmta2.chinamobile.com ([221.176.66.80]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mclvH-000k03-0V; Tue, 19 Oct 2021 10:00:50 +0000 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app05-12005 (RichMail) with SMTP id 2ee5616e9737c9e-fb390; Tue, 19 Oct 2021 18:00:25 +0800 (CST) X-RM-TRANSID: 2ee5616e9737c9e-fb390 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_030043_545746_259BEA04 X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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;