Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3522218imb; Tue, 5 Mar 2019 11:31:58 -0800 (PST) X-Google-Smtp-Source: APXvYqywVosrLKpAc1AmuIUdHTY86cquX1hP4R8iwqdbGrTsdlGWpA7wp1Fm1We9/ZsuxqOg8PUR X-Received: by 2002:a17:902:6686:: with SMTP id e6mr2895306plk.208.1551814318233; Tue, 05 Mar 2019 11:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551814318; cv=none; d=google.com; s=arc-20160816; b=IJPrB2zbLWbmQotSwPJJCxRw+EbThyBTkaNzgCqsmszr9FT0/no2x9rBc1Y5XPglEx RpKQRtTp06hQRQcAMuOmqbyiZUGthYiqfxXOZkK+sYN86qXmoI/n2rXaaFr3o2gwrKae pBhE3S5O2sn2PS9chkgmidB1xzdrpBnkP5E0fF74IrbxzHf5/NiLrSErABT6JnPaVGZk pTm0LdZ1vt3CwhgzrQS59o1yGYXkDpperL1qGWESYcpTnqQLCDK72g280HkUkAfIBC7p 2D4Olobt5pyBdrALZt7sydQvKt+0v4X9BLlEw35xDuTPafWdyYR3rcawMJkcX9lx+vpD hDdw== 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=TfKrcOYkGYSeTnsfRiBa+c1l3Yhez0avrFEaAOlvN3U=; b=ANfBTIZWrYGnknGRKY3KGrU9GAeDbudA3ORhUp/AeC4Eb9T32e/X8iAzW2jrTEPD6E ItWBD7I7Qc65rJhTeqnbDO5fvBWVd2U10jp/e4RQkrn+KqHozxQ7/O6rcIYUIwlTBWNt 95ReeLFtHC7K0z3Ws9OwdTptQbRjrqhOfO8JW/40EE/W3X8B9O5DGoilUiCPxmB/rhVC x7QRbIz1GoRExh5excxAVsZFzfzoebW2CRSe0fzKEM8V0dZ7+M8l5UdB0IcyMIpu7GSD cAtoUSMCrMVfixMzVvVvm6tK0GiZ1tWabgh46rEP+TAck2hQ6szb5v03EL5cgDJsBtXd Qi9A== 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 i10si8751160pfj.186.2019.03.05.11.31.42; Tue, 05 Mar 2019 11:31:58 -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 S1730985AbfCESJN (ORCPT + 99 others); Tue, 5 Mar 2019 13:09:13 -0500 Received: from mail1.bemta25.messagelabs.com ([195.245.230.2]:11250 "EHLO mail1.bemta25.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730854AbfCESIc (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-2.bemta.az-a.eu-west-1.aws.symcld.net id 96/2D-18573-C1BBE7C5; Tue, 05 Mar 2019 18:08:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRWlGSWpSXmKPExsVy8IPnUV2Z3XU xBkcX8VpMffiEzeLblQ4mi8u75rA5MHvsnHWX3WPTqk42j8+b5AKYo1gz85LyKxJYMy7N6Gcs mM9bMf3NfPYGxuncXYxcHEIC6xglljXMYO9i5ARyKiT2P2pmBrF5BZIl/i7eARbnFHCUONi7j hWixkGi8fZfNhCbTcBQYt6b94wgNouAqsTi1hksILawgJfEjx/9YHNEBDwkWrdvALOZBWIlzs 9bygIxX1Di5MwnLBBxCYmDL14A1XAAzdeSWH4sEiQsIWAvMf39VbCwhIC+ROOxWIiwocT3Wd9 YIGxzidurH7BOYBSchWToLCRDFzAyrWK0SCrKTM8oyU3MzNE1NDDQNTQ00jW0NNY1MjbRS6zS TdRLLdUtTy0u0TXUSywv1iuuzE3OSdHLSy3ZxAgM8JSCg692MO5akX6IUZKDSUmUt3NXXYwQX 1J+SmVGYnFGfFFpTmrxIUYZDg4lCV4HkJxgUWp6akVaZg4w1mDSEhw8SiK85SBp3uKCxNzizH SI1ClGXY7TCx/OZRZiycvPS5US5z21E6hIAKQoozQPbgQs7i8xykoJ8zIyMDAI8RSkFuVmlqD Kv2IU52BUEuatBlnFk5lXArfpFdARTEBHfL5cDXJESSJCSqqBMb9z+b9npvHKx7/a/zn3NH6l FEuB7KSZTAufLPU1vaFn6yTOMGfZo+M77/zosZMUWFJuqbXbpkd/+qtOxc8W8vqfgySFxAWXc Mq+0eC1n9F0tzp/U1XQgYpm47rHC+9emLmhyNHvuvSFWZO73ZbsEf7fuXKl6trXG/7ZbfPX/r yCO6v0ajCTjhJLcUaioRZzUXEiAI0B9Rr2AgAA X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-20.tower-262.messagelabs.com!1551809306!2441267!9 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 30236 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:26 +0000 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22547) id 3AC633FC12; Tue, 5 Mar 2019 18:08:25 +0000 (GMT) Message-ID: <2f9f4986527b5c9784b4ad19f0b07543be6f97d5.1551808797.git.stwiss.opensource@diasemi.com> In-Reply-To: References: From: Steve Twiss Date: Tue, 26 Feb 2019 15:42:50 +0000 Subject: [PATCH 08/13] regulator: pv88060: 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: f307a7e9b7af ("regulator: pv88060: new regulator driver") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss --- drivers/regulator/pv88060-regulator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c index a944605..000c349 100644 --- a/drivers/regulator/pv88060-regulator.c +++ b/drivers/regulator/pv88060-regulator.c @@ -276,9 +276,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data) if (reg_val & PV88060_E_VDD_FLT) { for (i = 0; i < PV88060_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]); } } @@ -293,9 +295,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data) if (reg_val & PV88060_E_OVER_TEMP) { for (i = 0; i < PV88060_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