From patchwork Thu May 25 21:27:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp55311vqr; Thu, 25 May 2023 14:29:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58crDUeAovEg1EIbaaqYCWkqJkEmu7g+VdYntCYyzbcvKUS4d4PrsofJnyjG2bjXMaiyz0 X-Received: by 2002:a17:903:1cf:b0:1a9:40d5:b0ae with SMTP id e15-20020a17090301cf00b001a940d5b0aemr99858plh.12.1685050187090; Thu, 25 May 2023 14:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050187; cv=none; d=google.com; s=arc-20160816; b=Oi73Xeb/ywWD6JpmvnJTD3Na1GtlZQkcW3gmOt9Cwjm376JdHV7TJx1oITF2qpBXy+ xqviuc3gL2c5+MQwPpvBmsU8j5yM28kyTZ2ml0YZKUk7jvDYgimV7HE0DDB8snqceoq9 jFxLvlhC/bP9tiXXCvnoy+NmjB/MwHWXOoVebrJbJjYVuSGUujcSweQvBj4v2hP7bKyI GmCgu7UvpzKADx4Y7meRInJXIqS91uWs4Cthy22fH/4dyqjUIQwg5aw1TcKQ0QanPjND jTMDIBZlA3ne5iN8TOitUQ0TQGGD08icBNguyq6qRaZ9pkEhizkU8T6oTFQFgCSIYusy pLJQ== 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 :dkim-signature; bh=Q3aVBIb2UQThMWSJBc3+LBZO+xAU5esCX+XztnVfgbM=; b=XBVlJH9BRKd/Dtvh/q9V9I5yAzdEEeEiv1LJLYaxdv26HAXsA2zoWK2bCt+7geAv/B v6aaa+6rC1S4MdqeoX5KE+UHL4lXz3gNsoIBbrkDsQaSttAO8C5SeVaaXzS5DfxltG3Z Q2AJ1KrSuwHCNBMpct4KuLVVhSN8CvwWM+bBK6EOL3IFFuUPIFfoAdjKZldu8f1nzuGt pfoCrCU9PJlOwrXrTVlmzQM6ZIRokt4KJMViMF/JKOhwhzcaWXr7xsfXvChwX1Oe599h a7y1gdu9HXd1vRiljYIYejka9g/rc3425h0jbo9BJMx1sId93DsbCDaZ2R3XAZ6cm0aV fu/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UF0qvBDP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw9-20020a170903044900b001ae4a291a3asi2168450plb.24.2023.05.25.14.29.33; Thu, 25 May 2023 14:29:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UF0qvBDP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240778AbjEYV2f (ORCPT + 99 others); Thu, 25 May 2023 17:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbjEYV2c (ORCPT ); Thu, 25 May 2023 17:28:32 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C877E58; Thu, 25 May 2023 14:28:22 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6140C6601F54; Thu, 25 May 2023 22:28:17 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050101; bh=7hciE8XoQj7YqlZBospZkfZLJzFdMH510lvKyu7BdNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UF0qvBDPNvxoe16vml3vZK/8BatpX4/GsrtRd3QOH/jD1xufqG2yBD7FFWze7l1NK ngN34u7iM26d6UurhdFCBGS/KtTyUPFVGysd+qIlj9kZH4amPZuReUotzwENmWg08E TQNZAEBHslxP0Xo21v0FoLSiaZiEAUijpZsS+vreK/K1Zvsu6ZVMNvDYRUuUAAJjfJ k9X0Fu4yza4WvjOUY1QhqVanVn06opgwniw7kJ8XywWzzWEu5elkrm2dtrmouvnoNI H1d2Ko6fiLjHtcUOxuGxN0y0sdMFwjRlER9NWtj+fPgbz8F3Yh549tmEnWP6ZSTTZR rQ15X7TtjtufQ== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , AngeloGioacchino Del Regno Subject: [PATCH v2 4/8] iio: adc: rockchip_saradc: Use of_device_get_match_data Date: Fri, 26 May 2023 02:57:08 +0530 Message-Id: <20230525212712.255406-5-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903184781053477?= X-GMAIL-MSGID: =?utf-8?q?1766903184781053477?= Use of_device_get_match_data() to simplify the code. Signed-off-by: Shreeya Patel Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2 - Add a Reviewed-by tag. drivers/iio/adc/rockchip_saradc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 41226b76a995..1a5790264ec1 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -414,10 +414,10 @@ static void rockchip_saradc_regulator_unreg_notifier(void *data) static int rockchip_saradc_probe(struct platform_device *pdev) { + const struct rockchip_saradc_data *match_data; struct rockchip_saradc *info = NULL; struct device_node *np = pdev->dev.of_node; struct iio_dev *indio_dev = NULL; - const struct of_device_id *match; int ret; int irq; @@ -431,13 +431,13 @@ 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) { + match_data = of_device_get_match_data(&pdev->dev); + if (!match_data) { dev_err(&pdev->dev, "failed to match device\n"); return -ENODEV; } - info->data = match->data; + info->data = match_data; /* Sanity check for possible later IP variants with more channels */ if (info->data->num_channels > SARADC_MAX_CHANNELS) {