From patchwork Fri Dec 4 02:55:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 337710 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp818568ilb; Thu, 3 Dec 2020 18:58:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1JqIViqV3cdiBD8HZfhBFDhM5oTnnUrg6NAe03aOgiHJ6d61n9ItNQAMisdE7oz7ayen3 X-Received: by 2002:a50:9344:: with SMTP id n4mr5596253eda.85.1607050699528; Thu, 03 Dec 2020 18:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607050699; cv=none; d=google.com; s=arc-20160816; b=oldbnSpJVr/PnbQNvK865lnD1+2bLg0/ukZwgvx1tVFfXpEdQ3YQ8NyeMq7Ujldlkw wzftEaLvrjFka2XmUYw+PEU+n0xY6l083lGB6vkxlB7zM5N12v7wXZWgv6orpgXwNKav zQfKdWme98yR9MGGScA0a2wbV17mUaPNbqM4JCZwT/gY7SzVzsUpgzk6rsQ4HvXoNvA8 rJtWX1hdN4zZYijBSPafa82RfOPBLPbqWSZtT+g+2jddI7x/NLwsPHf0UW//yOhzNQ9P G7PlQYX4auYENo8utQ5uyrl5DRiH/qJmSKcqvoDD1F0KQ6jtELA2SgZLdJriEqfZscNV ZocQ== 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=fdozn1iYzMMjpKJN5NGb/8zh5XeUDLh4+Oq5oqMMC8M=; b=tsfkvkEF/cJaFgvk2n4NiDE8wKujm0PkHv5HTpot987OHV3lu6NS4rg4hcRCL49O5T UUaKo/0gjrdhrOA/q6r59rIhAhexL0kBsSO/vmZjd8okV/hhX0SxR2DyDbRMl4jEGbaQ Py8VAWdEJJY46FzSQ3Sl+ctpQnG7xz3qld/Tzbs3rLoCVxtCxtikfEy45omMsT1XsPol /QuSCaY42Fw7yZV4nbFrIWFwOmJMVVhAnHlKZs4RgPSkldY28vo8SlJzXvf04ZNDhb6j Cb22XVIOpSe4tM30OOsZjPdMCBS2QSZHlKbkHEg2krJ9Eof5PT1eP2n5qyiyXFO6AJRS y3UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EslvcfVF; 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 i19si558396ejr.557.2020.12.03.18.58.19; Thu, 03 Dec 2020 18:58:19 -0800 (PST) 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=EslvcfVF; 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 S1726877AbgLDC5G (ORCPT + 6 others); Thu, 3 Dec 2020 21:57:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgLDC5G (ORCPT ); Thu, 3 Dec 2020 21:57:06 -0500 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C39C09424E for ; Thu, 3 Dec 2020 18:55:31 -0800 (PST) Received: by mail-lf1-x141.google.com with SMTP id u19so5717945lfr.7 for ; Thu, 03 Dec 2020 18:55:31 -0800 (PST) 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=fdozn1iYzMMjpKJN5NGb/8zh5XeUDLh4+Oq5oqMMC8M=; b=EslvcfVFhIoT8ToCVYKz+uQhuz/c8/KnM+blwcA//rp3dw3yN/roLaQUDSPgPidE+E Yyy3tJya3ErmFZ9HepOkzjnx+XDr1pcI3daP/6TYz4VvGuO8m6cjJt2Onn3GsfI0hTzt 2BU1Jd5E7xywiLvEouXzIkw/cA9PsFNIJqqFM9pwKGFk0ihe01/cxUEIFE41LhK3Hw/k n0SB05zqrt4U+x04VzT/v3or9kGSmR/6HeQVx3bfPo+HGEVnSyOKrU8M7VoCf7UAj6cc FPIGRt/1EERCOH1IEvcPoslslcXzf7P/Jwcg6FG30AJenUzgAFyBI1dZsKHT8xAZ15Gv I7vA== 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=fdozn1iYzMMjpKJN5NGb/8zh5XeUDLh4+Oq5oqMMC8M=; b=uRjextO6T9tr1P9w8JvTFH5Zyr86+G/noJRouMGkPHEFAaS+if41A8MvHy1aHowhsL aPzC0HuK9duuuTZqJ+W4YRncRBBoxMpeZXKYxUqIPhf89Ce8/hqzml844MrbeeXhs49Z 9RvywYSYdZhTbj0JKAgh3AZ03CUbHcHwG6dQxFbrNwIxZNLQcQsDRUvcvTw72enmIoBP Qh5G0WFJRw2iA1rFQkADTUeGae2eOlugk0VhR5t/3TbFU76Mq4Vg2H93UufSYVOyXw8g TQIRSoPtOgNVnWb5b4NcDi73ZUYb5CGZguwmqpzfroK9QU2XP5CcIj4fgMJu1nHImXZC mzSA== X-Gm-Message-State: AOAM533zKzPrbP/qdNmjRpkt5BwrLI90g/8+VrYwXobISOaIcu2Wvt7k bWHTyMy6kB3fBxnqEBZlRBLWaA== X-Received: by 2002:a19:cd6:: with SMTP id 205mr2380277lfm.117.1607050529867; Thu, 03 Dec 2020 18:55:29 -0800 (PST) Received: from eriador.lumag.spb.ru ([188.162.64.117]) by smtp.gmail.com with ESMTPSA id b8sm1131667ljo.68.2020.12.03.18.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 18:55:29 -0800 (PST) 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 v10 06/15] iio: adc: qcom-spmi-adc5: use of_device_get_match_data Date: Fri, 4 Dec 2020 05:55:00 +0300 Message-Id: <20201204025509.1075506-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204025509.1075506-1-dmitry.baryshkov@linaro.org> References: <20201204025509.1075506-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.29.2 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;