From patchwork Thu Jan 2 22:05:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 234472 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, 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 A88DCC3276C for ; Thu, 2 Jan 2020 23:00:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7121920866 for ; Thu, 2 Jan 2020 23:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578006017; bh=ws1QO4IrZHu0wTXH+sAb39oQGJd62dPx1z4rY6Bnpz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uUmj3xQ7FLJAiAklQwkI9WyTDiea612ypJG2a1tcZ8SHx7/zg1Yhwjmf/42xhhQNf l6kGnbz6ntpPMcpq9V+F7wWiAM4kU1z7Qj1XXh7cFcma2XzutvaseYW7Yt6tuPmSE4 WxX7XLVvgUKwYx5S7Xd21SjehYtc7rCVInZqbj/Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727602AbgABWNI (ORCPT ); Thu, 2 Jan 2020 17:13:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:52692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727614AbgABWNH (ORCPT ); Thu, 2 Jan 2020 17:13:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D35F222C3; Thu, 2 Jan 2020 22:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003187; bh=ws1QO4IrZHu0wTXH+sAb39oQGJd62dPx1z4rY6Bnpz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmcFG0qZZmOojpodNbZjdVXEnCUnh3lbbfF0Jqde/yxf0pfAAuHu4QlHa9I2oR7wH Z2sRnNBARbC/1VhTeNhrj4Ap6NMihM7JMwdeXmdW1LGGMbfna1CfSp5t7nFn9tFvkj i5uJU9rDJg2htlbAH4lmiArx6d1htd08q8o8i5f8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Barry Song , Stephan Gerhold , Daniel Thompson , Mark Brown , Lee Jones , Sasha Levin Subject: [PATCH 5.4 055/191] mfd: mfd-core: Honour Device Trees request to disable a child-device Date: Thu, 2 Jan 2020 23:05:37 +0100 Message-Id: <20200102215835.819082035@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lee Jones [ Upstream commit 6b5c350648b857047b47acf74a57087ad27d6183 ] 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 Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown Tested-by: Stephan Gerhold Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/mfd-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 23276a80e3b4..b0afefdc9eac 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -174,6 +174,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;