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;