From patchwork Wed Sep 9 14:42:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 249463 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp516726ilg; Wed, 9 Sep 2020 08:26:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx5Nfrl6o5cA5V5FRIDDB6KvaiAwLF59CewvhqhkuT/tGMns+s6QhZXAG9iAv8vfIQGOXY X-Received: by 2002:a17:906:2712:: with SMTP id z18mr4334763ejc.380.1599665201214; Wed, 09 Sep 2020 08:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599665201; cv=none; d=google.com; s=arc-20160816; b=0lqgCQ5I7QJceekBjVAsVPqZkr57xQc8BTWqRDNQ4/tS44OjtVwedj3mkdQiftMYp8 OaxmzGoVY5lJBz8aWt4XUD1mUG7pdsFOUKM/JQqMHbyfWy3x83b3XXRxrdIM/lUwcM1q 0XWxMhNwZx7q57WD2BEI1YoWS+oKb5jGLMSregs7yupwpi6tvjW8/ltSOzuLlGRDDyj6 KrtUyG+LdFLMVIGgU0QKCa7bbFI1ItYyUS+3CMmEIaZ2O4oFeBfVFunCOa9usgxwwz+i +FfYYuMlwFHD3nTWe13k+vHIaRMeP7xj9q7PoVK9CCbwk5cfmaCT6BygDhTPG/6UT0Z1 oo/g== 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=d9XrjFGnoRqCSCs6cVjFrMjJIwNqM5369XpR4oYmLeI=; b=AH56C86T9dVTiVHaFz/zuoae23VWA7lIL5MPQvml1b1HikXNjr68K0p+UU7x7AMiHr 8JkcECiVMiRgsKt8z/jq48GLvlc0ph8rpmKePXgXx8NrH3NiygCUkTasjXmm5q8YIdT4 2RDxvd1BfL+bUEMy8RI6GhMhrOAWzQ8ceOAH8I4IjMkgaH5huww5dNSe9iZY6xiRAXUc 4q5UJmgCUlhZK85N6+wY7l6b9oITObsMsgWgS/Rq0yzUIrNng5pYfpVuwmtAJVjzaXRN CA+OddJK8pcfY1M5f92zut/8rXpZmDHYIZLC1ms8oTlL4QGgiGxLgROoQeGwjyiHv0hP mLXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H1EFJNoI; 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 l25si1735101edv.228.2020.09.09.08.26.41; Wed, 09 Sep 2020 08:26:41 -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=H1EFJNoI; 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 S1726976AbgIIP0Q (ORCPT + 10 others); Wed, 9 Sep 2020 11:26:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729014AbgIIPZN (ORCPT ); Wed, 9 Sep 2020 11:25:13 -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 CEAF1C061247 for ; Wed, 9 Sep 2020 07:43:22 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id a22so3849204ljp.13 for ; Wed, 09 Sep 2020 07:43: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=d9XrjFGnoRqCSCs6cVjFrMjJIwNqM5369XpR4oYmLeI=; b=H1EFJNoINXeMhsVKKzpJRq7znAYFNKIgq0IhqKPYBXMSmX4BKAV0/pJ/cNeTJywuXt NDYEppk2e18cu6HBoBdQpC3rBGWGm30QKY9OjONC+KeVdm74HBDnDq0q3r/m2PezLICV sNDq5incZhdjcAsTHZewqdAB2zN0WRFcb82CrjSonqm7+q35GI+JDMxULqMR9+zoNBVa 7Pk8kV8pA6Q/LRnRA+tMcHqiWES9LxCNxxlIX2IvIvfc7dYEOTssPOG4vkrsQQXeDeIO EqUPADOa/BoBjbq3euBr48pST7ecsicXJUAdDxJ4LmR3oMezgJ5eTC9o0zWhq0cos67z WYng== 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=d9XrjFGnoRqCSCs6cVjFrMjJIwNqM5369XpR4oYmLeI=; b=ClszWODR/gRkRv6qve5YIuHXZbQzGTn2B/Ho9KWzZkHqzCQ/fpzejVRZLwKlWqG8+X Un3/NtGW3Ytfa63BQ8uTAvsXvx/Fbte8RLLfcM0W9iQi3uXVPIjC7pgut1z5uL3vwIsN 797lqfbVkcwIR02Zt3qJiTuiFxsp0Rxfatc4DbQSgz7ukPDU8LbPy9k68w89rl7Nq2CS VorBt7CpG5Ol77auOO3hfBAjJ+H1JTb+qddZWjyBr94KOMwgu6VIG6nAwTjUO0PmW2Ph i/emJ+n4apUrUgBanAKpK48MsdAGzW7GROeWilO9GLt3EjeBoNajlSvvMr0OoxUGW9FM iV4A== X-Gm-Message-State: AOAM530ndZjxjNdSFki3jN9PYtUL45xj0yimzm4/i2LwBJ5JdHjdrOzF jelRrXIwAaVWP39cnRY3DI+Brw== X-Received: by 2002:a2e:9690:: with SMTP id q16mr1939107lji.401.1599662596623; Wed, 09 Sep 2020 07:43:16 -0700 (PDT) Received: from eriador.lan ([188.162.64.155]) by smtp.gmail.com with ESMTPSA id t12sm621665lfk.26.2020.09.09.07.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 07:43:16 -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 Subject: [PATCH v3 06/10] iio: adc: qcom-spmi-adc5: use of_device_get_match_data Date: Wed, 9 Sep 2020 17:42:44 +0300 Message-Id: <20200909144248.54327-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200909144248.54327-1-dmitry.baryshkov@linaro.org> References: <20200909144248.54327-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 --- drivers/iio/adc/qcom-spmi-adc5.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.28.0 Acked-by: Jonathan Cameron 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;