From: Armin Wolf <W_Armin@gmx.de>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
"Sebastian Reichel" <sre@kernel.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"Thomas Weißschuh" <thomas@weissschuh.net>,
"Benson Leung" <bleung@chromium.org>,
"Guenter Roeck" <groeck@chromium.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
chrome-platform@lists.linux.dev,
Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH v4 5/9] power: supply: sysfs: prepare for power supply extensions
Date: Sun, 24 Nov 2024 18:57:23 +0100 [thread overview]
Message-ID: <84a5b7f9-9d09-4672-9447-02de05e68f88@gmx.de> (raw)
In-Reply-To: <20241111-power-supply-extensions-v4-5-7240144daa8e@weissschuh.net>
Am 11.11.24 um 22:40 schrieb Thomas Weißschuh:
> The upcoming extension API will add properties which are not part of the
> the power_supply_desc.
> Use power_supply_has_property() so the properties from extensions are
> also checked.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
> drivers/power/supply/power_supply_sysfs.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index a7351b9c8fe34a464a4e69b1a1a4a4179c1a4b4f..bfe48fe01a8d03828c2e539e1e6e5e9fc5c60167 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -378,7 +378,6 @@ static umode_t power_supply_attr_is_visible(struct kobject *kobj,
> struct device *dev = kobj_to_dev(kobj);
> struct power_supply *psy = dev_get_drvdata(dev);
> umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
> - int i;
>
> if (!power_supply_attrs[attrno].prop_name)
> return 0;
> @@ -386,19 +385,11 @@ static umode_t power_supply_attr_is_visible(struct kobject *kobj,
> if (attrno == POWER_SUPPLY_PROP_TYPE)
> return mode;
>
> - for (i = 0; i < psy->desc->num_properties; i++) {
> - int property = psy->desc->properties[i];
> -
> - if (property == attrno) {
> - if (power_supply_property_is_writeable(psy, property) > 0)
> - mode |= S_IWUSR;
> -
> - return mode;
> - }
> - }
> -
> - if (power_supply_battery_info_has_prop(psy->battery_info, attrno))
> + if (power_supply_has_property(psy, attrno)) {
> + if (power_supply_property_is_writeable(psy, attrno) > 0)
What happens with properties supplied via battery_info? Are drivers expecting the power supply core
to call property_is_writable() for those too?
Thanks,
Armin Wolf
> + mode |= S_IWUSR;
> return mode;
> + }
>
> return 0;
> }
>
next prev parent reply other threads:[~2024-11-24 17:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 21:40 [PATCH v4 0/9] power: supply: extension API Thomas Weißschuh
2024-11-11 21:40 ` [PATCH v4 1/9] power: supply: sysfs: print single value in uevent for POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR Thomas Weißschuh
2024-11-24 17:47 ` Armin Wolf
2024-11-24 17:55 ` Thomas Weißschuh
2024-11-24 18:01 ` Armin Wolf
2024-11-11 21:40 ` [PATCH v4 2/9] power: supply: core: rename psy_has_property() to psy_desc_has_property() Thomas Weißschuh
2024-11-24 17:48 ` Armin Wolf
2024-11-11 21:40 ` [PATCH v4 3/9] power: supply: core: introduce power_supply_has_property() Thomas Weißschuh
2024-11-24 17:51 ` Armin Wolf
2024-11-11 21:40 ` [PATCH v4 4/9] power: supply: hwmon: prepare for power supply extensions Thomas Weißschuh
2024-11-24 17:53 ` Armin Wolf
2024-11-11 21:40 ` [PATCH v4 5/9] power: supply: sysfs: " Thomas Weißschuh
2024-11-24 17:57 ` Armin Wolf [this message]
2024-11-25 8:59 ` Thomas Weißschuh
2024-11-11 21:40 ` [PATCH v4 6/9] power: supply: sysfs: rework uevent property loop Thomas Weißschuh
2024-11-24 18:00 ` Armin Wolf
2024-11-11 21:40 ` [PATCH v4 7/9] power: supply: core: implement extension API Thomas Weißschuh
2024-11-24 18:15 ` Armin Wolf
2024-11-25 9:22 ` Thomas Weißschuh
2024-11-11 21:40 ` [PATCH v4 8/9] power: supply: test-power: implement a power supply extension Thomas Weißschuh
2024-11-11 21:40 ` [PATCH v4 9/9] power: supply: cros_charge-control: use power_supply extensions Thomas Weißschuh
2024-12-05 1:36 ` (subset) [PATCH v4 0/9] power: supply: extension API Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84a5b7f9-9d09-4672-9447-02de05e68f88@gmx.de \
--to=w_armin@gmx.de \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=groeck@chromium.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=sebastian.reichel@collabora.com \
--cc=sre@kernel.org \
--cc=thomas@weissschuh.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®