Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11792205pjo; Thu, 2 Jan 2020 14:21:38 -0800 (PST) X-Google-Smtp-Source: APXvYqyN4sFabS2/SCCS6Ycr/+Mhdv1/k/v/auTl6whUNAJE0+op6phv2kp4UnPEEboHaupTXG4I X-Received: by 2002:a9d:32c7:: with SMTP id u65mr76746318otb.224.1578003698534; Thu, 02 Jan 2020 14:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003698; cv=none; d=google.com; s=arc-20160816; b=At6ww+5yc3B7Hywl1q+kScpPWzg1ZwWcAG0Qwbb0cIBcUvFqJKPVIQ45pdhtS01Hru X/uRKW1whaH4Y4b9C/73f9UNDckgdOvEQNMzuQHOvN2X4/SQwkYF8mKv4oCOHVB9LZo7 TPL4cRXM7iYYDSUjzYAnpaLwMveGJrzKHgEL/nxFwAf59RBthTccWo8dKZdSiXuEMQDL xcBmYhRCH7BAqsNX2d0OTMySc+UhJA1/cbCOkxFmU2qCU8OX3PwomaA3l5KyQAqdeNFm KZirvJvWuGKbDDxTI1TPiwfpjUrqeYmUTeZZJAPnLYDMFDrUpLPAVTdBCxV9XbYCmRj7 67ZA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4RnJkZ8kq0BfgzHdYx1st4rs2Wmz17CSQRnmNtgioVM=; b=U5lhdO82C5wnMS1KWjT41wTJ1gSAuzXRNHj7BIKsLONzf0byrbDVpD+XNjlL1VJR7S j75DsLvuDTzqW3C2B7i8gtDiZNxrvAf8fwWrASSsSXLHFGjAxbT4kvlHD02BA/m+bsKB s0EmHKFDR17q2J/zHndIB4tJvIwMWKBbwvaWe9ukkRo5M6uiSBpJra2Zwpa/dy2UlFDc aBjUWdRE0Z3dXYFADdQ1i3B78CZuM6ApFmHNwDrKiSRnS/RTtpSVY0PMkNguZAcjfeVx FDbx2FgDBQN8pBepiMvFCzfhVoQTxccSL8MHbcP6gPog1nNj2aUY79usOMCTX3pPfXVI cgiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nbWrLSWm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w202si18936723oiw.194.2020.01.02.14.21.26; Thu, 02 Jan 2020 14:21:38 -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=@kernel.org header.s=default header.b=nbWrLSWm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728679AbgABWTw (ORCPT + 99 others); Thu, 2 Jan 2020 17:19:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:36414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728665AbgABWTt (ORCPT ); Thu, 2 Jan 2020 17:19:49 -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 A558622B48; Thu, 2 Jan 2020 22:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003589; bh=4oyLsrmYWoS4GjZR0IN8IUt5EC2eJlOpBX7eJQplCFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbWrLSWm/7XVzHg1D0uvebFcZEGYKDzFum7navWh0A2CLgw6kizdim7LySerQgS/O kk/pfpip8ZcG30SaXPjl2wEnT1vy+cSWd694Dw2tKFZ1IN/VYevI1Fm/PIDVjuSqZi +GQ2LQnLljlmH8C9A2pJT78/c+uwi3f89S+BxEnw= 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 4.19 032/114] mfd: mfd-core: Honour Device Trees request to disable a child-device Date: Thu, 2 Jan 2020 23:06:44 +0100 Message-Id: <20200102220032.331065471@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 182973df1aed..99a9c5c56ea9 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -178,6 +178,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; -- 2.20.1