Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3522189imb; Tue, 5 Mar 2019 11:31:55 -0800 (PST) X-Google-Smtp-Source: APXvYqzLC0tRbn8rH0TY0bcnSHCCKPt0QJfHT7cVRXNrghahWEQmrba+6KPHFqrmi1Qbx4EaPDRl X-Received: by 2002:a17:902:744b:: with SMTP id e11mr2880210plt.220.1551814315511; Tue, 05 Mar 2019 11:31:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551814315; cv=none; d=google.com; s=arc-20160816; b=WMYLHynAMRA3FXGBu+QKfb2gNGjfZz/AxsJiX+Wb0L+dHjNmP0b66K+e4/3aLvh9Va p0IDw5ph9PDIOYUt59XWJuNgTno1NEXbUAavW3j/Ea5S+eppeM5lBOgc+xR9MVi7MoUM sqhJtP265VP6FHX9BC2yUEOM9IopSwyyb2aL1pYBvKBxMxxj+KFOCMU1SFsyXorrCcM8 Ap8hCQePQ3JZkn0ipXjJXvEiw1Vo52kwlRHYLrGjsbS4jZtvvliPz6ZNnYGa1VoaMRGr nBe64xjLUrCHZOF80DsjKQR1RDWAIwJOh2+Zjfeg91h/cnM0AcwRhMPSDZkhRbHWDSCj 36bg== 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=Kjp2CXQ4KsqL0BfCd32qO3i/dEwqFx7WiDhTRPWPLWw=; b=iJwh8Ct9L6nk6aF1xpS2mhm+nRkDuQYS84pAzTPABmOxrw2bmDMQ08F4oazn4brpBb ysWTUm/nK3kpocKyJAw9RpGTnobxmym1ZzaANf+Hs5RwSBDqKbhCBSuMqRYjBOD87QvB 6KrX91GrY3ZNep3oOpCr8cSdIFb9MQLYQstU3O2UNMvOjhSfXlnYbVMgez1c69yB4/HF +XJPcIHPoEZx1c7Kjloa1mTtpxq7SmsDb+qxekHrO/SbMFp/oshxiL5BUZCYqf/9yTjX raqewQjsAtwLWA5izLPSHAlBlPg+vO34hb9eAHznUI/dEvPEXZGrpbjbIYI85kFw8fL7 xmxw== 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 o19si8172323pgv.142.2019.03.05.11.31.40; Tue, 05 Mar 2019 11:31:55 -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 S1730964AbfCESI6 (ORCPT + 99 others); Tue, 5 Mar 2019 13:08:58 -0500 Received: from mail1.bemta25.messagelabs.com ([195.245.230.1]:23902 "EHLO mail1.bemta25.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbfCESId (ORCPT ); Tue, 5 Mar 2019 13:08:33 -0500 Received: from [46.226.52.98] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-1.bemta.az-a.eu-west-1.aws.symcld.net id 2D/C0-19701-C1BBE7C5; Tue, 05 Mar 2019 18:08:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRWlGSWpSXmKPExsVy8IPnUV2Z3XU xBhOeqVhMffiEzeLblQ4mi8u75rA5MHvsnHWX3WPTqk42j8+b5AKYo1gz85LyKxJYM573PmQs 2M1bseDld8YGxuncXYxcHEIC6xglrpzbwd7FyAnkVEj0TO1nArF5BZIllt/6xgJicwo4ShzsX ccKUeMg0Xj7LxuIzSZgKDHvzXtGEJtFQFWicfEfoF4ODmEBL4npD2VAwiICHhKt2zcwg9jMAr ES5+ctZYEYLyhxcuYTFoi4hMTBFy+YQVqFBLQklh+LBAlLCNhLTH9/FSwsIaAv0XgsFiJsKPF 9FsRhEgLmErdXP2CdwCg4C8nQWUiGLmBkWsVokVSUmZ5RkpuYmaNraGCga2hopGtoCcQW5nqJ VbqJeqmluuWpxSW6hnqJ5cV6xZW5yTkpenmpJZsYgeGdUnBg9w7G913phxglOZiURHk7d9XFC PEl5adUZiQWZ8QXleakFh9ilOHgUJLgdQDJCRalpqdWpGXmACMNJi3BwaMkwlsOkuYtLkjMLc 5Mh0idYtTlOL3w4VxmIZa8/LxUKXHeUzuBigRAijJK8+BGwKL+EqOslDAvIwMDgxBPQWpRbmY JqvwrRnEORiVh3mqQVTyZeSVwm14BHcEEdMTny9UgR5QkIqSkGhg5FRS31f7eaur3XuCru71T 230Zc105UZECYem6NQlF2on/3OdyRZv7G4pPa6iv+DPn+hI+C8uZqlLz72jfqtCfeTvueM28a O60gu9Ldv6JZLXjVnG2TE9rvFLxLTbe5ZhAWnNs1rq6g1nsrFbb49ZvF/ErNJ+w3GKfonjwgr MH389IEq5VUGIpzkg01GIuKk4EACDNLIP1AgAA X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-20.tower-262.messagelabs.com!1551809306!2441267!11 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 30295 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 3D5353FC13; Tue, 5 Mar 2019 18:08:25 +0000 (GMT) Message-ID: <5e20135242879861f22f5cb5fcba0cb481e754cc.1551808797.git.stwiss.opensource@diasemi.com> In-Reply-To: References: From: Steve Twiss Date: Tue, 26 Feb 2019 15:44:54 +0000 Subject: [PATCH 09/13] regulator: pv88080: 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: 99cf3af5e2d5 ("regulator: pv88080: new regulator driver") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss --- drivers/regulator/pv88080-regulator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c index 9a08cb2..d99f1b9 100644 --- a/drivers/regulator/pv88080-regulator.c +++ b/drivers/regulator/pv88080-regulator.c @@ -384,9 +384,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data) if (reg_val & PV88080_E_VDD_FLT) { for (i = 0; i < PV88080_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]); } } @@ -401,9 +403,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data) if (reg_val & PV88080_E_OVER_TEMP) { for (i = 0; i < PV88080_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