From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFA70C433E9 for ; Thu, 21 Jan 2021 07:20:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93EC62389B for ; Thu, 21 Jan 2021 07:20:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727245AbhAUHUB (ORCPT ); Thu, 21 Jan 2021 02:20:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:39918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbhAUHTJ (ORCPT ); Thu, 21 Jan 2021 02:19:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1BA6E2389B; Thu, 21 Jan 2021 07:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611213508; bh=PGUSgFawbeGNKLqlR2hZt2YgAv8hjjVilpqNUkuQq1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRqVLkbkyAzuild0XRGrkLvK7YrG22opL+jsKA0p+d5Eu+POIND2culba9PCnIyXR E0jEhvpgUGVLllM4RLuopSxTeaw6NfCdBmjnVnf738vlG8K1W6k1eZeceSgzXOKi/C WrJDzJ+v3Dr3Ugs9NMk2lHMNmcca5Su6CoUcMIhiatesNkufK+nj0QXKxcH1gss0dJ x3ujyEmFgzxD6xsXWTHfT5C97C45Wy/QxKtVnBLq1Ko/ZKi0GHLdDTIryfeeWougWS rtFMy9fqgQvalPDl23dVipfXm7dDm4QCy2Ko5TV66lpBL/diC0Q5FFrH9c5xSS4NBN ddxFS6o7TtEoA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1l2UEb-004Bs8-G7; Thu, 21 Jan 2021 08:18:25 +0100 From: Mauro Carvalho Chehab To: Mark Brown , Lee Jones Cc: Mauro Carvalho Chehab , Greg Kroah-Hartman , Mayulong , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 07/21] staging: hikey9xx: hi6421v600-regulator: get rid of an static data Date: Thu, 21 Jan 2021 08:18:09 +0100 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move it to be inside the private data struct. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/hikey9xx/hi6421v600-regulator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/hikey9xx/hi6421v600-regulator.c b/drivers/staging/hikey9xx/hi6421v600-regulator.c index 54ad07418ec2..e25e596f58cf 100644 --- a/drivers/staging/hikey9xx/hi6421v600-regulator.c +++ b/drivers/staging/hikey9xx/hi6421v600-regulator.c @@ -28,9 +28,10 @@ struct hi6421_spmi_reg_info { struct hi6421_spmi_pmic *pmic; u8 eco_mode_mask; u32 eco_uA; -}; -static DEFINE_MUTEX(enable_mutex); + /* Serialize regulator enable logic */ + struct mutex enable_mutex; +}; static const unsigned int ldo3_voltages[] = { 1500000, 1550000, 1600000, 1650000, @@ -118,7 +119,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) struct hi6421_spmi_pmic *pmic = sreg->pmic; /* cannot enable more than one regulator at one time */ - mutex_lock(&enable_mutex); + mutex_lock(&sreg->enable_mutex); usleep_range(HISI_REGS_ENA_PROTECT_TIME, HISI_REGS_ENA_PROTECT_TIME + 1000); @@ -127,7 +128,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) rdev->desc->enable_mask, rdev->desc->enable_mask); - mutex_unlock(&enable_mutex); + mutex_unlock(&sreg->enable_mutex); return 0; } @@ -312,6 +313,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) return -ENOMEM; sreg->pmic = pmic; + mutex_init(&sreg->enable_mutex); for (i = 0; i < ARRAY_SIZE(regulator_info); i++) { /* assign per-regulator data */ -- 2.29.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D099C433E6 for ; Thu, 21 Jan 2021 07:18:35 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E495C239EF for ; Thu, 21 Jan 2021 07:18:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E495C239EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 63E0886CF9; Thu, 21 Jan 2021 07:18:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PNgPcLSr6-3E; Thu, 21 Jan 2021 07:18:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B509E86D06; Thu, 21 Jan 2021 07:18:33 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 3E0C51BF873 for ; Thu, 21 Jan 2021 07:18:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2E48C871B5 for ; Thu, 21 Jan 2021 07:18:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DWxE5PTXgxh5 for ; Thu, 21 Jan 2021 07:18:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by hemlock.osuosl.org (Postfix) with ESMTPS id D3B29871AD for ; Thu, 21 Jan 2021 07:18:28 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1BA6E2389B; Thu, 21 Jan 2021 07:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611213508; bh=PGUSgFawbeGNKLqlR2hZt2YgAv8hjjVilpqNUkuQq1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRqVLkbkyAzuild0XRGrkLvK7YrG22opL+jsKA0p+d5Eu+POIND2culba9PCnIyXR E0jEhvpgUGVLllM4RLuopSxTeaw6NfCdBmjnVnf738vlG8K1W6k1eZeceSgzXOKi/C WrJDzJ+v3Dr3Ugs9NMk2lHMNmcca5Su6CoUcMIhiatesNkufK+nj0QXKxcH1gss0dJ x3ujyEmFgzxD6xsXWTHfT5C97C45Wy/QxKtVnBLq1Ko/ZKi0GHLdDTIryfeeWougWS rtFMy9fqgQvalPDl23dVipfXm7dDm4QCy2Ko5TV66lpBL/diC0Q5FFrH9c5xSS4NBN ddxFS6o7TtEoA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1l2UEb-004Bs8-G7; Thu, 21 Jan 2021 08:18:25 +0100 From: Mauro Carvalho Chehab To: Mark Brown , Lee Jones Subject: [PATCH v5 07/21] staging: hikey9xx: hi6421v600-regulator: get rid of an static data Date: Thu, 21 Jan 2021 08:18:09 +0100 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Mayulong Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" Move it to be inside the private data struct. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/hikey9xx/hi6421v600-regulator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/hikey9xx/hi6421v600-regulator.c b/drivers/staging/hikey9xx/hi6421v600-regulator.c index 54ad07418ec2..e25e596f58cf 100644 --- a/drivers/staging/hikey9xx/hi6421v600-regulator.c +++ b/drivers/staging/hikey9xx/hi6421v600-regulator.c @@ -28,9 +28,10 @@ struct hi6421_spmi_reg_info { struct hi6421_spmi_pmic *pmic; u8 eco_mode_mask; u32 eco_uA; -}; -static DEFINE_MUTEX(enable_mutex); + /* Serialize regulator enable logic */ + struct mutex enable_mutex; +}; static const unsigned int ldo3_voltages[] = { 1500000, 1550000, 1600000, 1650000, @@ -118,7 +119,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) struct hi6421_spmi_pmic *pmic = sreg->pmic; /* cannot enable more than one regulator at one time */ - mutex_lock(&enable_mutex); + mutex_lock(&sreg->enable_mutex); usleep_range(HISI_REGS_ENA_PROTECT_TIME, HISI_REGS_ENA_PROTECT_TIME + 1000); @@ -127,7 +128,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) rdev->desc->enable_mask, rdev->desc->enable_mask); - mutex_unlock(&enable_mutex); + mutex_unlock(&sreg->enable_mutex); return 0; } @@ -312,6 +313,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) return -ENOMEM; sreg->pmic = pmic; + mutex_init(&sreg->enable_mutex); for (i = 0; i < ARRAY_SIZE(regulator_info); i++) { /* assign per-regulator data */ -- 2.29.2 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel