From patchwork Fri Oct 18 12:26:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 176822 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp791152ill; Fri, 18 Oct 2019 05:29:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwph43fzeadgL3NWBT1tqaNOQ+0les/OCF7z45lKpE8r1mgorHF8JQAQU1GHgmz6puAx6uE X-Received: by 2002:a05:6402:1514:: with SMTP id f20mr9410022edw.35.1571401749745; Fri, 18 Oct 2019 05:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401749; cv=none; d=google.com; s=arc-20160816; b=gHnic6B4NQ5WUEUhP00bIFnOgERRNk2GYSvAmJMjgyNgV5C6k//EqX6iz0G6dRNbgi 2AdqVJek4Fh0t4hoMcdbcYnWYO90+Nfpod1LWVgGpdCxdgROZy9A90dK98qSlLTUfsQ9 kmiRe2y+231MsWfOSfb+O5COznuWaFN5NAqIdGbqreQGqSLk6NKMqXF0iF1/vCztckiM HkWFDwxMVP/eMSRc4GqbK3oUgdoOxj93X5AcSKzf7gp4vLHrkI7Cj2DKHFOLurOBnq7n 09C5ro2dgePzByz+Ctf225+xiy7v+Ma+g6SvzdwYLDDYWH7oTCsfC3eJ+zA5I3jdRbf6 awOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=JOGbCAX9wvou6ywsxAyjFayUMg5QkjoPiWUMNf49UP4=; b=StMkM0NxXELdcZ3tBnY8Fpsnq5uTQ2k5YbKAE/DHWBzS3icqbaClaSPsMMG+AVebnS lKpThHKImkuvqGw6HI2dbCrrEu+9To1jR+H1rbLpQxK4hjb5Dnl117QThuvLgMf8sR9S zM1jkbT+KYg37+nb1rnHtIE/AsIPv1qS6ao1AAc4lOFlhDnV7crIIFLXHR8/tb2c1QDa /BHvGgvFcdpESZNTNJHg3VRc5V/gZKreM0auqGWLYhmZ/iAU/FOuMzG6r6ZzRi+TTGI6 Gk3VxAZU6SWFMfSq3ODMag5zdYrrXuGo6syDqDXoWafI8ecLHL1fFBchsdxyaNuaxDPP Cptg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FHn4bQGU; 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 r17si4032117edx.257.2019.10.18.05.29.09; Fri, 18 Oct 2019 05:29:09 -0700 (PDT) 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=FHn4bQGU; 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 S2408046AbfJRM3F (ORCPT + 26 others); Fri, 18 Oct 2019 08:29:05 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33936 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389585AbfJRM3C (ORCPT ); Fri, 18 Oct 2019 08:29:02 -0400 Received: by mail-wr1-f66.google.com with SMTP id t16so929676wrr.1 for ; Fri, 18 Oct 2019 05:28:59 -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:in-reply-to:references; bh=JOGbCAX9wvou6ywsxAyjFayUMg5QkjoPiWUMNf49UP4=; b=FHn4bQGUrrme8bhdcuqbKlKd4iJXjl0H680Dwdil6m5suU5dWL94Fgcyp/05VQzwrM IpHa8A90edNgbxCwOirUmCs3KMllZWamn0ZPjdUit+YGXPGCn/AtWY/S0v2uCdwJBAFH U/vk2d8CtrJgbBYDu7xAQgLbdcILRIy9qqgMYzbHvLjL8pcImeWmPwFTEuku/0jxQsGY Om6RbYNvZZP5ddmrJKbFgHvMnAnM0XF12HW2K71fIqtA9pF8DXdf/MXGzkGXYgxn0M4j GYj7PJ0cCmn6SZJSBAAwc0eBtAuEgQIBBtX95N7/SJWTIJag3z7yfa+pa8tQrRyNwHH6 bn0A== 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:in-reply-to :references; bh=JOGbCAX9wvou6ywsxAyjFayUMg5QkjoPiWUMNf49UP4=; b=EA93BMhjkTyVprhItGEGwO92D7f6vVmS+tcZI9gkDHTMm8vxkT1Yz2gIskyUrkgT2+ zTQGwJ8GzkwUbQF8w0Y7xaot9zh0KBPAHZHvzZoFus14hKDQ7F02o/pxya+eZmXB5Xvl 5IkICRRXCgQ6pfFwHznXLXqdcvdY5tApPybtn3xYSLL2Vx/R8ljuCWQq8AkzXlCf9RUK Q077IzL3KC2pm3i9eiOJt1a6MVNt8jfxeR0oFrSscwS8z4as/D9GdqfxCpSSqg8ajiAd 0tyul5Pl3V64DTsMO5tQSUpuQVOubuJQwryKQJKxNeCJVtRb8RivudxDNBQg2dGRXThC oqEg== X-Gm-Message-State: APjAAAUkucyulXzRS/BD9iCzZMeBdqtYOf1lnHrCt8t+V5ylANlhCqTg +6nU4MUE9k1Ry1MqHsF1w2rL8w== X-Received: by 2002:a5d:522f:: with SMTP id i15mr7209770wra.257.1571401739165; Fri, 18 Oct 2019 05:28:59 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.47]) by smtp.gmail.com with ESMTPSA id e3sm5033820wme.39.2019.10.18.05.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 05:28:58 -0700 (PDT) From: Lee Jones To: broonie@kernel.org, linus.walleij@linaro.org, daniel.thompson@linaro.org, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, baohua@kernel.org, stephan@gerhold.net, Lee Jones Subject: [PATCH 2/2] mfd: mfd-core: Honour Device Tree's request to disable a child-device Date: Fri, 18 Oct 2019 13:26:47 +0100 Message-Id: <20191018122647.3849-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018122647.3849-1-lee.jones@linaro.org> References: <20191018122647.3849-1-lee.jones@linaro.org> 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. 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.17.1 diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index eafdadd58e8b..24c139633524 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -182,6 +182,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;