From: sashiko-bot@kernel.org
To: "Jhon Wilker Rodrigues Aquino" <jhonwilker0112@gmail.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT
Date: Tue, 03 Nov 2026 19:03:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-195874@kernel.org> (raw)
In-Reply-To: <20261103185514.72144-3-jhonwilker0112@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] usb: misc: usb251xb: missing bat_support check in usb251xb_get_ofdata()
--
commit 7116fd963729fc92bbd453fc4d055b0129eabda3
Author: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
usb: misc: usb251xb: configure battery charging from DT
This commit parses the battery-charging-enable port list from the device tree
to configure the battery charging enable register on USB251xB hubs.
> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> index fb0693742f018..166eb541ef161 100644
> --- a/drivers/usb/misc/usb251xb.c
> +++ b/drivers/usb/misc/usb251xb.c
> @@ -577,6 +577,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> (wchar_t *)hub->serial,
> USB251XB_STRING_BUFSIZE);
>
> + hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
> + usb251xb_get_ports_field(hub, "battery-charging-enable", data->port_cnt,
> + true, &hub->bat_charge_en);
[Severity: Medium]
Should parsing "battery-charging-enable" in usb251xb_get_ofdata() be gated on
data->bat_support?
Commit dd99d106de25 ("usb: misc: usb251xb: Add structure for holding chip
specific values") introduced bat_support in struct usb251xb_data, setting it
to false for usb2517_data and usb2517i_data because the USB2517/USB2517i
variants do not support battery charging:
static const struct usb251xb_data usb2517_data = {
.product_id = 0x2517,
.port_cnt = 7,
.led_support = true,
.bat_support = false,
.product_str = "USB2517",
};
Earlier in usb251xb_get_ofdata(), the variant-specific LED property checks
data->led_support before applying the configuration:
if (data->led_support && of_get_property(np, "led-usb-mode", NULL))
hub->conf_data3 &= ~BIT(1);
Without a similar check on data->bat_support here, bat_support remains unused
and probing a USB2517 or USB2517i node with "battery-charging-enable" present
in the device tree will populate hub->bat_charge_en and write non-zero values
to the reserved register 0xD0 (USB251XB_ADDR_BATTERY_CHARGING_ENABLE) during
usb251xb_connect().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103185514.72144-1-jhonwilker0112@gmail.com?part=2
next prev parent reply other threads:[~2026-11-03 19:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 18:59 ` sashiko-bot
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2026-11-03 19:03 ` sashiko-bot [this message]
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 20:05 ` sashiko-bot
2026-11-03 20:52 ` Krzysztof Kozlowski
2026-11-03 20:01 ` [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2026-11-03 20:06 ` 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-195874@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jhonwilker0112@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.