Re: [PATCH v2 0/3] usb: typec: Separate sysfs directory for all USB PD objects

From: Greg Kroah-Hartman
Date: Tue Apr 12 2022 - 10:38:41 EST


On Tue, Apr 12, 2022 at 04:00:20PM +0300, Heikki Krogerus wrote:
> Hi,
>
> In this version the USB Power Delivery support is now completely
> separated into its own little subsystem. The USB Power Delivery
> objects are not devices, but they are also no longer tied to any
> device by default. This change makes it possible to share the USB PD
> objects between multiple devices on top of being able to select the
> objects that we want the device to use.
>
> The USB Power Delivery objects are now placed under
> /sys/kernel/usb_power_delivery directory. As an example:
>
> /sys/kernel/usb_power_delivery/pd0

No, sorry, this is a device, it does NOT belong in /sys/kernel/

And this really should be a real device, as I mentioned before, not a
kobject.

> So now that pd0 can be linked to a device, or devices, that want (or
> can) use it to negotiate the USB PD contract with. An example where
> two devices share the PD:
>
> /sys/class/typec/port0/usb_power_delivery -> ../../../../../../../kernel/usb_power_delivery/pd0
> /sys/class/typec/port1/usb_power_delivery -> ../../../../../../../kernel/usb_power_delivery/pd0

Point to the pd device, not the kobject.

> I did not change the directory hierarchy at all, because I'm assuming
> that it is not a problem anymore:
>
> pd0/<message>/<object>/<field>

Let's get back to devices first, worry about crazy depth second.

thanks,

greg k-h