Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp375795lqs; Thu, 13 Jun 2024 12:34:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvQ3/C6fzNgZrQyceKwdlwdJJeLu3vJMj6BtQFXbMRGiY3Li2s+2ObYMbFGYUC0MXG5TeNao9x/otysg2Tr3wrE0No7U1osYSPJfcHbQ== X-Google-Smtp-Source: AGHT+IFQPA4YIJbhe+aN05bmEsMIu1AqhXk1lAZpoieLdBUCtWXPWyTp8tVuNVEDLQ2WZxCZKyUq X-Received: by 2002:a2e:7311:0:b0:2eb:e3fb:5c23 with SMTP id 38308e7fff4ca-2ec0e5b58a7mr5497831fa.3.1718307276775; Thu, 13 Jun 2024 12:34:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718307276; cv=pass; d=google.com; s=arc-20160816; b=B4AFA/4vysP+U2kdEXgrW8HRfMUQb0HkkOHBy0xBVpM3ZEU5vEsOsTjfWBclC8+294 DaxeuXEsUQmu87MjFoCQryzzduXR0nARP5oXC+dgH2NLFgUuKpI0t2I9d7G92yHqI9fR /kVIHOzszxXKy8X+5neBCW4Ltky3B3mgh//cJi2JhQ3N/o5jw5NjanHy76XNlwu60BcQ pK9EugDREtjQ9yWoLzT1na/hwT11cl6aKk+kiJUvn4DlWlunl7uNDzQEEemXF6gqjmOe b+xDMHYcYJ8bmWtwHfXVat7Ff1HToxgg9NYU8pCV9aYHiQU2umfEgjzdOlMpBEc6P+e1 06HA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=XdtnP+vCzD7nUvRrculglsKhALZY9H1NFU6iXr3yhMc=; fh=v+nEBJqChgZNsc2ghIcCgMFT1Wy00WhQO8xUt8b51SE=; b=VttmVBjA++HvT8KeBhffM4WbWUaPW2D4uDcvRFhTjlL9GInzuKkr8qkpwfoEi5iM2l t/FPknxotpj8O9EFPCzyJvba3zvHAQsnQEaygg0EsdXhNMUjzjqi1iLkWcrB312ChFjA b1T2P2NRT0wXGf96aeFQpaxE9qhLga+q5SKBIQNSYJG5AXw1jQuU2X+RYZOcPJ3PPPrJ T2PjUgFHxeVeD0IvQUFEaaIwVHxZuWVgfJsJZHTMYpUZxvLvU79T0RnoODJmzl8uqWVB 7y4D5MfTP2Dv1O3wtqdVgBqHWy5+83r6F5VIluqCBKBBI2NF8hzstnE2aqCHfqIEOanz byYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B41kXFrk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213930-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213930-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb742c655si1011988a12.210.2024.06.13.12.34.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 12:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213930-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B41kXFrk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213930-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213930-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5C0D21F23A19 for ; Thu, 13 Jun 2024 19:34:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5659114E2D4; Thu, 13 Jun 2024 19:34:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B41kXFrk" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7548814D6ED; Thu, 13 Jun 2024 19:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718307248; cv=none; b=qvtMmUZJKcwv/e1BDHRUqVxNwQIh0TI4mnleboKKXEmb68H1uoA7/MgLvqBp8bvv49/1NdzlsC/IOL3Po8nnTm0H0Sj/7kd9L9FjMtDDllx/MmXjYuEUwl8b0eQQpP2ll8mmF8lxXSNzaKeFsmKgJcYikfYkqOfrF+25p6Bm6xA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718307248; c=relaxed/simple; bh=bbhYqO6arj3VX7+rFvR2uC0Q/DGG5UGkw2Zn5smw2UQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=PAyETDcKcfQ1p53f9kc2GPmolnMDIJigLrhsPVxVrjGZHYQv+xu+hN9gO7GMDGJL4z0zuMrtomFfwXpxgvMB2QYWB5N1h17+HieKEqAfb3LOLWCo1tVCJP8HixrriW3Eyonyi23TL9OMlRCPo5YMJ+/upWDQ/d7W6Wgqw6QY6mM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B41kXFrk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C8BC4AF5F; Thu, 13 Jun 2024 19:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718307248; bh=bbhYqO6arj3VX7+rFvR2uC0Q/DGG5UGkw2Zn5smw2UQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=B41kXFrkKcs4UOo8evdjfW2C4ZW/UK3nX+H2W1bKE/9jnhsi9R8uzcuv9pzz6ywsb 6NhZCORscpyhVztgHvNjw3zpk55iVAc1L0EFo/y4foNJrvrcatI3hN81iUWnxfWWqM dhIxGhrOj6STl5dzuYjwHEDitl/LBsXb/Svl43pRVS2JBt6HEIw/7xVClMj8T5rFT/ JHKdVb6kn36tDqT1mDPflFVMatAdDbR0NlcXUw7HaBP6pvGrVp4usRe/VJjjtZ9hzS WUQh84AAlYl0fS8jZNieg+F3pi+hcb2rgKQGkpaD42bC3N5LrlMhdhJSl70coKt9Tz 2KHOrsydpjYmg== Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3d21c5b48f5so211526b6e.0; Thu, 13 Jun 2024 12:34:08 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVugk0YH1nqMjWV+m4nZ5RULE7ZhMRc3ACxi5TSllsT6EJpv7vdDEu+hQ+0+8+DA/osDIknL21ySlUIRk7++bxhF1mmoYZORiHkY5HyOOJWLLE8FmVfYjbPPKsCTC92E86x1i7OnZGgpgHulLQ2C7wOfQdNKuzFroD1f/oyJigqdxK9 X-Gm-Message-State: AOJu0YwxV52g8Oy+BRQTWYPWKsv3MOdlQhr23zOnjLP08M9Yb8HHHAwD +1zd/qldE+cfIYcsFvY1FNpZxNUDk0hkDmrN9CzwtaQwCNsigszq2zP4P7CJ+b1P/Fr8VrrTbE3 1HmhxFURNbVLkurbDxISs45I1njQ= X-Received: by 2002:a4a:e1da:0:b0:5ba:ead2:c742 with SMTP id 006d021491bc7-5bdad9f0343mr742290eaf.0.1718307247027; Thu, 13 Jun 2024 12:34:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240610-cros_ec-charge-control-v3-0-135e37252094@weissschuh.net> <20240610-cros_ec-charge-control-v3-1-135e37252094@weissschuh.net> In-Reply-To: <20240610-cros_ec-charge-control-v3-1-135e37252094@weissschuh.net> From: "Rafael J. Wysocki" Date: Thu, 13 Jun 2024 21:33:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/5] ACPI: battery: add devm_battery_hook_register() To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Cc: Benson Leung , Guenter Roeck , Sebastian Reichel , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , "Rafael J. Wysocki" , Len Brown , Robert Moore , Tzung-Bi Shih , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Mario Limonciello , Dustin Howett , Stephen Horvath , Rajas Paranjpe , linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev, Matt Hartley Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 10, 2024 at 5:52=E2=80=AFPM Thomas Wei=C3=9Fschuh wrote: > > Add a utility function for device-managed registration of battery hooks. > The function makes it easier to manage the lifecycle of a hook. > > Signed-off-by: Thomas Wei=C3=9Fschuh Please feel free to add Acked-by: Rafael J. Wysocki to this patch and route it along with the rest of the series as needed. Thanks! > --- > drivers/acpi/battery.c | 15 +++++++++++++++ > include/acpi/battery.h | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c > index b379401ff1c2..6ea979f76f84 100644 > --- a/drivers/acpi/battery.c > +++ b/drivers/acpi/battery.c > @@ -756,6 +756,21 @@ void battery_hook_register(struct acpi_battery_hook = *hook) > } > EXPORT_SYMBOL_GPL(battery_hook_register); > > +static void devm_battery_hook_unregister(void *data) > +{ > + struct acpi_battery_hook *hook =3D data; > + > + battery_hook_unregister(hook); > +} > + > +int devm_battery_hook_register(struct device *dev, struct acpi_battery_h= ook *hook) > +{ > + battery_hook_register(hook); > + > + return devm_add_action_or_reset(dev, devm_battery_hook_unregister= , hook); > +} > +EXPORT_SYMBOL_GPL(devm_battery_hook_register); > + > /* > * This function gets called right after the battery sysfs > * attributes have been added, so that the drivers that > diff --git a/include/acpi/battery.h b/include/acpi/battery.h > index 611a2561a014..c93f16dfb944 100644 > --- a/include/acpi/battery.h > +++ b/include/acpi/battery.h > @@ -2,6 +2,7 @@ > #ifndef __ACPI_BATTERY_H > #define __ACPI_BATTERY_H > > +#include > #include > > #define ACPI_BATTERY_CLASS "battery" > @@ -19,5 +20,6 @@ struct acpi_battery_hook { > > void battery_hook_register(struct acpi_battery_hook *hook); > void battery_hook_unregister(struct acpi_battery_hook *hook); > +int devm_battery_hook_register(struct device *dev, struct acpi_battery_h= ook *hook); > > #endif > > -- > 2.45.2 > >