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: 11906753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C59C2D0E4 for ; Sun, 15 Nov 2020 19:34:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D005022314 for ; Sun, 15 Nov 2020 19:34:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="D9Jm5UEm"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="IMQZo7ii" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D005022314 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+MHK1fLXY7hx4BibWaeXqX8s7NGi5Uzv71B2tbt7QK0=; b=D9Jm5UEmIl+vEoAYpQaP0IW/M VqLgMo05j9UrSIqcpa5koeggoeGfRcMvb6nI1tBeuRE6WLMgi6vZjLG9ueFuZz78f5BURGu2hoHUy oq1M0uFi5Iia35ZfUPiWT/dc7ephWH/lYoVQ2WyeSGME1GD8/v0rrxAw2WDOD7sLHOai8Dm2lfOR9 lEnzPIuBGD4TDlR83uJAREtl768L2XfkwEVmt6f4+Lya3pFb0FSPaLl910qMCenS7BnmzekK1Yf1T WSwT6Pb0tvgKoU/+D3TXPzaszoamuBBmGL8E+UbQxn2zvdUImEAb9VXksT+8eP0ODh53FzkVb+9/k X3bN4cNXA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1keNli-00005D-Lr; Sun, 15 Nov 2020 19:32:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1keNl1-0008HW-VF for linux-arm-kernel@lists.infradead.org; Sun, 15 Nov 2020 19:32:17 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201115_143216_274416_CB86514A X-CRM114-Status: GOOD ( 20.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robh+dt@kernel.org, Lars-Peter Clausen , Guenter Roeck , Jonathan Cameron Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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(-) 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)