From patchwork Thu Nov 7 11:19:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 178799 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp877252ilf; Thu, 7 Nov 2019 03:19:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyuWA74/nLP3i3Idek4ZeLX7sBOllhAAFn6wL8R291SnDPNAxxpTIPkWZETfNDKcVZ8o7pL X-Received: by 2002:a05:6402:783:: with SMTP id d3mr2835873edy.180.1573125597816; Thu, 07 Nov 2019 03:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573125597; cv=none; d=google.com; s=arc-20160816; b=WjwxH8E0RKRqVtPDqQxFQ2b7tk1pHar6CPaqb6/mzIu/Vzyj38zNQAKWIAr2zxvkvY hiCL31S6kyKeggHcDRs59I0GUpW07CYnP+9b7qXppMSy+EFZmzdx/9M5W7Oz/g4cZoca j0hCyKLPJmDGjnW++UsKc5xx/kikXae3rrE31HI8hWqjgJ94ozIWFnUeWjijbMQPOrHW JHEEvG5q6BgHUdYNJAgG/aoj+aJFpfpWxWjXJEreLSNTyHxt/LC7VNVbE1VBfGtp5Lxk 7gsqdnN7LyE/eJXy8uQtI12JXkpLNJ0mj5DEHpic8cJZg1yNkWyPRS1anKGfa2JcmhdK Wtig== 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=IwdRFDOXkMcHZuF7dT3xdj3njNrFX7fm3v4BU31vZyk=; b=NarIDYXvup0fcAaHil7SvCbZYH5gduwWIFPnda5BSCuKOVYUVMNovkhhF3aN9SgVFn IBd1YxkbC842xG7J9YcXLBdI9KGgMccrCBPb/adJqCBPAf14s9x1VpLNSah6IjLGc02F MVcDciwxiBKgrcniedrnlJvBSVQzKj25giEp3jVQkXwwG/QMSDiBAfRoeQumDF1AisXJ T1fj/l4YHK/PIGRFLiSXeq+28P+zT4UJ+/i/TN0Ya46qA3nupPh3XfG9RcZgxvbuwJJp 9fG7PlRuFOwepWiTpYbYGodoXi+E3lLVdTnChBRTcRpYfBYPnMMowvymPNOVYluRbYGb 4/lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tnuUwkk9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z16si1291562edb.23.2019.11.07.03.19.57; Thu, 07 Nov 2019 03:19:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tnuUwkk9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2388016AbfKGLT4 (ORCPT + 26 others); Thu, 7 Nov 2019 06:19:56 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38670 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727707AbfKGLT4 (ORCPT ); Thu, 7 Nov 2019 06:19:56 -0500 Received: by mail-wm1-f65.google.com with SMTP id z19so1967721wmk.3 for ; Thu, 07 Nov 2019 03:19:54 -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:mime-version :content-transfer-encoding; bh=IwdRFDOXkMcHZuF7dT3xdj3njNrFX7fm3v4BU31vZyk=; b=tnuUwkk9ZmM2/TYgNZYHyFz6ylE2usvhuyCX/ajLgnZUOknA13MLnl+Uo7bIqL74eb nLLfx7EIhM0AEHzaHt3LwRFsOuZCEL9zRLrfMz8/wMdBexw6giTTUqnizP81QyJJsgTx 0E4oeLldDhsfz5+Zzl54IoWXeeUKDhHeOHg0mR1Ez8s4K8jFl7csKx6u5hJOpbmcQgYQ PwqYSvbZ1u7N927ATftjr5mzVu1XN+ifUJgClGSC5tguZFmmAl+Xw6Jr3ugorTuH8dL7 fyT4c6qoAbWYGNUjmsgQbm9iBMhREF3CMrGRYQmQg6x/SzkbHojzmjW77SJLLtdiR1vF Q8uQ== 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=IwdRFDOXkMcHZuF7dT3xdj3njNrFX7fm3v4BU31vZyk=; b=BMdNjrLo7WFiwCZrr8GD9YwbSvvFvhRbmVzk/SZOexCvnvPP3QYxVI7WGt0HI2P1+w UZBD5YluUoUEF5imZQLEh4lYUIsDWj7MAU1P/mV+rEp00nx/+zt067JiROPPjxorfqab 2rNDQWOdn1juUiNCtwLen/xNs6Rvtg9VH36PdrZFpGIphFXDjRna8ZwLeZD0FWS5/SUC 3xFO4og9B99Xpsh6iwkSev3SaLKuLwnJnFRatLoLqaz4jygok89GuOEP6NmBqVqxc9vc x1soE7w/HNqnJWhTI/uaeZDBDtln9esze9ukBFXB79QxjKw9lMUNDaBKOXXrfJlzvjv2 whoA== X-Gm-Message-State: APjAAAW7IArZ+mJ6W2D5o4jvSNGKx/uG98wtYk2YbkUZGcm59eA+Q3lw i18R74xTjjlPQxsQ3jsqMUMQJQ== X-Received: by 2002:a7b:c8c2:: with SMTP id f2mr2207030wml.99.1573125593844; Thu, 07 Nov 2019 03:19:53 -0800 (PST) Received: from localhost.localdomain ([95.147.198.88]) by smtp.gmail.com with ESMTPSA id d11sm2566002wrf.80.2019.11.07.03.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 03:19:53 -0800 (PST) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org, arnd@arndb.de, linus.walleij@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, baohua@kernel.org, stephan@gerhold.net, Lee Jones , Barry Song Subject: [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device Date: Thu, 7 Nov 2019 11:19:50 +0000 Message-Id: <20191107111950.1189-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Until now, MFD has assumed all child devices passed to it (via mfd_cells) are to be registered. It does not take into account requests from Device Tree and the like to disable child devices on a per-platform basis. Well now it does. Link: https://www.spinics.net/lists/arm-kernel/msg366309.html Link: https://lkml.org/lkml/2019/8/22/1350 Reported-by: Barry Song Reported-by: Stephan Gerhold Signed-off-by: Lee Jones --- drivers/mfd/mfd-core.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.24.0 Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown Tested-by: Stephan Gerhold diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index cb3e0a14bbdd..f5a73af60dd4 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -152,6 +152,11 @@ static int mfd_add_device(struct device *parent, int id, if (parent->of_node && cell->of_compatible) { for_each_child_of_node(parent->of_node, np) { if (of_device_is_compatible(np, cell->of_compatible)) { + if (!of_device_is_available(np)) { + /* Ignore disabled devices error free */ + ret = 0; + goto fail_alias; + } pdev->dev.of_node = np; pdev->dev.fwnode = &np->fwnode; break;