[PATCH v10 01/11] usb: typec: Add notifier functions
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Wed Nov 26 03:44:17 PST 2025
On Wed, Nov 26, 2025 at 11:42:43AM +0200, Heikki Krogerus wrote:
> Wed, Nov 26, 2025 at 09:46:19AM +0800, Chaoyi Chen kirjoitti:
> > On 11/25/2025 7:49 PM, Greg Kroah-Hartman wrote:
> > >> +static umode_t typec_is_visible(struct kobject *kobj, struct attribute *attr, int n)
> > >> +{
> > >> + if (is_typec_port(kobj_to_dev(kobj)->parent))
> > >
> > > Why look at the parent? Doesn't the device have a type that should show
> > > this?
> > >
> > > Otherwise, looks good to me.
> >
> > They have same deivce type "typec_altmode_dev_type".
> > The parent device has a different device type to distinguish between
> > port device and partner device.
>
> I was already wondering would it make sense to provide separate device
> types for the port, and also plug, alternate modes, but I'm not sure
> if that's the right thing to do.
>
> There is a plan to register an "altmode" also for the USB4 mode,
> which of course is not an alternate mode. So USB4 will definitely need a
> separate device type.
>
> So if we supply separate device types for the port, plug and partner
> alternate modes, we need to supply separate device types for port, plug
> and partner USB4 mode as well.
>
> We certainly can still do that, but I'm just not sure if it makes
> sense?
>
> I'll prepare a new version for this and include a separate patch where
> instead of defining separate device types for the port and plug
> alternate modes I'll just supply helpers is_port_alternate_mode() and
> is_plug_alternate_mode().
That feels like it would be better in the long run as it would be
easier to "match" on the device type.
thanks,
greg k-h
More information about the linux-arm-kernel
mailing list