Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp372502pxa; Wed, 19 Aug 2020 03:55:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwieUQhTPI85zcaozzF11aTBfohoOHvd/9HYkhHihkkyaTIV6W1kDJ3hTEW1Sn+r2nWwioz X-Received: by 2002:aa7:d145:: with SMTP id r5mr23468828edo.323.1597834525645; Wed, 19 Aug 2020 03:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597834525; cv=none; d=google.com; s=arc-20160816; b=k/fCpj+/lIDjWcEH18N9IfG8CR2T8teemFQxwl2kt2kdmN71QrqA+zMc1yY6lcsAOz rRyzrak3K96CoauxV/s/c2drP+OoK3hyfo8nUSktTHkGSPEuirFUiEceeSZ8jlDYGKZW m58Zv//+DUP5oEGoLH7824tJwx+z/L1SZZ7tWDSd7tm8jXJen43gorUJC89ILThraBj1 rA/CqkKWe8K0/wip4LHx9RQ1oRdB2QRkCMMoQBm9QeJWrb8sSWL0MlNmN72kIjNtFZpu L8ie4UDh0jArcEwLCrqrMGtQQPGTJxi5cIBLcsDfHihjBk/Q8uRpYx+0RuuPQ5ckzI8+ lxsA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=LoR45TLt38yCU6AhQ8oX4RTGkUKE37UbDgPk3c4jGCY=; b=P07MXm+3NOh5XjIZzfqKtyfIrlmiKSdbkWPpzBkbRKycDlIthZ2/opkfBb+5fsYI46 RWaTM60koOlidfpZVK93+kxHKVpWpsGN55NLPrJXmv2jDxY5i4E5xKz08UXPsLnCitXg /zCWG/3FFUDByQn2UbQIZGJ59dzQtkI6ztk0GCL+tgIpdZh4AMz24vpFLPhOGTntb16Z AugDHOd45bSO3HP8KPP5LwjcmcKhwxvdw3T38744dApFXV/yo7rwM+u65furcscwKqI5 wDI1YSD367W9ZM56cMrktear+HDjO3Dr50UffsNULme4Xp9V2IUjrxCEfwtjqFntCpnq BOIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WfRsJeQ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 nv2si15398904ejb.154.2020.08.19.03.55.02; Wed, 19 Aug 2020 03:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=WfRsJeQ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727846AbgHSKy0 (ORCPT + 99 others); Wed, 19 Aug 2020 06:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgHSKyW (ORCPT ); Wed, 19 Aug 2020 06:54:22 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E74CC061757 for ; Wed, 19 Aug 2020 03:54:20 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id 9so1612754wmj.5 for ; Wed, 19 Aug 2020 03:54:20 -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=R/yd1JucNFlAOyz9+FjAlm504l8Wr2SxWeSxVPHeO4BfbVULD2aKO835GTtxra63eF bSoL4P0fbkZIWaGTKwv/xm8uaKAtKJOV+sFMkyXYkRmHPc9PPnTZbwe5DJ+VcYOJBoe+ bE0zg/z7bk3cb4NBN2CUeQ/keWe6GEcOBe4L/pG9NlsU756E1X1Loe3Pab+Cf4Swt+Kz tFgZUi/rlz3+LRK2/YyarASsd15qqMSmw0DCbQ9DljSN/IRbuhk+f1Gvo2+GsWDcxtmS 6MW5i4jES2dm1zpBfjELNnZPHCN9Op1cJsrFyE2pJGpvodw+HNr5LETEaotUjnwFWnkC X+Xw== X-Gm-Message-State: AOAM532sz2x7CzJax+G4uI/GijuSKLsDK8RX2fM7xGTvO3ojJRgU/NKR qV3B68jPw0bId8g13IoNmUy7XA== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, icenowy@aosc.io 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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; -- 2.25.1