Re: [PATCH 2/2] usb: typec: Add onsemi FUSB15201 driver

From: Shawn Guo

Date: Tue Sep 08 2026 - 21:42:05 EST


Hi Uwe,

On Mon, Sep 07, 2026 at 10:32:55AM +0200, Uwe Kleine-König wrote:
> Hello Shawn,
>
> On Wed, Sep 02, 2026 at 12:59:38PM +0800, Shawn Guo wrote:
> > +#include <linux/i2c.h>
> > [...]
> > +#include <linux/mod_devicetable.h>
>
> Please rely on <linux/i2c.h> to provide of_device_id and (see below)
> i2c_device_id. Alternatively include the needed files below
> include/linux/device-id/ to not introduce unneeded dependencies.

Ah, yes! I will drop this include.

>
> > +static const struct of_device_id fusb15201_of_match[] = {
> > + { .compatible = "onnn,fusb15201" },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, fusb15201_of_match);
> > +
> > +static struct i2c_driver fusb15201_driver = {
> > + .driver = {
> > + .name = "fusb15201",
> > + .of_match_table = fusb15201_of_match,
> > + },
> > + .probe = fusb15201_probe,
>
> Don't you need an i2c_device_id table, too?

I'm not sure. For the DT case the of_match_table handles both matching
and module autoloading, so nothing is missing there.

The i2c_device_id table would only matter for a client created without a
fwnode, e.g. from board code, and that is not a case the driver supports
or has been tested against. probe() walks the child fwnodes of the device
to find the connectors and fails with -ENODEV when there are none, and
each port needs its Type-C capabilities and a usb-role-switch reference
from firmware. So matching by name alone would only turn a "no driver"
case into a probe failure. If a platform without DT ever needs this
driver, it has to describe the connectors first, and the i2c_device_id
table can come along with that.

Shawn