Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3499841imb; Tue, 5 Mar 2019 10:55:28 -0800 (PST) X-Google-Smtp-Source: APXvYqy7//493fAwL+tUojMAia81x9dbaKlahvTYA962iM1TeIoRD4CJn3Ca7Ms5TmbZSzDak/dG X-Received: by 2002:a17:902:846:: with SMTP id 64mr2693628plk.266.1551812128547; Tue, 05 Mar 2019 10:55:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551812128; cv=none; d=google.com; s=arc-20160816; b=JStpFSleCp4g5kR9yA7ker32/Xz6n10p2m0uKdx4FJnmiUJd9HXuRMVLcLmUa4MfOa zkyEwOwH9/X2vE+VIDlflPsl1pssMWbAm+/om3fr3aGEN1VCDOzNz6pbZYMQnVXw+r1b a2kvk3Tn5pBNwK9DR/TKIdnbOlIqSas2KpV4nmJJmJxrwYlpFuS+YfLzlXAfnNBQ3Ru7 IkvfMiQHXd722KJBE1tp/jXl3G8eYv9NVvA6cdaK2QLyNPrkCIQVn4cy6iSX17OvoKby NNayGeHJmIS0RwK9rVHKei/j0RJX0JvYk2B6Br1sk0TI5ZR30CowUNCCtxwMvKleI64+ 3zFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:cc:to:subject:date:from :references:in-reply-to:message-id; bh=eWf8KfkjBaFiHmoGqea/d6PZ7nOgoSPAscGKydOzGzM=; b=HkPJvuqN2FtNZx2fqpjFu4SB8M9Gb6fYzw30MKgLbp+xwfBY4mfOtTXqv2OTEoy1Et DsX4kHH8eyEA/n8Yx8D/hYAZqFZVAh8L6gGX0IUPCItQn/2MUcxIxrpPhHlXDoAFgg36 RWKRtTunVF2tVYyD14I1vBIChh3mSCaHAskBFSfvkNwhO2bm9NY/XtOKEKGcDMhwzrXy k9vpndw4+47DrKhwgvB8N2dXKXKPAnZs/4KJdJKg2l5WAffQB7HfM0MJv5l5wtor69jl gIRJGiY7W+nv0xasAD4q5YBmpBtMWyCVfSIGaVP0XQ8lfW3zwX3zRe5h+0nXXQ7CV0Fg 0twA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=diasemi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 139si8307411pga.219.2019.03.05.10.55.13; Tue, 05 Mar 2019 10:55:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=diasemi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730906AbfCESIg (ORCPT + 99 others); Tue, 5 Mar 2019 13:08:36 -0500 Received: from mail1.bemta25.messagelabs.com ([195.245.230.3]:24953 "EHLO mail1.bemta25.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730872AbfCESIc (ORCPT ); Tue, 5 Mar 2019 13:08:32 -0500 Received: from [46.226.52.98] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-a.eu-west-1.aws.symcld.net id 22/6E-26211-C1BBE7C5; Tue, 05 Mar 2019 18:08:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRWlGSWpSXmKPExsVy8IPnUV2Z3XU xBjsWS1hMffiEzeLblQ4mi8u75rA5MHvsnHWX3WPTqk42j8+b5AKYo1gz85LyKxJYMzadqirY zVtxfUc3ewPjdO4uRi4OIYF1jBJXzu1g72LkBHIqJJY2LmYBsXkFkiVevTkPFucUcJQ42LuOF aLGQaLx9l82EJtNwFBi3pv3jCA2i4CqxO8Vv8FsYQEviXvvL4PViAh4SLRu38AMYjMLxEqcn7 cUar6gxMmZT1gg4hISB1+8AKrhAJqvJbH8WCRIWELAXmL6+6tgYQkBfYnGY7EQYUOJ77O+sUD Y5hK3Vz9gncAoOAvJ0FlIhi5gZFrFaJFUlJmeUZKbmJmja2hgoGtoaKRraAnEFuZ6iVW6iXqp pbrlqcUluoZ6ieXFesWVuck5KXp5qSWbGIHhnVJwYPcOxvdd6YcYJTmYlER5O3fVxQjxJeWnV GYkFmfEF5XmpBYfYpTh4FCS4HUAyQkWpaanVqRl5gAjDSYtwcGjJMJbDpLmLS5IzC3OTIdInW LU5Ti98OFcZiGWvPy8VClx3lM7gYoEQIoySvPgRsCi/hKjrJQwLyMDA4MQT0FqUW5mCar8K0Z xDkYlYd5qkFU8mXklcJteAR3BBHTE58vVIEeUJCKkpBoYj1hpHVIJdhDV9jsdNm/y/y7bBZ0r 9BKtq9dXc+29+OJUWGtxRtV8MX5nv/7pR9pyJe7Zm5iuVdG8x9OdeuHUxwcvrTyjuTTF+mPSJ YJ+rdlgI7LAuOSL1x3m1gZP7s6T6leSL6VrMKvpLUiUVYn8wGqlXjRlJW/Wlj/G+VN6pQKUbn lNLVdiKc5INNRiLipOBAAk7tZM9QIAAA== X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-20.tower-262.messagelabs.com!1551809306!2441267!10 X-Originating-IP: [193.240.73.197] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.31.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30277 invoked from network); 5 Mar 2019 18:08:28 -0000 Received: from unknown (HELO sw-ex-cashub01.diasemi.com) (193.240.73.197) by server-20.tower-262.messagelabs.com with AES128-SHA256 encrypted SMTP; 5 Mar 2019 18:08:28 -0000 Received: from swsrvapps-01.diasemi.com (10.20.28.141) by SW-EX-CASHUB01.diasemi.com (10.20.16.140) with Microsoft SMTP Server id 14.3.408.0; Tue, 5 Mar 2019 18:08:27 +0000 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22547) id 3FDFE3FC14; Tue, 5 Mar 2019 18:08:25 +0000 (GMT) Message-ID: <0e0ffab52b8defcccf8b64ac3f0badbc9dacfcda.1551808797.git.stwiss.opensource@diasemi.com> In-Reply-To: References: From: Steve Twiss Date: Tue, 26 Feb 2019 15:46:55 +0000 Subject: [PATCH 10/13] regulator: pv88090: Fix notifier mutex lock warning To: Liam Girdwood , Mark Brown CC: Support Opensource , LKML MIME-Version: 1.0 Content-Type: text/plain X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-ServerInfo: sw-ex-cashub01.diasemi.com, 9 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 05/03/2019 17:23:00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function. Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API. Fixes: c90456e36d9c ("regulator: pv88090: new regulator driver") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss --- drivers/regulator/pv88090-regulator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index 7a0c159..b4ff646 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c @@ -274,9 +274,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) if (reg_val & PV88090_E_VDD_FLT) { for (i = 0; i < PV88090_MAX_REGULATORS; i++) { if (chip->rdev[i] != NULL) { + regulator_lock(chip->rdev[i]); regulator_notifier_call_chain(chip->rdev[i], REGULATOR_EVENT_UNDER_VOLTAGE, NULL); + regulator_unlock(chip->rdev[i]); } } @@ -291,9 +293,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) if (reg_val & PV88090_E_OVER_TEMP) { for (i = 0; i < PV88090_MAX_REGULATORS; i++) { if (chip->rdev[i] != NULL) { + regulator_lock(chip->rdev[i]); regulator_notifier_call_chain(chip->rdev[i], REGULATOR_EVENT_OVER_TEMP, NULL); + regulator_unlock(chip->rdev[i]); } } -- 1.9.3