From patchwork Sun Nov 15 19:29:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 324367 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp2809734ils; Sun, 15 Nov 2020 11:33:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2VI2tczwoFf7XWcewdVzIqvjp22LnITE6LP7a8ZnLxIeFwtdH4ESGi/838Nkixi7IDrN4 X-Received: by 2002:a17:906:19c3:: with SMTP id h3mr11606854ejd.395.1605468821019; Sun, 15 Nov 2020 11:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605468821; cv=none; d=google.com; s=arc-20160816; b=LXeJHOnzg4yhrfmeO9doonR0qHESX16V9Z8Eh4qQCsd5lZxHO46FmermrErkKCw4WC bwAuWvVs6YJRimWdZwPdNBy+q8L4bGicCtmFwwDglpFmjjKovtVTUNf0cioX4idU6rQp DvhAD/Fejnjii7col5hHJWPFobqC9rVFDxUVehlH8y3sZSvRwvZvB63pfZ5NyTlxWVj5 /bhPy4nDbeu5cE4AoE156Z9McNHMJ5m9XUbPMHEWK28EVC0sAtfH9UrHtPBdJ/IrWrVa nY8LQrHjP3Zab9hVpDJj2AE2CgIVhNNYeY3hN9ZnzhpN0V+GlwKnVBG0SJKn81u/itvE jPfA== 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=CDVgX2Itj3hIRvL/eifx/JfhrKCo6usxWmd1bHzZ0pQ=; b=PWTJvwaO6bx4SD34AFwNQfA8kvEaToXSzoUqFtTeA9IaWS6mrDO5SHdlbIArLZqr39 GZGfGM+8LWu/6kU7evOb0U3kRnNA+8fREiJz7C31Co2ljBRt9EMGF3smBBFNz6KdFIBY XPHAD/HHz20XmUbYjq7Fx3VoLoWDD++6HR3ualoZwlkAtPoDVnn52Re+QDR0qZCM0r3R QWTbEc/lWHl3/6r1W11Y8YFQeAvPcvVkU0OIanYo6+Kx8E7PWp40EAtdqFTYVzFx5cJ3 hnH86jW1jfApvyjg8G1pLNZBX8HI6OgwYSgbMHBEzZyFpqwIDGu9IPYKdm70LsMHuPAX 9dxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IMQZo7ii; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu4si1137887ejb.195.2020.11.15.11.33.40; Sun, 15 Nov 2020 11:33:41 -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=@kernel.org header.s=default header.b=IMQZo7ii; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbgKOTcQ (ORCPT + 6 others); Sun, 15 Nov 2020 14:32:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:34076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbgKOTcQ (ORCPT ); Sun, 15 Nov 2020 14:32:16 -0500 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 093B0238E6; Sun, 15 Nov 2020 19:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605468735; bh=ErJov3gozQbcXRWPQ/ExCFfzkMh9py6GNRxpW3I4Dyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMQZo7iiN9bX+UpHwQTM+8TlQe73QrxY7IAvT0Lo1E9nFVBKV4oMRXQL5+0D1ty3g gyE/niTL0fVhcY8PXeaVsjYaZ864QtSJzwG2oqqKF7OROum5JSmZrgeGie8yMKy3+/ Ko3rrnEiXb7Xih6VUPFSBZG1ihMonan1agWgKkuU= From: Jonathan Cameron To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: robh+dt@kernel.org, Jonathan Cameron , Guenter Roeck , Lars-Peter Clausen Subject: [RFC PATCH 9/9] iio: inkern: Drop io-channel-ranges dt property support Date: Sun, 15 Nov 2020 19:29:51 +0000 Message-Id: <20201115192951.1073632-10-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201115192951.1073632-1-jic23@kernel.org> References: <20201115192951.1073632-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron This property has been almost exclusively missused in mainline and we don't actually have any instances of it being necessary. As such Rob Herring suggested we just drop it and I can't immediately see any reason to disagree. If anyone has an out of tree dts file that makes use of this then let me know. I'm not against keeping the code, but documenting it as a deprecated property not to be used in new dts files. Note build tested only. If someone could give it a sanity check on a platform that uses this interface that would be great. If not I'll mock something up before applying this. Signed-off-by: Jonathan Cameron Cc: Guenter Roeck Cc: Lars-Peter Clausen --- drivers/iio/inkern.c | 49 +++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) -- 2.28.0 diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index ede99e0d5371..85a6f6103ee9 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -184,40 +184,25 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, const char *name) { struct iio_channel *chan = NULL; - - /* Walk up the tree of devices looking for a matching iio channel */ - while (np) { - int index = 0; - - /* - * For named iio channels, first look up the name in the - * "io-channel-names" property. If it cannot be found, the - * index will be an error code, and of_iio_channel_get() - * will fail. - */ - if (name) - index = of_property_match_string(np, "io-channel-names", + int index = 0; + + /* + * For named iio channels, first look up the name in the + * "io-channel-names" property. If it cannot be found, the + * index will be an error code, and of_iio_channel_get() + * will fail. + */ + if (name) + index = of_property_match_string(np, "io-channel-names", name); - chan = of_iio_channel_get(np, index); - if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER) - break; - else if (name && index >= 0) { - pr_err("ERROR: could not get IIO channel %pOF:%s(%i)\n", - np, name ? name : "", index); - return NULL; - } + chan = of_iio_channel_get(np, index); + if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER) + return chan; + else if (name && index >= 0) + pr_err("ERROR: could not get IIO channel %pOF:%s(%i)\n", + np, name ? name : "", index); - /* - * No matching IIO channel found on this node. - * If the parent node has a "io-channel-ranges" property, - * then we can try one of its channels. - */ - np = np->parent; - if (np && !of_get_property(np, "io-channel-ranges", NULL)) - return NULL; - } - - return chan; + return NULL; } static struct iio_channel *of_iio_channel_get_all(struct device *dev)