Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3522229imb; Tue, 5 Mar 2019 11:31:59 -0800 (PST) X-Google-Smtp-Source: APXvYqzk07gqn6xlrcpeOcqXfjDcs7ASQsXTzNQ1hPo31VrDZeabozGoi9+Pr1umyz7/U4uVcNAJ X-Received: by 2002:a63:1925:: with SMTP id z37mr2815838pgl.67.1551814319032; Tue, 05 Mar 2019 11:31:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551814319; cv=none; d=google.com; s=arc-20160816; b=Q1F3gdbrJSmZWSPFXAXLjIQDEPNdU8gqQaeBZDU8yL1JDadqyzyB0/0vRIHgXug8MT BiK93kiXqxxk3IlE8IQuURpdJIt6jfJ1DNQAGqiO5NVeWUNWmPh/7io55PwvMZJPNOIr jfcVWqhqWSLKxOOepWx0Z0UIC+QNijEC0dxG1woMw1HbkYIzwVxW9eSah0M8R8GaOCer HEe0YC1ksQF01VPHwRiDKIAFqhs+0bTDCRX9yKEcltPseR/JkWZ0p/J4ZIFxqHN9LocT mzMxJaeGsrgU1oEqEFlBJVs+t+aBZS6MR0vsPS1VkCPWSlSRQamf7a6pAsjvu5lVTcGL GpGw== 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=CvqZYPDNEnd6bgZf9Bm4y/49a8UBuvPqyXENyph2QXM=; b=jgUId7tTqmvN4XMrNfZQtcf6tDPYg4idBXdJIdAZRW13m5QRJwwuLtSPQQkfoMxBGT Ug/fK4EOnPpdCuKoKeA1wa+gYG6e+lHXs0lDtnEKKrAoKrNVntYiI1D9sVYEhxqh3k1N LSSdfTYV7YM8XIou/P3JamuhMs+C+dOT7kuph/cwJZSTwzWUFN1lNNVAdS7JwkNAe5Ch ly8e06o4kfRxUgiMbIIDE22NAw3fnAHk8lfXJth3Tl9axJAqFFMhVAI+0ka406qWywd9 faCFVJ9b0QzZiMHX+R18c9Qjltv8P9uM2qydGrV3urxqqZuY7ihxBsBkE4kOQzUcnjd8 gIvg== 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 p17si8687702pgg.259.2019.03.05.11.31.43; Tue, 05 Mar 2019 11:31:59 -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 S1730997AbfCESJV (ORCPT + 99 others); Tue, 5 Mar 2019 13:09:21 -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 S1726643AbfCESIb (ORCPT ); Tue, 5 Mar 2019 13:08:31 -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 C0/C0-19701-B1BBE7C5; Tue, 05 Mar 2019 18:08:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRWlGSWpSXmKPExsVy8IPnUV3p3XU xBovO8FtMffiEzeLblQ4mi8u75rA5MHvsnHWX3WPTqk42j8+b5AKYo1gz85LyKxJYM56uuM5S 8IerYlP/daYGxp2cXYxcHEIC6xglvr97x9zFyAnkVEg8mLSABcTmFUiWOPjuLTuIzSngKHGwd x0rRI2DROPtv2wgNpuAocS8N+8Zuxg5OFgEVCUOHsgGCQsLeEq8+NUKViIi4CHRun0D2HhmgV iJ8/OWQo0XlDg58wkLRFxC4uCLF8wgY4QEtCSWH4sECUsI2EtMf38VLCwhoC/ReCwWImwo8X3 WNxYI21zi9uoHrBMYBWchGToLydAFjEyrGC2SijLTM0pyEzNzdA0NDHQNDY10DS2B2MJcL7FK N1EvtVS3PLW4RNdQL7G8WK+4Mjc5J0UvL7VkEyMwvFMKDuzewfi+K/0QoyQHk5Iob+euuhghv qT8lMqMxOKM+KLSnNTiQ4wyHBxKErwOIDnBotT01Iq0zBxgpMGkJTh4lER4y0HSvMUFibnFme kQqVOMuhynFz6cyyzEkpeflyolzntqJ1CRAEhRRmke3AhY1F9ilJUS5mVkYGAQ4ilILcrNLEG Vf8UozsGoJMxbDbKKJzOvBG7TK6AjmICO+Hy5GuSIkkSElFQDY3A7x5GioLdd/74+OPbikEz7 QdN9Z//O2veU+efvqfMZFhXJur9c0ab48+xVh1Vq4otninboxcZWfJwdvjeX+4BzgZFhldveV zWXo4x8FEU3vXg6735KC0tTxbGW3XG7twWLFzdNfWrRviDzkV6Z2x7Jyd6V3D7LNc5P6TkeKC 2T/GHhQaUpB5VYijMSDbWYi4oTAXl/yxT1AgAA X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-20.tower-262.messagelabs.com!1551809306!2441267!4 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 30154 invoked from network); 5 Mar 2019 18:08:27 -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:27 -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:25 +0000 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22547) id 2E08C3FBEC; Tue, 5 Mar 2019 18:08:25 +0000 (GMT) Message-ID: <1215fdadbb4fceb0a500102dbcc69df79e685875.1551808797.git.stwiss.opensource@diasemi.com> In-Reply-To: References: From: Steve Twiss Date: Tue, 26 Feb 2019 15:23:02 +0000 Subject: [PATCH 03/13] regulator: da9063: 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: 69ca3e58d178 ("regulator: da9063: Add Dialog DA9063 voltage regulators support.") Suggested-by: Adam Thomson Signed-off-by: Steve Twiss --- drivers/regulator/da9063-regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 8cbcd2a..d3ea73a 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -615,9 +615,12 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data) if (regl->info->oc_event.reg != DA9063_REG_STATUS_D) continue; - if (BIT(regl->info->oc_event.lsb) & bits) + if (BIT(regl->info->oc_event.lsb) & bits) { + regulator_lock(regl->rdev); regulator_notifier_call_chain(regl->rdev, REGULATOR_EVENT_OVER_CURRENT, NULL); + regulator_unlock(regl->rdev); + } } return IRQ_HANDLED; -- 1.9.3