From patchwork Thu Sep 10 13:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 249683 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ecf:0:0:0:0 with SMTP id i15csp1096045ilk; Thu, 10 Sep 2020 14:10:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDz1Q8t7R2N6EQ4b/mOwC6o58fSSPg0hfpg5yKpuo5Xw8TDVJCmnva1A3OqU1OqXQQQjTT X-Received: by 2002:a17:907:aa9:: with SMTP id bz9mr10497061ejc.421.1599772230332; Thu, 10 Sep 2020 14:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599772230; cv=none; d=google.com; s=arc-20160816; b=xbVQX/uX0CrbkV1AbxhQzHqCzRDUX+BusE/9pFCSNSl//mbgMa15pRCZ1zFehRoDS+ c+VrsHiG+y/GFjxsN55xjMS4Siv3b2QPfB9/TtH6N4VHB7Il2GKWP5cusr6lGbS4yLFl JJup8mQJYzK0GWX/YM0ds6vfI4F0OGkn1YNOSHxOL7MO2dg1uEiQo6F50upEJgd07rvm jwNVMs31/4ylceexMaQ3+gkX+etV6j+jyUvGoVanXRREjvpx/7u20xZZsUv+gBp6ITDw iAoB3Bc+p36VLR5W+SvvuZZQzXiaMHzvAQI8y/V/CYES/sI4tPtjsKfACo7iP5AV7l3g Fr7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9ykRgAbS1+NNh7dx3qxwh0Qb3QTBtyJsrNZlzRunA0I=; b=mwCKAykTGncWYfRZRPxSX2CtNb9MrX11Sv3RTNvBo5zbWd+q9r00lL1maJU+l51NvS IlPrulexssqWBD5ntsCseC3g5Z/7rES8yKPFgXL9GIUz5+lIMGdtzKtHTolkUlVJHYJC jlrYovfFVcpciA1XovsSpupV6Rxl/MXBpcjxthyVBLtyg4Ie/QTBUfv2EEKLUzCOa3jJ 4vB0MkWLZIhgJSpcMu0P885R6FrNdjEcCbyd8ZMrlh311gmNpXyFkYSPPy1gkr5ujUyB nS7ot69me5dBPvNUCsKxTA4Valq+dRfUogVNDIKtmSsoZA1bQWsk8jsGAJ3XHx5fwpUw ZM3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KKvbZN1S; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cd10si4638004ejb.169.2020.09.10.14.10.29; Thu, 10 Sep 2020 14:10:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KKvbZN1S; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbgIJVK0 (ORCPT + 10 others); Thu, 10 Sep 2020 17:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731114AbgIJOcg (ORCPT ); Thu, 10 Sep 2020 10:32:36 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8D50C06138E for ; Thu, 10 Sep 2020 07:00:22 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id a22so8274402ljp.13 for ; Thu, 10 Sep 2020 07:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9ykRgAbS1+NNh7dx3qxwh0Qb3QTBtyJsrNZlzRunA0I=; b=KKvbZN1SFa/gjwNr/RrbT87qA0xOk8yWGIRo8uaPv3RAMYNwYyc6lHZ2S5kNqtifAx 4MnF4TwMDO7PwIeJODUbDfSWkBr11wDPGVPOBf/5S0W/i7wL50qD64gg7Waxhfhn0Ucv 5bcSEM1yryJ5kfDnXKagqbM5ycL2xwC7Q7dLqLzi+41gBEbR+CH5IxksCG6Bx8dmkBrH 20tluDoLGAH0vvXv4B1rwxvHMMlDC+nufQ6ZePa/veSX9uxFE/T08amnSKVUlwaFM4VF T8qzWTLFryfPfjElQljBlKBnGCw03jyhisH+lhFIzkyt6PlICMMk7YJ0rY+igM71c/vI zmXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9ykRgAbS1+NNh7dx3qxwh0Qb3QTBtyJsrNZlzRunA0I=; b=IndP+SGKF0FL81KX5qQ237OE7sSW/ZV84b/wadU6tJxek82WucxrgmNPLw3NL7pdF4 P1lY81eqr/jJdYibUib4Lzwocubov1emU5mxwaccmrUm7opgU9s9NuVqEvCxmKstndDM 6iTyfRL84Yz1IKqKEe0nfa8ROw2BMiDbyb062XK3F21fcgGbnyI6PhymYDe6JZtYBwF3 mI75dpCPUx07aIRmO4eTqR9vtj8zpgKxUFp2hTu/kAsLjqp/Idv47gvDWzGoaNUJAvDt ojBDyZ7jSbnVwB8Bhcheve9RGJyA/buW610dUzWqVzo+3N6IyzvcwqjGUgEG5AbfFrx2 ExGQ== X-Gm-Message-State: AOAM533QgenjCbe5BsPf6wlYs1kAG0vUTRdpQ8g4CgXN6uvegyCMwQ4h SfXQnqbMR2qhZNTan35djyxdUQ== X-Received: by 2002:a2e:b615:: with SMTP id r21mr4203124ljn.341.1599746421274; Thu, 10 Sep 2020 07:00:21 -0700 (PDT) Received: from eriador.lan ([188.162.64.156]) by smtp.gmail.com with ESMTPSA id t82sm1367646lff.43.2020.09.10.07.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 07:00:20 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Zhang Rui , Daniel Lezcano , Amit Kucheria , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Manivannan Sadhasivam , Jonathan Cameron Subject: [PATCH v4 06/10] iio: adc: qcom-spmi-adc5: use of_device_get_match_data Date: Thu, 10 Sep 2020 16:59:56 +0300 Message-Id: <20200910140000.324091-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910140000.324091-1-dmitry.baryshkov@linaro.org> References: <20200910140000.324091-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use of_device_get_match_data() instead of hand-coding it manually. Signed-off-by: Dmitry Baryshkov Acked-by: Jonathan Cameron --- drivers/iio/adc/qcom-spmi-adc5.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.28.0 diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c index c2da8f068b87..ae27ed7a26ff 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -807,8 +808,6 @@ static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node) struct adc5_channel_prop prop, *chan_props; struct device_node *child; unsigned int index = 0; - const struct of_device_id *id; - const struct adc5_data *data; int ret; adc->nchannels = of_get_available_child_count(node); @@ -827,24 +826,21 @@ static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node) chan_props = adc->chan_props; iio_chan = adc->iio_chans; - id = of_match_node(adc5_match_table, node); - if (id) - data = id->data; - else - data = &adc5_data_pmic; - adc->data = data; + adc->data = of_device_get_match_data(adc->dev); + if (!adc->data) + adc->data = &adc5_data_pmic; for_each_available_child_of_node(node, child) { - ret = adc5_get_dt_channel_data(adc, &prop, child, data); + ret = adc5_get_dt_channel_data(adc, &prop, child, adc->data); if (ret) { of_node_put(child); return ret; } prop.scale_fn_type = - data->adc_chans[prop.channel].scale_fn_type; + adc->data->adc_chans[prop.channel].scale_fn_type; *chan_props = prop; - adc_chan = &data->adc_chans[prop.channel]; + adc_chan = &adc->data->adc_chans[prop.channel]; iio_chan->channel = prop.channel; iio_chan->datasheet_name = prop.datasheet_name;