Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3499777imb; Tue, 5 Mar 2019 10:55:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxEkEGKShMe5u1z0xQekxKX5Gush/dMLzrfWkS8f7+5WmVshAKKY7NeEOGJprrQk6j7MCAR X-Received: by 2002:a63:2f47:: with SMTP id v68mr2671644pgv.144.1551812120280; Tue, 05 Mar 2019 10:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551812120; cv=none; d=google.com; s=arc-20160816; b=ll8r50sDU/E0iZpYLzy66aVxTj94yr+ThX8UuWCgbak4lT8qRA3FVi9cg0btKIhleC T0ACfyqcF7af3ne7tBkL3HoYxYvFjopx5aAaeiCJyCkPgYOp0SO7LQ0wVJlIWs+G5gea d4XFfJics9/q2YhWpGHbFxllVEDjXZz+Nk8EM62RyinzqX0rMYBfb1Cgjdd+tlDUT4Sj YaP8dAPHQk8s0VCFZf+w0b4U9iuaC6GH+cjGbhePitjS9ggbLEsB00bxEjA8luoP+dl0 4OWvtIPIcfsrU7TcUexCu+DZu8WiKC41lduFlg5HEkPmGSsKmPZtAzsQUqw6Z8w/rPUZ v3qg== 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=9AVKrMVhgd+Y5YUV5+yFVp9f8fMc154jfBtUn1TXe2Y=; b=qGldCZByoKsPm+fBSmzpt6c2aIHM2XDi2mMxvwv39DrD58aWpkLBUqpCdmjU4igv99 P78hzu7ThM5/B4NUahE0RQKLwApRgdgG6+IExDNOS3xr1S7yP/tvb2RDCxqvf6rtwOSk m2hkCCj0stUayL2o9rIOqt/S7MY5NMfTtJbVXN3qOTiZg9tT8snZTHIYpRkrKgSRJyqZ 2U56iLMLYph76rYbPbLKQVM6PPWHDlChwckF3T116rnZ2R1Co4QfSRuRwxEUmf/WebOE eWe0S2raPmmPh4S8jdhJE3gcQyRZQdYO4TEd+Bog2TWYrl0I0NlelbWP5Do0KCr2eN7i 1zTQ== 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 c11si8429288pgj.283.2019.03.05.10.55.05; Tue, 05 Mar 2019 10:55:20 -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 S1730929AbfCESIk (ORCPT + 99 others); Tue, 5 Mar 2019 13:08:40 -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 S1730891AbfCESIe (ORCPT ); Tue, 5 Mar 2019 13:08:34 -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 27/6E-26211-D1BBE7C5; Tue, 05 Mar 2019 18:08:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRWlGSWpSXmKPExsVy8IPnUV3Z3XU xBkdSLaY+fMJm8e1KB5PF5V1z2Cw+v9/P6sDisXPWXXaPTas62Tymz/nP6PF5k1wASxRrZl5S fkUCa8aKibuYCqbwVKzdc429gXEDVxcjF4eQwDpGiSvndrB3MXICORUSGw6fZO1i5ODgFUiWu NBWDRLmFHCUONi7jhWixEGi8fZfNhCbTcBQYt6b94wgNouAqsTKWZvA4sICnhKP5j0CGyki4C HRun0DM8guZoE+RonN5y+AFfEKCEqcnPmEBcRmFpCQOPjiBTPIXiEBLYnlxyJBwhIC9hLT318 FC0sI6Es0HouFCBtKfJ/1jQXCNpe4vfoB6wRGwVlIhs5CMnQBI9MqRoukosz0jJLcxMwcXUMD A11DQyNdQ0tjXSNjE73EKt1EvdRS3fLU4hJdQ73E8mK94src5JwUvbzUkk2MwJBPKTj4agfjr hXphxglOZiURHk7d9XFCPEl5adUZiQWZ8QXleakFh9ilOHgUJLgdQDJCRalpqdWpGXmAKMPJi 3BwaMkwlsOkuYtLkjMLc5Mh0idYtTlOL3w4VxmIZa8/LxUKXHeUzuBigRAijJK8+BGwBLBJUZ ZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErCvNUgq3gy80rgNr0COoIJ6IjPl6tBjihJREhJNTD6 1l7p3c2w6v8Li5oC95uhdx9oXpspeVNnucrHf9UFAZN+7j3sZG74TvjDrK1eTisunjTMWMH5s fCNd5795dgf9rMDJmzc8WLJy9oP57+ocWa9szhqx3HvkfKtiZnrLjFeqZQ9dYLznGR2veItU5 UJ3i/fX2XMVSx8te23z6aMx8z7AiZMnvB/uRJLcUaioRZzUXEiABeECjT/AgAA X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-20.tower-262.messagelabs.com!1551809306!2441267!13 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 30328 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 425883FC15; Tue, 5 Mar 2019 18:08:25 +0000 (GMT) Message-ID: <08948a3fe926ba9fbae124fa972df766820d3289.1551808797.git.stwiss.opensource@diasemi.com> In-Reply-To: References: From: Steve Twiss Date: Tue, 26 Feb 2019 15:48:46 +0000 Subject: [PATCH 11/13] regulator: wm831x: Fix notifier mutex lock warning To: Liam Girdwood , Mark Brown CC: Support Opensource , LKML , Cirrus Patches 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: e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss --- drivers/regulator/wm831x-dcdc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 5a5bc4b..4f5461a 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c @@ -183,9 +183,11 @@ static irqreturn_t wm831x_dcdc_uv_irq(int irq, void *data) { struct wm831x_dcdc *dcdc = data; + regulator_lock(dcdc->regulator); regulator_notifier_call_chain(dcdc->regulator, REGULATOR_EVENT_UNDER_VOLTAGE, NULL); + regulator_unlock(dcdc->regulator); return IRQ_HANDLED; } @@ -194,9 +196,11 @@ static irqreturn_t wm831x_dcdc_oc_irq(int irq, void *data) { struct wm831x_dcdc *dcdc = data; + regulator_lock(dcdc->regulator); regulator_notifier_call_chain(dcdc->regulator, REGULATOR_EVENT_OVER_CURRENT, NULL); + regulator_unlock(dcdc->regulator); return IRQ_HANDLED; } -- 1.9.3