From patchwork Thu Nov 20 10:19:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 41224 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A41A23C27 for ; Thu, 20 Nov 2014 10:20:28 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf1523022wgh.1 for ; Thu, 20 Nov 2014 02:20:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=xczmKScJyeWfxIjFBgZMQmxvHzHd2raZ8adPPjT0jaI=; b=Ws3L1/t4EaL+R5xE5FDkstXYJytZ8aV5/z68QUfw30osxBFIvzn4wA2xc6sz9z+OEL 0tiDa5qMfQNnWNm6tct6/AOUxMyQrFKphSS+gd8ryaB7VYYSU6+1zhTlAIe0JlNzU2rG 0+32OFlmOrMCVtZX1AOtqoukJ71vJ/YUYbVn/yEsS5/iluze1m7GvZ/56TLJQFbjI5GL LeCtRZbfSDZGrT07bENJhbeQi3iL97ujLPPeUkIxjV/a+PeJJKzvMispqdjqmlVGfECp zTkmfzz5r7lfMLM5gge3hJY1tccqOh+YLkyK0SSwdQT3JJFuJVXgcS9lEXeurxfejCVR VMbQ== X-Gm-Message-State: ALoCoQndtADGQpmKr/q+LcdO9Ll44smY8335/qQTkWD2z5PXD0iiSE9oFKwTjPcVOE6jAWczHhyN X-Received: by 10.152.26.72 with SMTP id j8mr2872635lag.3.1416478827720; Thu, 20 Nov 2014 02:20:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.170 with SMTP id p10ls44516lal.35.gmail; Thu, 20 Nov 2014 02:20:27 -0800 (PST) X-Received: by 10.152.22.135 with SMTP id d7mr10371523laf.46.1416478827354; Thu, 20 Nov 2014 02:20:27 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id x7si727168lag.84.2014.11.20.02.20.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 02:20:27 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id w7so2024352lbi.33 for ; Thu, 20 Nov 2014 02:20:27 -0800 (PST) X-Received: by 10.112.45.102 with SMTP id l6mr10428204lbm.46.1416478827048; Thu, 20 Nov 2014 02:20:27 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp236479lbc; Thu, 20 Nov 2014 02:20:26 -0800 (PST) X-Received: by 10.68.68.227 with SMTP id z3mr33276298pbt.3.1416478825538; Thu, 20 Nov 2014 02:20:25 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sy6si1455164pab.136.2014.11.20.02.19.55 for ; Thu, 20 Nov 2014 02:20:25 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757451AbaKTKTx (ORCPT + 26 others); Thu, 20 Nov 2014 05:19:53 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:48659 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575AbaKTKTu (ORCPT ); Thu, 20 Nov 2014 05:19:50 -0500 Received: by mail-wg0-f48.google.com with SMTP id y19so3241437wgg.21 for ; Thu, 20 Nov 2014 02:19:49 -0800 (PST) X-Received: by 10.180.86.38 with SMTP id m6mr13863230wiz.65.1416478789108; Thu, 20 Nov 2014 02:19:49 -0800 (PST) Received: from trevor.secretlab.ca (host86-166-84-117.range86-166.btcentralplus.com. [86.166.84.117]) by mx.google.com with ESMTPSA id lp14sm3388942wic.20.2014.11.20.02.19.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Nov 2014 02:19:48 -0800 (PST) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 75D26C40FAA; Thu, 20 Nov 2014 10:19:44 +0000 (GMT) From: Grant Likely To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Grant Likely , Rob Herring , Pantelis Antoniou , Pawel Moll Subject: [PATCH] of: Properly set the OF_POPULATED_BUS flag on root node Date: Thu, 20 Nov 2014 10:19:42 +0000 Message-Id: <1416478782-5351-1-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grant.likely@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , of_platform_populate() takes a subset of the device tree and turns it into a set of platform_devices. At the same time it sets the OF_POPULATED_BUS flag in each bus nodes so that of_platform_depopulate() can undo the operation at a later time. However, it doesn't set the flag on the root of the population tree which means that dynamic modifications of the device tree at runtime will not create/destroy devices correctly. Fix of_platform_populate() to set the OF_POPULATED_BUS flag on the node it is called with. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Pantelis Antoniou Cc: Pawel Moll --- drivers/of/platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 770a8e0a14f2..69f6dff85d15 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -500,6 +500,7 @@ int of_platform_populate(struct device_node *root, if (rc) break; } + of_node_set_flag(root, OF_POPULATED_BUS); of_node_put(root); return rc; @@ -542,7 +543,10 @@ static int of_platform_device_destroy(struct device *dev, void *data) */ void of_platform_depopulate(struct device *parent) { - device_for_each_child(parent, NULL, of_platform_device_destroy); + if (parent->of_node && of_node_check_flag(parent->of_node, OF_POPULATED_BUS)) { + device_for_each_child(parent, NULL, of_platform_device_destroy); + of_node_clear_flag(parent->of_node, OF_POPULATED_BUS); + } } EXPORT_SYMBOL_GPL(of_platform_depopulate);