From patchwork Thu Sep 3 13:21:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 249013 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp489071ilg; Thu, 3 Sep 2020 06:58:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxexUu5uEbjYM7WFA5w4s8A/M5T2dh0jf+s+BO7wVMYWeKYTCFlP9/E4emWq4SyuJdtS+il X-Received: by 2002:a17:906:91d3:: with SMTP id b19mr2361928ejx.235.1599141506842; Thu, 03 Sep 2020 06:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599141506; cv=none; d=google.com; s=arc-20160816; b=W6mBnUYqfFnmLXEfXEa67FsNclOqxvXVRQu7TCjLKvFAimdWAKTXhUl6RDaDMajucm PDlAfHwHsrqy1tvI/ybMHvevCpIWqExnxpYSsNCRcdEpnFJMOLWcOlHesVGiHrFuAxZy z0eGvqgNbioxrpJGj4SvDkOdv2qHC2fFOCWQj5dMaADe+gCFfFMFkGcW6ZpS/uM+XClg ON1lqwutdcEfoTP82d92zuGIU8NoMjfy1Kf/8NZdsH/9vEarnNQDJ847OyxS8mG9EYQO CgUIWgn6jmQBNBKcA941tC8tUni8lNSPcxE3TVOn6F395vQsh3gB04c9aRXkLhS5esLD Adbg== 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=eKxx9jGOwv41qjM0dB2DR64F278mvrQpwsZT854Hceo=; b=dWNTwlPNGQIHEoZ0Gcx9wGy5sixP6mRCZ9lUGkgBjgZFq2Sd+H+OEhfNGI60R8qG4w gVcV9QXI2lwLGbv9GbKo9l31GQvH+mp+DIdZNL8Z/P0UVbEBpIh7M0NciCSkyNj6+xLK sTUmS0cz+/UIVyCMGSm9MRceD66go5zQ2amfQDqwu4sP1TURqyfS5y3YNt22eSIc7MSS CnrHfvySxVNkAAxcVNVECo3WOL0KBpQ/49I7tw/XEKGX4YDD2BBdx04/gIs39q3tUQ7p xvwJTcpQ1DdPle4kGfAzL22jImWs/KWknqp2zCOzKY8lBeL/kTPt2k1YLN3Z8KJjLRAM jMRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w+ydrhIH; 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 b2si1881646ejk.222.2020.09.03.06.58.26; Thu, 03 Sep 2020 06:58:26 -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=w+ydrhIH; 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 S1729020AbgICN6P (ORCPT + 6 others); Thu, 3 Sep 2020 09:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728984AbgICN5y (ORCPT ); Thu, 3 Sep 2020 09:57:54 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08653C0611E1 for ; Thu, 3 Sep 2020 06:21:32 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id t23so3690899ljc.3 for ; Thu, 03 Sep 2020 06:21:31 -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=eKxx9jGOwv41qjM0dB2DR64F278mvrQpwsZT854Hceo=; b=w+ydrhIHhZ7wYAaA63bRQsevdR50iFtEsb8N3t9zizNA4ETwHB10nMe+vAU7P/pGV8 RLm1BZPCz13ulabvQkJT2zXNnziM7Gbn4CXQQXSUHMyM6WLgX9WBIPJ4RpvARtMVkfYd 5G3O9e31Xqj731ZKim63bAAdFY3JLMAUnf9wwUmA80BQSOt9TT+t7eVw1uSO71xh4Te8 hIfLIcejfPKclZLi71jYQ9rBZ6ncsPpCXOlsv80gjMOsEl3fm0wf+M+pp4uhzHX5xm4g +Nvjl1x6k5ylV4b4y7YQudDuvRtl9Aoi2b7J0660+t3c0ahgjC6Ll22RzgKYUBkq65uK yb8A== 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=eKxx9jGOwv41qjM0dB2DR64F278mvrQpwsZT854Hceo=; b=RioWQg5EeAO+fMQNqcKwMk02PSn3xJ9oE96tBBypv3vHo1zrdI/T84kXYiD7Z3JmOF L2O0baH29+FSmYMgG2xvwqS4VZJ2XOTiEAbN65iMOEUwSdyZuNLVRAdoQzsMu0PyqppC 5LVcPRyAhOwcs9NtvRatr8GP2MtEOgM0iSiUVNZA1aN4Wo0CbJ93XeBG4EnJ/vKR0Hby odwNQHrORujxzg25x4B3wtMT65gN6ZWLTh4+zcj80qyW+dTcnHFkl2LKu6bZ7LxTrbQY 5OkyiO87xjdqy3NTTISv+pLXmV8FQh+6NMcnkNwojH4ZyPxs+Gqg5ljaI2wIwn+F/47W qAhQ== X-Gm-Message-State: AOAM530ygVEKVGMdysJZHUq0HhFF0ZZpVOTk+j1qxTp5r8VtlhCYZSyL BPbgV0KYqTZvZ2sloEI83C7qmA== X-Received: by 2002:a2e:a165:: with SMTP id u5mr1211994ljl.393.1599139290520; Thu, 03 Sep 2020 06:21:30 -0700 (PDT) Received: from eriador.lan ([188.162.64.138]) by smtp.gmail.com with ESMTPSA id e23sm584220lfj.80.2020.09.03.06.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 06:21:29 -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 Subject: [PATCH v2 6/9] iio: adc: qcom-spmi-adc5: use of_device_get_match_data Date: Thu, 3 Sep 2020 16:21:06 +0300 Message-Id: <20200903132109.1914011-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903132109.1914011-1-dmitry.baryshkov@linaro.org> References: <20200903132109.1914011-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org 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 --- drivers/iio/adc/qcom-spmi-adc5.c | 16 +++++----------- 1 file changed, 5 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..0ac0b81bab7d 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,19 @@ 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); 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;