From patchwork Wed Aug 19 10:54:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11723517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA575739 for ; Wed, 19 Aug 2020 10:55:50 +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 A257C206B5 for ; Wed, 19 Aug 2020 10:55:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pO7O2Q46"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WfRsJeQ6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A257C206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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: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:In-Reply-To:References:List-Owner; bh=kfpzKjTTHpaI+JC9rr92e4axQLnB0RFPAqZ8ZIksxog=; b=pO7O2Q46X/qmiWW0TE6OxuS7ep mPCIiIY4Jw+RQltLwNPerf04JOHHJIcy8ngICO0QzdZ3FPJDWaL5zHcXqDoWpMUmKapNvlKlo3LBd Uw6SnMZgyZT4S35iQqprmw8bHik8NP9uF1Z5dDLL99BUEhansDM6A10+untmbkA7OkaVwMUfZHmcO Ix84cZFYAtfF3ikmQedwI6CPic4ReyQtmxaoQ1pHjppyjh9PELj18jvORogxX2+/Cp0IJDA/z7Q2V Skk09P76JnOHyaa4DCDnYF3UUK52dbUEnaVTPAHM8TcW/8/SCr1Iydqz9JVq5qy9nSCCaD+1gXyGY PNtpbINg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8Ljc-00058q-TT; Wed, 19 Aug 2020 10:54:25 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8LjY-00057K-9y for linux-arm-kernel@lists.infradead.org; Wed, 19 Aug 2020 10:54:22 +0000 Received: by mail-wm1-x343.google.com with SMTP id c80so1635243wme.0 for ; Wed, 19 Aug 2020 03:54:19 -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:mime-version :content-transfer-encoding; bh=LoR45TLt38yCU6AhQ8oX4RTGkUKE37UbDgPk3c4jGCY=; b=WfRsJeQ6i7bcQs7Hh6HfJ0mcOi/e+46/0sIZqEhM9Fro1CA8P+8fToIkBi7iccjbpq XIwYXrRAl8fucC/T0b4oMAVA/CxVIbnqXkeQFDejPkuyxxpOMha3oLfHNcBn6KsdBd2b +UxO/K/59OdhpBlKfc8sUV8X8bPfjLmScDR6ONM1m3jQpclskEKwo7oPhyEDlkD/Gjfi RQDYzc8EDphk/hyhlehKdNk72McXQrCG1WlxJC5/XGBvuoqx2RcMqwMgIoqlcozWCRG6 9MMJ+d5tGH8AI3pX2YFB1cIxf59bI7C6odaFG35zS3zwdoCMQ88AgR7IZS/z9f4MyeWE jvdA== 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:mime-version :content-transfer-encoding; bh=LoR45TLt38yCU6AhQ8oX4RTGkUKE37UbDgPk3c4jGCY=; b=euDiKe0ZyuwWde8whP0m1qGOhggYajlp1d/pg6gxS/ND3laJdZJlweUBh7bjJEgshZ yV5S0tfpXA5qGfFV/lRUD+oqb441vJ8joGwPt01I3Y6gwmEtrip/QJqMgczi/Bw3WZhE BsVY0mMXkG77FSgrYTty4LYuOC4eCF/5dYricR+BLWelCHeso4id5ustzm6WTNkI8rlX 8bqwCW3SWxX4hgBlcOPGmIEJ4dF0yjr/mTY2Qzk4MwGvJFBgGrU+5KNlTmRwYuW2RYby JpWaxPpVpZY9yYalolZcEpGO3JP9YAEwZOUaj+hXJzRpRUDwA963sJQg9A+bWEzr5cqM NgkA== X-Gm-Message-State: AOAM533A8Bb+0/rYvp2V8Px6kksuyDzib2cXJcJzOxpi6CMQyekfNuCO ZykhNkHpoFtttOaVmh4jMFpkbhllAbjrYQ== X-Google-Smtp-Source: ABdhPJzTuBTrMvjfZt2nq0o/V4PT2CQ3KIo94Gao3LzYMwZ/7/L4nEPgV6onwZCV/wWynDthcOgCDA== X-Received: by 2002:a7b:c38d:: with SMTP id s13mr4432107wmj.153.1597834458881; Wed, 19 Aug 2020 03:54:18 -0700 (PDT) Received: from dell.default ([95.149.164.62]) by smtp.gmail.com with ESMTPSA id r11sm38389400wrw.78.2020.08.19.03.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2020 03:54:15 -0700 (PDT) From: Lee Jones To: lee.jones@linaro.org Subject: [PATCH 1/1] mfd: mfd-core: Ensure disabled devices are ignored without error Date: Wed, 19 Aug 2020 11:54:06 +0100 Message-Id: <20200819105406.3249846-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_065420_391638_69D09035 X-CRM114-Status: GOOD ( 17.62 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, icenowy@aosc.io Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Commit e49aa9a9bd22 ("mfd: core: Make a best effort attempt to match devices with the correct of_nodes") changed the semantics for disabled devices in mfd_add_device(). Instead of silently ignoring a disabled child device, an error was returned. On receipt of the error mfd_add_devices() the precedes to remove *all* child devices and returns an all-failed error to the caller, which will inevitably fail the parent device as well. This patch reverts back to the old semantics and ignores child devices which are disabled in Device Tree. Fixes: e49aa9a9bd22 ("mfd: core: Make a best effort attempt to match devices with the correct of_nodes") Reported-by: Icenowy Zheng Signed-off-by: Lee Jones Tested-by: Icenowy Zheng --- drivers/mfd/mfd-core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index c3651f06684fa..30f90a15ceaab 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -126,10 +126,6 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev, const __be32 *reg; u64 of_node_addr; - /* Skip devices 'disabled' by Device Tree */ - if (!of_device_is_available(np)) - return -ENODEV; - /* Skip if OF node has previously been allocated to a device */ list_for_each_entry(of_entry, &mfd_of_node_list, list) if (of_entry->np == np) @@ -212,6 +208,12 @@ static int mfd_add_device(struct device *parent, int id, if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { for_each_child_of_node(parent->of_node, np) { if (of_device_is_compatible(np, cell->of_compatible)) { + /* Ignore 'disabled' devices error free */ + if (!of_device_is_available(np)) { + ret = 0; + goto fail_alias; + } + ret = mfd_match_of_node_to_dev(pdev, np, cell); if (ret == -EAGAIN) continue;