From patchwork Tue Apr 27 05:36:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12225385 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 427A0C433ED for ; Tue, 27 Apr 2021 05:39:59 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 902C06052B for ; Tue, 27 Apr 2021 05:39:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 902C06052B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HxBCDr1OqWrFo4qrxQDqlXWRcD/EJUzJ5ixEpICkY7g=; b=PzE5DGsPz7w/xTeMTse9kU29X srrt/RmbVTcepcZdWwBZ+QrYDIUbsUZ6e+8CMB+84IjOW6B6mU7JRd407YIgxT3XszGchcYfe2xFp R2qhVnTmboWbL5Z1WAqoDkpO0rCsY6P86nf6/Nk2/KtyZ2wtKZnqNtFaPDs0MLMyBKRsSrVUKz9/D jDYheNTglQB4enSLrAKUWZoH8/DsR7KdIUagsrrbf5msVCs9kli13xvKJ04Ndai/2grOSGD6EyNAl Y4cGH+nqs0M7S0mhtsGfxCUeon7KSsGuOpORdMSVzFP5cFaPWGW2yzo98KZE+HzbbvQKR8mR03+87 oLbKMbfYw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbGQ8-000lJf-2q; Tue, 27 Apr 2021 05:38:04 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbGOi-000l8P-Pr for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 05:36:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=DmgNhZA8y9OcAqQz4ZmmKKT0ZJqTstchwxs60f43ujM=; b=vGW7BfeMggu9ZlTdylKZKFE+8k YL+ZRZz/lPH7boc/oTZcCP5d73EBVhBqN3FlElEhgSQecD0NHxAADFJe0TH92nvSl7UiqDQYqHdzf 5shDKy+TOnN6STE6GJerRFxZ45nsseTV96Keq0Z1psLc7i3GSAXxr2OqyUsfYrQjDlIk7y8lS6wQt AHDMAxQIuk2tT9spHwo5pvFhqLPDNBbOfI+MXQ57xlSaE/a7fTo3oZhXdlg7GBlgQHT1ogYazBm5e 5Lou1HjqwcWxbby1prmaxztMYUFpK29Br35iuMwfnkCsDAM5zsibWL8jMDUVL4V4zW2mpo4pfx+1y 9Nwzhw+g==; Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbGOg-00GSF8-Av for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 05:36:35 +0000 Received: by mail-pf1-x42f.google.com with SMTP id w6so26061752pfc.8 for ; Mon, 26 Apr 2021 22:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DmgNhZA8y9OcAqQz4ZmmKKT0ZJqTstchwxs60f43ujM=; b=WcmtSLpGOQppOkaIFOJglGs6qgpdhC0GBDegcigac4xtnNSkBc9/CcqiQgJ3WbKILE Gs2oyMEkt+e4hyjxptvTbycReZ/0RwvAPQoZlwAZ8sZ8XbK2+xHnKRKUYQC2mDqLEl+w 5J/SbXVbV6dmGGuYilQX3FBKckI+jX+WUcTww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DmgNhZA8y9OcAqQz4ZmmKKT0ZJqTstchwxs60f43ujM=; b=Bn1RIouxVdPr+kjqV57yIn6v57hSrKzuE3ku8BJLYYzy6cFsCX5VmZZJ24lQO9NhhL mh0dU20NoM4ibWMUEzJjNeBsKjW9SsHHyTA1I6Gn/EKFgAPhyfOAE7yCGWYJy6U/fuOU olW9TvplfX4OPJtJM8m+E/fd9L1eyv3er7TcXSMHgdHBZh9ucnp01Dp52ZLn9ifIrBLE DFl0tvEHyWGYoqFg6yhrLHEtMk///IA/FQ/BPvI9fnmIojXSVULpnrDQhIDM9jwT+3Ce wIzu0ZTm7hepBT1hRLe2Qv4y9rptlhMcN2D4nS55ACGNVr9xgIMRokE18ldnoXZtQnBa G48w== X-Gm-Message-State: AOAM532tCtODJWot/UixnvLp2l+Wu8jMQ8d5fAhV725icurMqv0EZFCA wO+pOYc8R272MLjWn1+9lBjX0Q== X-Google-Smtp-Source: ABdhPJyK6HPDL2dVl6Wi0k4rLfJc5+VoFT3tTwCq+4rkqx1pDkHVS+yVt1cvCRJAGH6jG1yUhZdMcQ== X-Received: by 2002:a65:6414:: with SMTP id a20mr19805719pgv.96.1619501793489; Mon, 26 Apr 2021 22:36:33 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:3984:c4f5:8612:6b3e]) by smtp.gmail.com with ESMTPSA id gc15sm993529pjb.2.2021.04.26.22.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 22:36:33 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , Rob Herring , Bartosz Golaszewski Cc: linux-i2c@vger.kernel.org, Qii Wang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Mark Brown , Marek Szyprowski , Bibby Hsieh , Arnd Bergmann Subject: [PATCH v20 4/5] misc: eeprom: at24: check suspend status before disable regulator Date: Tue, 27 Apr 2021 13:36:16 +0800 Message-Id: <20210427053617.27972-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog In-Reply-To: <20210427053617.27972-1-hsinyi@chromium.org> References: <20210427053617.27972-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210426_223634_398049_C1149969 X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org cd5676db0574 ("misc: eeprom: at24: support pm_runtime control") disables regulator in runtime suspend. If runtime suspend is called before regulator disable, it will results in regulator unbalanced disabling. Fixes: cd5676db0574 ("misc: eeprom: at24: support pm_runtime control") Signed-off-by: Hsin-Yi Wang Acked-by: Bartosz Golaszewski --- drivers/misc/eeprom/at24.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 926408b41270..7a6f01ace78a 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client *client) at24->nvmem = devm_nvmem_register(dev, &nvmem_config); if (IS_ERR(at24->nvmem)) { pm_runtime_disable(dev); - regulator_disable(at24->vcc_reg); + if (!pm_runtime_status_suspended(dev)) + regulator_disable(at24->vcc_reg); return PTR_ERR(at24->nvmem); } @@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client *client) err = at24_read(at24, 0, &test_byte, 1); if (err) { pm_runtime_disable(dev); - regulator_disable(at24->vcc_reg); + if (!pm_runtime_status_suspended(dev)) + regulator_disable(at24->vcc_reg); return -ENODEV; }