From patchwork Mon May 26 14:58:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 4243091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3C6BE9F1E7 for ; Mon, 26 May 2014 15:01:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 508652017D for ; Mon, 26 May 2014 15:01:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CD4B20121 for ; Mon, 26 May 2014 15:01:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WowMh-0002wI-So; Mon, 26 May 2014 14:59:03 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WowMe-0002k8-2J for linux-arm-kernel@lists.infradead.org; Mon, 26 May 2014 14:59:00 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 9B70A97B; Mon, 26 May 2014 16:58:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost.localdomain (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id F0BB08B1; Mon, 26 May 2014 16:58:39 +0200 (CEST) From: Boris BREZILLON To: Samuel Ortiz , Lee Jones , Liam Girdwood , Mark Brown Subject: [PATCH v2 4/5] regulator: axp20x: reset probe data before each probe Date: Mon, 26 May 2014 16:58:11 +0200 Message-Id: <1401116292-24066-5-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401116292-24066-1-git-send-email-boris.brezillon@free-electrons.com> References: <1401116292-24066-1-git-send-email-boris.brezillon@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140526_075900_296299_B803A916 X-CRM114-Status: GOOD ( 12.84 ) X-Spam-Score: 0.3 (/) Cc: Boris BREZILLON , dev@linux-sunxi.org, linux-kernel@vger.kernel.org, Shuge , Carlo Caione , Maxime Ripard , kevin@allwinnertech.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The init_data and of_node fields of the axp2xx_matches tables are filled at each device probe by the axp20x_regulator_parse_dt function (which then calls the of_regulator_match function). This means we can probe a new device and consider data initialized during the probe of another device as valid. Reset init_data and of_node field to NULL before each probe in order to avoid this kind of issue. Signed-off-by: Boris BREZILLON --- drivers/regulator/axp20x-regulator.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index feaa0b5..4486517 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -323,6 +323,15 @@ static int axp20x_regulator_probe(struct platform_device *pdev) nregulators = AXP20X_REG_ID_MAX; } + /* + * Reset matches table (this table might have been modified by a + * previous AXP2xx device probe). + */ + for (i = 0; i < nmatches; i++) { + matches[i].init_data = NULL; + matches[i].of_node = NULL; + } + ret = axp20x_regulator_parse_dt(pdev, matches, nmatches); if (ret) return ret;