Re: [PATCH] usb: typec: pd: Add symlink to linked device
From: Greg Kroah-Hartman
Date: Mon Nov 21 2022 - 01:35:48 EST
On Mon, Nov 21, 2022 at 06:20:39AM +0000, Prashant Malani wrote:
> There exists a symlink from a device to its USB Power Delivery object,
> but not the other way around. Add a symlink from the USB PD object to
> the device which it's associated with, and call it "device".
>
> This is helpful to identify said device (a Type-C peripheral for
> example) during uevents, since during USB PD object
> creation/destruction, a uevent is generated for the PD object,
> but not the device linked to it.
>
> Cc: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Cc: Benson Leung <bleung@xxxxxxxxxxxx>
> Signed-off-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
> ---
> .../ABI/testing/sysfs-class-usb_power_delivery | 6 ++++++
> drivers/usb/typec/pd.c | 12 ++++++++++--
> 2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-class-usb_power_delivery b/Documentation/ABI/testing/sysfs-class-usb_power_delivery
> index ce2b1b563cb3..e7d19193875f 100644
> --- a/Documentation/ABI/testing/sysfs-class-usb_power_delivery
> +++ b/Documentation/ABI/testing/sysfs-class-usb_power_delivery
> @@ -4,6 +4,12 @@ Contact: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Description:
> Directory for USB Power Delivery devices.
>
> +What: /sys/class/usb_power_delivery/.../device
> +Date: November 2022
> +Contact: Prashant Malani <pmalani@xxxxxxxxxxxx>
> +Description:
> + Symbolic link to the directory of the device to which the USB PD object is linked.
Line is way too long.
But wait, a "device" has a specific meaning in a sysfs file, and that is
not what is happening here.
Please don't make fake "device" symlinks when these are not really using
a device here. Either fix it up to properly use the device structures
in the code, or call this something else.
What in userspace wants to see this symlink?
thanks,
greg k-h