• Saravana Kannan's avatar
    driver core: Expose device link details in sysfs · 287905e6
    Saravana Kannan authored
    It's helpful to be able to look at device link details from sysfs. So,
    expose it in sysfs.
    
    Say device-A is supplier of device-B. These are the additional files
    this patch would create:
    
    /sys/class/devlink/device-A:device-B/
    	auto_remove_on
    	consumer/ -> .../device-B/
    	runtime_pm
    	status
    	supplier/ -> .../device-A/
    	sync_state_only
    
    /sys/devices/.../device-A/
    	consumer:device-B/ -> /sys/class/devlink/device-A:device-B/
    
    /sys/devices/.../device-B/
    	supplier:device-A/ -> /sys/class/devlink/device-A:device-B/
    
    That way:
    To get a list of all the device link in the system:
    ls /sys/class/devlink/
    
    To get the consumer names and links of a device:
    ls -d /sys/devices/.../device-X/consumer:*
    
    To get the supplier names and links of a device:
    ls -d /sys/devices/.../device-X/supplier:*
    Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
    Link: https://lore.kernel.org/r/20200521191800.136035-2-saravanak@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    287905e6
sysfs-class-devlink 4.21 KB