drm: fix writing to /sys/class/drm/*/status
Subsystems (2)
PATCH 1/1 drm: fix writing to /sys/class/drm/*/status
Writing to a file is supposed to return the number of bytes written. Returning zero unfortunately causes bash to constantly spin trying to write to the sysfs file, to such an extent that even ^c and ^z have no effect. The only way out of that is to kill the shell and log back in. This isn't nice behaviour.
Fix it by returning the number of characters written to sysfs files.
--- drivers/gpu/drm/drm_sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_sysfs.c +3 -1
@@ -181,6 +181,8 @@ static ssize_t status_store(struct device *device, old_status = connector->status; + ret = count; +if (sysfs_streq (buf,"detect" )) { connector->force =0 ; connector->status = connector->funcs->detect (connector, true);
@@ -193,7 +195,7 @@ static ssize_t status_store(struct device *device, }else ret = -EINVAL ; -if (ret ==0 && connector->force) { +if (ret >=0 && connector->force) {if (connector->force ==DRM_FORCE_ON || connector->force ==DRM_FORCE_ON_DIGITAL ) connector->status = connector_status_connected;
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Russell King
Writing to a file is supposed to return the number of bytes written. Returning zero unfortunately causes bash to constantly spin trying to write to the sysfs file, to such an extent that even ^c and ^z have no effect. The only way out of that is to kill the shell and log back in. This isn't nice behaviour.
Fix it by returning the number of characters written to sysfs files.
Signed-off-by Russell King <[email protected]>
Oops.
Dave, we need this for 4.1...
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Chris Wilson
Quoted 8 lines · Russell King
Writing to a file is supposed to return the number of bytes written. Returning zero unfortunately causes bash to constantly spin trying to write to the sysfs file, to such an extent that even ^c and ^z have no effect. The only way out of that is to kill the shell and log back in. This isn't nice behaviour.
Fix it by returning the number of characters written to sysfs files.
Quoted 8 lines
Quoted 1 line
Signed-off-by Russell King <[email protected]>Oops.
Fixes c484f02d0f02fbbfc6decc945a69aae011041a27Reviewed-by Chris Wilson <[email protected]>Dave, we need this for 4.1...
Viro suggests an alternative, simpler fix:
drivers/gpu/drm/drm_sysfs.c +1 -1
@@ -217,7 +217,7 @@ static ssize_t status_store(struct device *device,mutex_unlock (&dev->mode_config.mutex); -return ret; +return ret ? ret : count; } static ssize_t status_show(struct device *device,
Would you prefer this one?
Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel