Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3678850pxb; Mon, 24 Jan 2022 15:09:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwX2bv4osrNFr/MNyix4zKXTfRRICllOJCJnG/QQ2YVwNmK5PzzdSdEVFgG+2D7w69jQzs8 X-Received: by 2002:a17:902:e804:b0:14b:4ae9:1b4f with SMTP id u4-20020a170902e80400b0014b4ae91b4fmr7452664plg.20.1643065634146; Mon, 24 Jan 2022 15:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065634; cv=none; d=google.com; s=arc-20160816; b=YbaPw7PILeLEZjbY3TSXWLbM4t1Opj/zdM1NnWGWLiGHsqbfTEXJqNzIfnYIMc4E0K hbcKiiATgI3BE4/4/Isf5KZhinj6y9nGR8EWEGoUyHrXNNHfIfp2icAVdn5Gt+yBURhW 3SDtosxkgTabz8YNf8VQTZpiTZmxdTAaqZpOziGy1NHRQEGfXhJ+BTPATlte1kNzxgwf gVRzEeNXCxrP9/bCFcvVO+Bd56KNrKK772+si6sG3nnkiHYBrq471Iomqhsbjs4441ys oQW4MdJ9UVsnyK4SZp/5aJCEkbsRVeUw1HmnhKw0+QVqaRPzcr7KxJ4FZzouQAMOx3mL t14A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gmUfoLBonp2GzQb+ELK9Di2TXy4TXAJI4QD6FiC5gc0=; b=kkWWSvTFGxx1lQRCCFarH99l3+DCCsDLwfWjkJsd7z1huo4/nNuUdb1xhAqMSiEQqR R90ciLk+vOFkDSyr9LQUI14evUs+qtmqc5XuKfcTqgnz6WFIy3kjRZmeFp5JCqeMLHBV 0vWeFgqfxhrLM2W4fzRLtT2cm7NNEsNw434L7N2CkbaIDIKZiWuPELh72f+51O3hozaO x5r3ptJdTDwrqEARIfLaEWbwDUvAA48MAJNlrkKIbnGx6Hfz9qs/1iIvWEHmqG4aZu/8 EDM8aKEI8BOBOWOTbSQ24TKXHGSho283+Yf7gLFSpuRLcj8ghcFIFAlzlf5gaYyk/8sk S14w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wqF44NPH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi6si13782057plb.279.2022.01.24.15.06.32; Mon, 24 Jan 2022 15:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wqF44NPH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1843332AbiAXXDu (ORCPT + 99 others); Mon, 24 Jan 2022 18:03:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458043AbiAXVzG (ORCPT ); Mon, 24 Jan 2022 16:55:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1759FC07E2A7; Mon, 24 Jan 2022 12:36:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AADBC61545; Mon, 24 Jan 2022 20:36:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7031EC340E5; Mon, 24 Jan 2022 20:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056616; bh=AXo2SKIfBrFl+rOiVbbS6B5EIC7YCr/SvPrUDVh/G4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqF44NPHuqswW/pCMu1S4BIyuHPDre4NkbRSDRBFmqMWW2Djc9rCjS+z/xLFC1D7a VTCBtE/mN7C+ba74Xav7YumCIM5x/BU4YPS/578Q6vqMby+s8N77YhiHr545MryloB u21C3ym+Lm6qxtZdJyKGFRBzQcteEvUG3zOj/rRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ward , Mark Brown , Sasha Levin Subject: [PATCH 5.15 510/846] regulator: da9121: Prevent current limit change when enabled Date: Mon, 24 Jan 2022 19:40:27 +0100 Message-Id: <20220124184118.613591302@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adam Ward [ Upstream commit 24f0853228f3b98f1ef08d5824376c69bb8124d2 ] Prevent changing current limit when enabled as a precaution against possibile instability due to tight integration with switching cycle Signed-off-by: Adam Ward Link: https://lore.kernel.org/r/52ee682476004a1736c1e0293358987319c1c415.1638223185.git.Adam.Ward.opensource@diasemi.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/da9121-regulator.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c index e669250902580..0a4fd449c27d1 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -253,6 +253,11 @@ static int da9121_set_current_limit(struct regulator_dev *rdev, goto error; } + if (rdev->desc->ops->is_enabled(rdev)) { + ret = -EBUSY; + goto error; + } + ret = da9121_ceiling_selector(rdev, min_ua, max_ua, &sel); if (ret < 0) goto error; -- 2.34.1