Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2970221pxb; Fri, 5 Nov 2021 07:41:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVG456RZHNVEyJd2Xr/DAkdudkOx9Av59oV+3sL9CAncGGcQqwaUlM8A47lRkGCI+3Kyh/ X-Received: by 2002:a05:6e02:1d02:: with SMTP id i2mr10166997ila.182.1636123305677; Fri, 05 Nov 2021 07:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636123305; cv=none; d=google.com; s=arc-20160816; b=tD0m70Q+ePpBSPPoZVZkwQRVYJeFrfuCmSI+u3xMIKhTCtjFaSeSyCfP9zZbleXMCI rsZlwm9neFOZJ/CCFL0hMPDXVm2j8Xnvs6iohB4JyleboCyw3o8XPbOYAHxYzxUWcvQZ zhWZj1hVhCcRy6gCUiJTrlXxgJEJhfk4iqjK0CYxc2a9LM8sc+m5R6rsTooPVtn5X5Vc gTlbeN5MsgjmuDp+9XayVwkinSVDn3nsX46LGubCdiVGynGY22cy8A5RlUBNeyXtZoa0 TyhJfHl+r3kl69Xw58v0Y2UK/HSAaWnMy4LmaK8YqVQuH9zYtToq/blvm3nAoNqOoAu5 n8wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=VTa1m+M0trWvovWd1u5XqKaD5cR/58XJc93gIZv2JIU=; b=Uzi+usOJkmovD9n/0F5uD4mnBw225KgZVcNVnBTqbO7E7zb75AsfmOJ9EvPSjdPbtq ARAY69xyB5E97GAUx7WV48MpWtyzGz8BM4e3XkqEiS3ec18dHqZQT7RPVlg0rvY/mISX f0AhWcjsfcEkShufM0MpLuNd1/gpzqPd0M21U5MVQljfudDVVXXUjcvhQ92LXGchkoMF GW4GSv+xQsGN1pNYmKuSlPAdk+a62FEr/iR/wdLiqKSSt7YX1+X2pP1TB4dnRpPN/e1r mJsk9uLK4Sr5yPc+j3qGtJ8K0qv600PChhzNAJHf6nLbbuFcazeRbGcyGEl3qQO6hyuN p7iw== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si6878337ios.7.2021.11.05.07.41.12; Fri, 05 Nov 2021 07:41:45 -0700 (PDT) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233105AbhKEOmE (ORCPT + 99 others); Fri, 5 Nov 2021 10:42:04 -0400 Received: from mail-ot1-f48.google.com ([209.85.210.48]:39561 "EHLO mail-ot1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbhKEOmE (ORCPT ); Fri, 5 Nov 2021 10:42:04 -0400 Received: by mail-ot1-f48.google.com with SMTP id c26-20020a9d615a000000b0055bf6efab46so5106349otk.6; Fri, 05 Nov 2021 07:39:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VTa1m+M0trWvovWd1u5XqKaD5cR/58XJc93gIZv2JIU=; b=t9m8ZkGOOjtugnTKXE3EgLwT9We6Xtu0HDHJ7RRsefBPGWlDPbdBEmxvOq8F7YCk2g seaRmRJew2ddbO81d7ZvTiDP7VsFGws2rMldtrn/YulP0FszYdRRF4inzqpDyWpyQ+oF Zmc1km1so3lLY6srmP13rHJbtHHrSCZTrIZxSNwoFl7LmLXIm1G+kciO987z3H86YwZG 1Q4waSAEzMArZdYtYLWQVnHmF6E75ws7Qv8zQWsW3iMklSpvvuBHif3Ek44SIix6JcJj APZ4a++TTUy/kMHCQyqvYPUQYjk/3XgY2E6xslIVgsoSFvyeLvPnwVgHQzk2bV4Q51Cy pr7w== X-Gm-Message-State: AOAM531BymkR77nQsKZeNGys5vHJ192O92pXXRTIjcbxYZWP1RYEWvle dLF0FONN88ExAqxxnjZtOuwEdG5IDoBWOLEwQZu016/T X-Received: by 2002:a9d:a64:: with SMTP id 91mr38181170otg.198.1636123163940; Fri, 05 Nov 2021 07:39:23 -0700 (PDT) MIME-Version: 1.0 References: <2606454.mvXUDI8C0e@kreacher> <11862743.O9o76ZdvQC@kreacher> In-Reply-To: <11862743.O9o76ZdvQC@kreacher> From: "Rafael J. Wysocki" Date: Fri, 5 Nov 2021 15:39:13 +0100 Message-ID: Subject: Re: [PATCH] ACPI: PM: Fix device wakeup power reference counting error To: Linux ACPI Cc: LKML , Linux PM , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 4, 2021 at 10:54 PM Rafael J. Wysocki wrote: > > On Thursday, November 4, 2021 6:21:51 PM CET Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > Fix a device wakeup power reference counting error introduced by > > commit a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power > > resources"). > > > > Fixes: a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources") > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/acpi/power.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > Index: linux-pm/drivers/acpi/power.c > > =================================================================== > > --- linux-pm.orig/drivers/acpi/power.c > > +++ linux-pm/drivers/acpi/power.c > > @@ -757,10 +757,8 @@ int acpi_disable_wakeup_device_power(str > > > > mutex_lock(&acpi_device_lock); > > > > - if (dev->wakeup.prepare_count > 1) { > > + if (dev->wakeup.prepare_count >= 1) > > dev->wakeup.prepare_count--; > > - goto out; > > - } > > > > /* Do nothing if wakeup power has not been enabled for this device. */ > > if (!dev->wakeup.prepare_count) > > This is still not good. It should be something like the patch below, but I > need to test that one. Tested now, so applying as 5.16-rc material. > --- > From: Rafael J. Wysocki > Subject: [PATCH v2] ACPI: PM: Fix device wakeup power reference counting error > > Fix a device wakeup power reference counting error introduced by > commit a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power > resources"). > > Fixes: a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources") > Signed-off-by: Rafael J. Wysocki > --- > > -> v2: Actually disable wakeup power when the reference count becomes zero. > > --- > drivers/acpi/power.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > Index: linux-pm/drivers/acpi/power.c > =================================================================== > --- linux-pm.orig/drivers/acpi/power.c > +++ linux-pm/drivers/acpi/power.c > @@ -757,13 +757,11 @@ int acpi_disable_wakeup_device_power(str > > mutex_lock(&acpi_device_lock); > > - if (dev->wakeup.prepare_count > 1) { > - dev->wakeup.prepare_count--; > + /* Do nothing if wakeup power has not been enabled for this device. */ > + if (dev->wakeup.prepare_count <= 0) > goto out; > - } > > - /* Do nothing if wakeup power has not been enabled for this device. */ > - if (!dev->wakeup.prepare_count) > + if (--dev->wakeup.prepare_count > 0) > goto out; > > err = acpi_device_sleep_wake(dev, 0, 0, 0); > > > >