Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp298949pxb; Tue, 19 Oct 2021 03:11:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6CekTrJow1C53KNUaZh+riuLV2OdxKUCi/WYZhwvA7+O0I+Awg6aQLWqmtzBywNpSSfHN X-Received: by 2002:a63:f30c:: with SMTP id l12mr28077548pgh.360.1634638284522; Tue, 19 Oct 2021 03:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634638284; cv=none; d=google.com; s=arc-20160816; b=hNnz1o2tO4U1kfLEgvd+BS6Qm2UwykAfY044bKbvicWD7vR1dHYmdhqr23QvwHZPVd Hi69BhHt0wKrAsYcUCM3RcXiGmmpkitLKdX94DPwHItVZYusG7bt1T+z5phavjxjJ3+G RnZiiuXkJNipHgeHJzReK0NexVEg0PByQT+4c0JcY0kqJ96S05La4OTpoYQihW5G8mHO XtYa0JWu0T9GMruN06nhFeyBS6GiCIiJbbGXDfFc2oEYWyedK3mbunLIR4UGaJ3EaYZm RNtOYJ6egK+TZu+5Zpd+suqayVyE9cIC+5iyvCrnZAxYgN6cr7rCTs5VslCNCOS+GsLI 9yFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=POqY6zTjaWI/9dbVQEFdcwlzsm2RJSbCU1b6GjLY7V0=; b=rvFbYsKB/JoF0tMv9iHsZ4BpzkfS/rTlyyU7Pm+KDlfBSt2B2pstjRxDbfkj6cZWFH eS0duVOkAgt7Y8oirVd1Hk8dAukSE/jtGh71LdxqvlR92JbBI6W4AGcxGsbqHFOq0zYA BEiC75kKYZ7bpS/nCr6P4bvvzMz4wNsoPNU16y8cxEPlkU9KXHcTgF56N2ZqAqI/TUjn XLMJJhOvLw530Qg5VuYFHZDva/o4vBw3QO8yxgH/yRLc/ktTJIWT1kNihLmtnZu584dY J8fw6YtPpqT1eOvijx+OrQyFlcXtp1Dn2fcVXebddSQGZWxp4fcVLP1+arBnrKH2CPto gEmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y132si3796059pfc.55.2021.10.19.03.10.53; Tue, 19 Oct 2021 03:11:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234976AbhJSKMK (ORCPT + 99 others); Tue, 19 Oct 2021 06:12:10 -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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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"); -- 2.20.1.windows.1