From patchwork Wed Apr 14 17:29:14 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: 12203459 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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 CBCE6C433B4 for ; Wed, 14 Apr 2021 17:33:38 +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 3A1D561164 for ; Wed, 14 Apr 2021 17:33:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A1D561164 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=pyeu+OGOVTdKJXfCaKb0d0spLv3re7OK2h1qp8KxDYY=; b=HE4DAovFF5AJtDfoTaZu7RZQ4 /M30xpeXrvASnLnp2Qx9GAXBPnPMjT7Fg2OzNoAdNe/nVWNyYPVtJx8SGu4JLKCCaPsuO0L+ls8KW HJt4ecqQk03i2vKN10K0GXA91YnktIk77LYOQiUcyZonBqTnYUSlDw+VFhPPs5JisyCnEA1ge0Mev y9hX7heO3swZt+HmHch0Uum2aGvOmtHynJsDGBiW4ftIzSkIO5mU9pNwBSoyL+IU7l6rrjn42Ww2A 1oYSRkjW3eTWvIzkM/JUsfP3QzLF4Uh3Xl9Ix4rB84uoypF2OSvChNZ6cpiOHns0V5fohNSX1V9xS kane7WtCg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWjLw-00DGhT-Oe; Wed, 14 Apr 2021 17:31:01 +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 1lWjKb-00DGRc-EA for linux-arm-kernel@desiato.infradead.org; Wed, 14 Apr 2021 17:29:38 +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=NtcyLr97vt7tBtf+Evf5JrbdU0JuK+5BO0OeaqqfGII=; b=I2LwVfy/z5JOolyJp+wflNB9aU 83hKOobhxVPlo5FQxEepzGNx7lS6e3b+nLZoprERgH3fSmIM5uX7sgrRViTICvqfdONtcZHUA5vIa SGdDJSALJexENSNTOD/mNlSzgx8oVrZZt5VhN+xcwbfUR/c3i8bJWnKKuOxfiVj0QRwFJqkiSOXGw rutxjL7nxJx9oh0//kyMqbmMU7oT4Cv/U/ARdFb441nHPw/ZBnU44UOJCgddc2JjtULiS9/l0gOfv zBrTzBH8RCtPJNlCoizbhhCkQODT7t7tW8divi20GBXBn4x/CsfxwknxQsD9zhQkcLb5T3qn6ps+h RWn6nHcA==; Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWjKY-007yc9-Vn for linux-arm-kernel@lists.infradead.org; Wed, 14 Apr 2021 17:29:36 +0000 Received: by mail-pl1-x630.google.com with SMTP id h20so10528381plr.4 for ; Wed, 14 Apr 2021 10:29:34 -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=NtcyLr97vt7tBtf+Evf5JrbdU0JuK+5BO0OeaqqfGII=; b=U3p66+Be9J9brLNZfLCAa72fmyHRhYkU2dLerndAukBzw9zqH+m1l2LBgLkyJu6/04 s1uRRZ+UJIiAk+qKJDPUqbNlfS9edRSd1TqeoyJPJaOheuKDsALg4RevMCAL+aM1mJni RIbOhRQmnkWslS55DoyiBjiz4r02jbQvoJm18= 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=NtcyLr97vt7tBtf+Evf5JrbdU0JuK+5BO0OeaqqfGII=; b=Ed4GjGremOSD94Y5QcdeXXriM3gx422XztLJuMVkiZ5dzS8pEXRiLlz4ElMDC9x/yc /y8rdnrZYKv3g0sTAiyvC/fk8Yt+vFAvvezP/mZH/kNprw2+nDBE96qdIPChwNfoChmo CpKIHt9+p7BSZA1SCx2InhKN8BqePO5e+MD5T50zxgJgZyEVInpitF8BtGln+3XUc1hS E5cyLKlF5640RT1YlYjwkU6qY9HAQdVTHluvQCytcOchHI8EijBCuuJlBaVEkaw7pPhC cl8s5JJXe2un71Xdz8TJzmQih1R7pzEY0TGNBDUpEkqQS6X3XUtLwrFLNhs98KA3Gj3A gk4Q== X-Gm-Message-State: AOAM531fubFL6oNULu7kHg7idl2drK+y7hvzQIgbYLs9pO/xVIP0wprK yr41SnK4b58ZQf9NhsxVXIPgkg== X-Google-Smtp-Source: ABdhPJwPcZosbX6F/FEtrRwct5NPpkw0jknr5o9f0r7xAc5sBoT3Dcx5C3arvvo3qFB/+caOXsY09g== X-Received: by 2002:a17:90a:ce8d:: with SMTP id g13mr4686960pju.85.1618421374136; Wed, 14 Apr 2021 10:29:34 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:bae3:4af0:9792:1539]) by smtp.gmail.com with ESMTPSA id e31sm63460pjk.4.2021.04.14.10.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 10:29: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 , Jani Nikula , Joonas Lahtinen , intel-gfx@lists.freedesktop.org Subject: [PATCH v19 4/6] misc: eeprom: at24: check suspend status before disable regulator Date: Thu, 15 Apr 2021 01:29:14 +0800 Message-Id: <20210414172916.2689361-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog In-Reply-To: <20210414172916.2689361-1-hsinyi@chromium.org> References: <20210414172916.2689361-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210414_102935_029015_1D89FCF8 X-CRM114-Status: GOOD ( 13.49 ) 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. 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; }