Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 04/12] usb: apple-mfi-fastcharge: Use POWER_SUPPLY_TYPE_USB instead of BATTERY
Date: Sun, 06 Dec 2026 03:04:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-252101@kernel.org> (raw)
In-Reply-To: <646eafedd084ed43b2ccc078d9881b52c7121342.1796524906.git.rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] usb: apple-mfi-fastcharge: changing type to USB breaks
  sysfs/uevent ABI
--

commit 0d3db2f7dca0ee3251630abcee5663e509cef35a
Author: Rosen Penev <rosenp@gmail.com>

usb: apple-mfi-fastcharge: Use POWER_SUPPLY_TYPE_USB instead of BATTERY

This commit changes the power_supply_desc type registered by
apple-mfi-fastcharge from POWER_SUPPLY_TYPE_BATTERY to
POWER_SUPPLY_TYPE_USB.

> diff --git a/drivers/usb/misc/apple-mfi-fastcharge.c b/drivers/usb/misc/apple-mfi-fastcharge.c
> index 9ec4bac603951..63ceec5c2c3fe 100644
> --- a/drivers/usb/misc/apple-mfi-fastcharge.c
> +++ b/drivers/usb/misc/apple-mfi-fastcharge.c
> @@ -178,7 +178,7 @@ static int mfi_fc_probe(struct usb_device *udev)
>  	if (!battery_desc->name)
>  		return -ENOMEM;
>  
> -	battery_desc->type = POWER_SUPPLY_TYPE_BATTERY;
> +	battery_desc->type = POWER_SUPPLY_TYPE_USB;
>  	battery_desc->properties = apple_mfi_fc_properties;
>  	battery_desc->num_properties = ARRAY_SIZE(apple_mfi_fc_properties);
>  	battery_desc->get_property = apple_mfi_fc_get_property;

[Severity: High]
Does changing battery_desc->type to POWER_SUPPLY_TYPE_USB break the
userspace ABI?

Since commit 249fa8217b84 ("USB: Add driver to control USB fast charge for
iOS devices"), this driver has reported "Battery" via sysfs type and
POWER_SUPPLY_TYPE uevents.  Switching it to "USB" breaks existing
userspace power managers and udev rules matching Battery.

apple_mfi_fc_get_property() already returns POWER_SUPPLY_SCOPE_DEVICE for
POWER_SUPPLY_PROP_SCOPE, which is what power_supply_is_system_battery() and
userspace use to avoid treating an attached peripheral as a host battery.

POWER_SUPPLY_TYPE_USB also denotes a USB power source (typically exposing
online or usb_type), whereas this driver only exposes
POWER_SUPPLY_PROP_CHARGE_TYPE and POWER_SUPPLY_PROP_SCOPE, matching other
device-scoped peripheral charger drivers such as cros_peripheral_charger.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796524906.git.rosenp@gmail.com?part=4

  reply	other threads:[~2026-12-06  3:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  2:44 [PATCH 00/12] usb: apple-mfi-fastcharge: Fixes and cleanups Rosen Penev
2026-12-06  2:44 ` [PATCH 01/12] usb: apple-mfi-fastcharge: Convert to devm resources Rosen Penev
2026-12-06  3:00   ` sashiko-bot
2026-12-06  2:44 ` [PATCH 02/12] usb: apple-mfi-fastcharge: Use pm_runtime_resume_and_get() Rosen Penev
2026-12-06  2:44 ` [PATCH 03/12] usb: apple-mfi-fastcharge: Fix usb_control_msg() return check and timeout Rosen Penev
2026-12-06  2:44 ` [PATCH 04/12] usb: apple-mfi-fastcharge: Use POWER_SUPPLY_TYPE_USB instead of BATTERY Rosen Penev
2026-12-06  3:04   ` sashiko-bot [this message]
2026-12-06  2:44 ` [PATCH 05/12] usb: apple-mfi-fastcharge: Constify power_supply_property array Rosen Penev
2026-12-06  2:44 ` [PATCH 06/12] usb: apple-mfi-fastcharge: Use topology-based device name Rosen Penev
2026-12-06  2:44 ` [PATCH 07/12] usb: apple-mfi-fastcharge: Restore charge current on resume Rosen Penev
2026-12-06  3:05   ` sashiko-bot
2026-12-06  2:44 ` [PATCH 08/12] usb: apple-mfi-fastcharge: Serialize charge_type access with a mutex Rosen Penev
2026-12-06  3:07   ` sashiko-bot
2026-12-06  2:44 ` [PATCH 09/12] usb: apple-mfi-fastcharge: Configure runtime PM autosuspend Rosen Penev
2026-12-06  3:05   ` sashiko-bot
2026-12-06  2:44 ` [PATCH 10/12] usb: apple-mfi-fastcharge: Name the vendor power request Rosen Penev
2026-12-06  2:44 ` [PATCH 11/12] usb: apple-mfi-fastcharge: Rename battery variables to psy Rosen Penev
2026-12-06  2:58   ` sashiko-bot
2026-12-06  2:44 ` [PATCH 12/12] usb: apple-mfi-fastcharge: Simplify match and property_is_writeable Rosen Penev
2026-12-06  3:06   ` sashiko-bot
2026-12-06  3:07 ` [PATCH 00/12] usb: apple-mfi-fastcharge: Fixes and cleanups sashiko-bot

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=sashiko-outbox-252101@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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