Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp626384lqs; Fri, 14 Jun 2024 00:03:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUT77ej+Xjn++hW1skO3GV13w99Mfvzy+ZDM5enjKN26y2qwZNYPN1PQqrKoekcesKAiNXkRBM8SVL6gqZKdknFn+oOvsR6jqyYsB1AXQ== X-Google-Smtp-Source: AGHT+IE8FuWqz/VN2sXKKM6NPesR7tmH3ZkL3SqkhjNQfPAsh6CV1O2hBfLSUwivCkklki1HyKNF X-Received: by 2002:a05:620a:4624:b0:795:5eee:e3ad with SMTP id af79cd13be357-798d242ad6dmr201579585a.33.1718348591590; Fri, 14 Jun 2024 00:03:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718348591; cv=pass; d=google.com; s=arc-20160816; b=OBn8X2TuCZK68jEGbiJ/tl7TYQiJi+BNB3E50jhhABg3jzalHFkUKn8co3VlOIfEcL VAsCqgAsvwo1c6sIsFVrPjwo6I5kSyynHu8xgsirOxdsq+HP0eWEHDfsEtp6ltXApCgu wW3UGOh4NS18VnfItOQt67QrL9SD7VV+Vw+7rwQ8WvXcT6mFghFle2UA7XyEP+CC/LIC pTvHdRRENCRYFUBpmcdN9U70hrToEkqY5V9LSfnY5tkorgWBOh5NNk0nOZgbXFn83LS7 nSI5Fi8DzndfhQQ7Zd+j+fQFWWWLAvj3Y9tTpNn63CbdAirVr5k92tbpElRhdKPJeSl7 Y71w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yjsboQ/L0HDB2mYO2lPdAs5KiHRTnMtygloPx3Zg5cY=; fh=Q1qVgZl8LLWm92t69ZDTHl4Bau4iArhaOe3hQ3JhIvY=; b=TW+KTxDkNYN51/t1UXxQ7+Yk110LjyRAR8LPReeMYsTOlkZKmQFx3p+3x9B68KL/7q u2kEhi1ZWn5OPBIYn+maZ556cUShlPI+cV5OJCZ98utKwfhn2SDqLwqQ7Q9I/WIIVTyS qhz/oh0Z5pNKe3Dp/EF4afePD9NEMfMMEZjQzdUWMJuEHzVqyE9UurKbSYK9kG1v8gOa C/23+YVe7sqJEVmDkQ7gvify4rg9Gm12f4G24qTXx2L0d30AAh95ftmwqhDcohDYJu95 6FX5KaXvXV4VsdN144HtQ8eF3CvHqHxSG59eIEdLcIoGnWsq07Jybm/5tBeZ38JsEWaq F0nQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=kSnb4UqH; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-214420-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798aacc5d76si309032685a.160.2024.06.14.00.03.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 00:03:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214420-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=kSnb4UqH; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-214420-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F3761C22173 for ; Fri, 14 Jun 2024 07:03:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32E02148830; Fri, 14 Jun 2024 07:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="kSnb4UqH" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 3ED8E148849; Fri, 14 Jun 2024 07:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718348563; cv=none; b=KjtTL7k5yxTzqam1lOTss5kqKhbFllh8BogRDpwNJTmG1tS936Ike1N7Xqk+N5Wr4VjqHqnHC0kEv54sNUdone5ARAXH9obJbSu8sDkc1BSARLJ7NZcvp0ao2F0zvpIZVG0nXNRBHLGMvLYx7Tq1+9cBOroh5CWw1QjYC99lDm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718348563; c=relaxed/simple; bh=8p2Al/9e1siGHXoHFWJ+KpCoiuz9+nAteekXoz94MzM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f9KR6j5EvZJFE2IEIvVdGUM5+fM4IDZWy9DTj2pMfZPt4EbOvzH/UMJd+Yh6fWtTQNw2dRbOT1n23p8jFFPHQvRpfy/MPmqbXMv3HLFxLnDNBgO6Kh15KjvEsUYEwi+SEOVU6FLv2Y4RAUA1Ax0pZrE0Ef3lsGD3uygnFy3IMUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=kSnb4UqH; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1718348551; bh=8p2Al/9e1siGHXoHFWJ+KpCoiuz9+nAteekXoz94MzM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kSnb4UqHpVouIJdpPGuVIdKOTMgrjcS5soC2D6Sa3E3rIKyIQ6Hcp3MA7Q1vsJp+V 3IJ3HIc9Weu9hvk2vIqwKnElogg9g8HbafPMUgUugPM8UAcCIaSQ3OzklM4jmSBFct 5AiF3jG+7e7o54seLecdWVVOgs+JlQMbVsjnCJOE= Date: Fri, 14 Jun 2024 09:02:29 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Armin Wolf Cc: Sebastian Reichel , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2 3/5] power: supply: core: implement extension API Message-ID: <3491c641-bee2-4100-8eb6-8e90d63330b0@t-8ch.de> References: <20240608-power-supply-extensions-v2-0-2dcd35b012ad@weissschuh.net> <20240608-power-supply-extensions-v2-3-2dcd35b012ad@weissschuh.net> <76dff03c-08f6-4edc-af57-c0b8dbf55293@gmx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <76dff03c-08f6-4edc-af57-c0b8dbf55293@gmx.de> Hi! On 2024-06-14 01:11:29+0000, Armin Wolf wrote: > Am 08.06.24 um 21:19 schrieb Thomas Weißschuh: > > > Signed-off-by: Thomas Weißschuh > > --- > > drivers/power/supply/power_supply.h | 13 ++- > > drivers/power/supply/power_supply_core.c | 128 ++++++++++++++++++++++++++++-- > > drivers/power/supply/power_supply_hwmon.c | 2 +- > > drivers/power/supply/power_supply_sysfs.c | 37 ++++++++- > > include/linux/power_supply.h | 26 ++++++ > > 5 files changed, 192 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/power/supply/power_supply.h b/drivers/power/supply/power_supply.h > > index 622be1f0a180..686b66161900 100644 > > --- a/drivers/power/supply/power_supply.h > > +++ b/drivers/power/supply/power_supply.h > > @@ -13,8 +13,17 @@ struct device; > > struct device_type; > > struct power_supply; > > > > -extern bool power_supply_has_property(const struct power_supply_desc *psy_desc, > > - enum power_supply_property psp); > > +struct psy_ext_registration { > > + struct list_head list_head; > > + const struct power_supply_ext *ext; > > +}; > > + > > +#define psy_for_each_extension(psy, pos) list_for_each_entry(pos, &(psy)->extensions, list_head) > > sorry for taking so long to respond, the patch looks good to me except one single thing: > > when removing a power supply extension, the driver has to be sure that no one is still using > the removed extension. So you might want to add some sort of locking when using a power supply > extension. That was part of the v1 of the series [0]. I dropped it in v2 to focus on the external API and semantics first. IMO now that we have the loop macro anyways that can also take care of the locking: psy_for_each_extension_locked() [0] https://lore.kernel.org/all/20240606-power-supply-extensions-v1-4-b45669290bdc@weissschuh.net/ Thomas