From patchwork Fri Oct 9 15:44:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 317550 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp2426788ilm; Fri, 9 Oct 2020 08:45:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjnmPivoOYUQ5SadueBfdGCAz+3KE6VppgEw9rSV4LfxuiaF7q4/DztJlmJxQG+mXUd9Xl X-Received: by 2002:a17:906:4b19:: with SMTP id y25mr15787685eju.393.1602258324789; Fri, 09 Oct 2020 08:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602258324; cv=none; d=google.com; s=arc-20160816; b=SwDYtmcL+y5zAxs5qaSqrwGkuFSOBuUlQDklPi4/4TFqPnEoQ0mLHrzBdjM5NbFaPe bfdC8EFXra4xaEHG4Eo7nx+4Os3I8VhIWB97om5ukD9Xk+RtQtb14HZiGOCp4xCk0Mh4 2POXWdyueo6ijtuRvFFpwVl0/sHJh4W+Z63MQFDYpXt9sz0VzZKlYYD6DGKCPOWbJZys ONbVN5rRTUBIluF0NwqX3AMMtKjEN7TvpCL+Wy3bLvh0+JMsZQQbx5/H8vaZ3POpiuNw iMeu7QyIS1NTMrNtHdhMXldlnnW3SuO6LMHCuQOrWY0PM19SER+98gO6E0fcTdjTJOde BTqg== 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=Rs/lmUbls2+lr33cOkF5wTnejEIFAqou3Xfg7WIvltg=; b=Ie9sxTxdmbhZSX6oHWFfH4Ssz79wV4E2syuj14FtTzVoLphUIlHVQBHAzxHzIw2tIe rvpbYiKcPDm3YTUehYbRO83zeuV1XvHDeSpQlTGcgPHN58fKPk82xFmKz8TY+2hY1W5T /bFSb8FGyEyFKBZPyNnYDYNzh3MdY9OMckk1xJ61cXmkUXLB/TSO8ywOKGodRJxlPrCv o81EkijvVyzUxpV9QP/9J0GsrCxiTWYrRGy7T6TXxZtrBJs8bXoD5vnnwGsO4AZYv/uD kQVIgwoSyl52AGnXLu9KXFaJKYP2uzd+OikF38hXIJk8LOwf1IFQk7pw+wIlAm1EckXN /BEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yivuL4J5; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 d3si6328708ejy.232.2020.10.09.08.45.24; Fri, 09 Oct 2020 08:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=yivuL4J5; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S2389445AbgJIPpW (ORCPT + 6 others); Fri, 9 Oct 2020 11:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389454AbgJIPpW (ORCPT ); Fri, 9 Oct 2020 11:45:22 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C7BC0613D7 for ; Fri, 9 Oct 2020 08:45:21 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id a15so10074131ljk.2 for ; Fri, 09 Oct 2020 08:45:21 -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=Rs/lmUbls2+lr33cOkF5wTnejEIFAqou3Xfg7WIvltg=; b=yivuL4J53m688pGDgg3WPhODsMl4KQrCp23+POmiBRLuXeQtDcUSlZ92XvU590BQT7 P+frwWWKTNat2ORIVRl6EzSIO4yV1kKedUzc/WQtJNNc4VjUJgdCqt0Z+lsflrAmoeaz 5GQ2j6Qrwh5npSETINzGpD3DBNUQZW3kodv/HgzECl5kCbkMlABTX6WdXIC1PQMYnu9A nEQcM45a98V0oH+iJl3XsdbesVmFeawRCJA4SKbfMyFsI6o6UsuzOc5TArbbVoWASB+j l1+iaFVmY2OS0FJ+zk7JqybA/GxV6e1O/oBh1zsbJsT2HFWYfuf5tRW15dV0RKlMpsoR tnNw== 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=Rs/lmUbls2+lr33cOkF5wTnejEIFAqou3Xfg7WIvltg=; b=H67NGbvhNXCFkvJ1vEoBpDu71vAXXfX+gZpnWmuPte641IWIN00gNiVDnhEokkXmcx iSrMfMlj3YfW5jtattXoW9u+9kLo5C+ENMSGlHcw4+RXD4kUY5WKmPIaRi7ATHTiB0VP 62emuX8PwMhcFV87RIjjNXUJdI4jW62EypPHjkckE0kanAC/+tFpBqXnluR0VjA/JeYC uECkktg0xLcVnuV8lOQ3HLtWPYWCqO33EJK1Je4A32JfKt7ydwzTcca+4qmX+PRTayaO wWVx/is+w8ZC5presqNcKnfvGKWLaQwuAKOSNFeBJB5lp/Ckz4bUlZlo0eKIM5NepefE UuHQ== X-Gm-Message-State: AOAM533CXwndbHapOixSxEwJqqPVlz5ogo7MfwIaCIwXxi/9+PUKkHPR 3/A3XDG4ddA+tF407/Em6BrTlw== X-Received: by 2002:a2e:3806:: with SMTP id f6mr5315337lja.93.1602258319918; Fri, 09 Oct 2020 08:45:19 -0700 (PDT) Received: from eriador.lan ([188.162.65.231]) by smtp.gmail.com with ESMTPSA id r4sm1505597lfc.162.2020.10.09.08.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 08:45:19 -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 , Jishnu Prakash , Jonathan Cameron Subject: [PATCH v8 06/11] iio: adc: qcom-spmi-adc5: use of_device_get_match_data Date: Fri, 9 Oct 2020 18:44:54 +0300 Message-Id: <20201009154459.106189-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> References: <20201009154459.106189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use of_device_get_match_data() instead of hand-coding it manually. Signed-off-by: Dmitry Baryshkov Acked-by: Jonathan Cameron Acked-by: Manivannan Sadhasivam --- 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 b10a0fcf09dc..87438d1e5c0b 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -15,6 +15,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;