diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2020-09-24 21:44:30 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-09-28 07:47:43 +0200 |
commit | 0173f525b2c1b02a51784e2119d434593235aed1 (patch) | |
tree | be7fd015e55158bb0ce939863460626788948415 /drivers/soundwire/slave.c | |
parent | soundwire: bus: add enumerated Slave device to device list (diff) | |
download | linux-0173f525b2c1b02a51784e2119d434593235aed1.tar.xz linux-0173f525b2c1b02a51784e2119d434593235aed1.zip |
soundwire: sysfs: add slave status and device number before probe
The MIPI DisCo device properties that are read by the driver from
platform firmware, or hard-coded in the driver, should only be
provided as sysfs entries when a driver probes successfully.
However the device status and device number is updated even when there
is no driver present, and hence can be updated when a Slave device is
detected on the bus without being described in platform firmware and
without any driver registered/probed.
As suggested by GregKH, the attribute group for Slave status and
device number is is added by default upon device registration.
Credits to Vinod Koul for the status_show() function, shared in a
separate patch and used as is here. The status table was modified to
remove an unnecessary enum and status_show() is handled in a different
group attribute than what was suggested by Vinod.
Tested-by: Srinivas Kandgatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Co-developed-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200924194430.121058-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire/slave.c')
-rw-r--r-- | drivers/soundwire/slave.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 19b012310c29..a08f4081c1c4 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -6,6 +6,7 @@ #include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw_type.h> #include "bus.h" +#include "sysfs_local.h" static void sdw_slave_release(struct device *dev) { @@ -51,6 +52,7 @@ int sdw_slave_add(struct sdw_bus *bus, slave->dev.bus = &sdw_bus_type; slave->dev.of_node = of_node_get(to_of_node(fwnode)); slave->dev.type = &sdw_slave_type; + slave->dev.groups = sdw_slave_status_attr_groups; slave->bus = bus; slave->status = SDW_SLAVE_UNATTACHED; init_completion(&slave->enumeration_complete); |