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;