diff mbox

drm: Lighten sysfs connector 'status'

Message ID 1425482705-25831-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson March 4, 2015, 3:25 p.m. UTC
Since the beginning, sysfs/connector/status has done a heavyweight
detection of the current connector status. But no user, such as upowerd
or logind, has ever desired to initiate a probe. Move the probing into a
new attribute so that existing users get the behaviour they desire.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Dave Airlie <airled@redhat.com>
---
 drivers/gpu/drm/drm_sysfs.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Alex Deucher March 4, 2015, 3:41 p.m. UTC | #1
On Wed, Mar 4, 2015 at 10:25 AM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Since the beginning, sysfs/connector/status has done a heavyweight
> detection of the current connector status. But no user, such as upowerd
> or logind, has ever desired to initiate a probe. Move the probing into a
> new attribute so that existing users get the behaviour they desire.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Cc: Dave Airlie <airled@redhat.com>
> ---
>  drivers/gpu/drm/drm_sysfs.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index 5c99d3773212..e4ee91a2bd28 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -166,7 +166,7 @@ void drm_sysfs_destroy(void)
>  /*
>   * Connector properties
>   */
> -static ssize_t status_show(struct device *device,
> +static ssize_t detect_show(struct device *device,
>                            struct device_attribute *attr,
>                            char *buf)
>  {
> @@ -185,6 +185,16 @@ static ssize_t status_show(struct device *device,
>                         drm_get_connector_status_name(status));
>  }
>
> +static ssize_t status_show(struct device *device,
> +                          struct device_attribute *attr,
> +                          char *buf)
> +{
> +       struct drm_connector *connector = to_drm_connector(device);
> +
> +       return snprintf(buf, PAGE_SIZE, "%s\n",
> +                       drm_get_connector_status_name(connector->status));
> +}
> +
>  static ssize_t dpms_show(struct device *device,
>                            struct device_attribute *attr,
>                            char *buf)
> @@ -339,12 +349,14 @@ static ssize_t select_subconnector_show(struct device *device,
>                         drm_get_dvi_i_select_name((int)subconnector));
>  }
>
> +static DEVICE_ATTR_RO(detect);
>  static DEVICE_ATTR_RO(status);
>  static DEVICE_ATTR_RO(enabled);
>  static DEVICE_ATTR_RO(dpms);
>  static DEVICE_ATTR_RO(modes);
>
>  static struct attribute *connector_dev_attrs[] = {
> +       &dev_attr_detect.attr,
>         &dev_attr_status.attr,
>         &dev_attr_enabled.attr,
>         &dev_attr_dpms.attr,
> --
> 2.1.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 5c99d3773212..e4ee91a2bd28 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -166,7 +166,7 @@  void drm_sysfs_destroy(void)
 /*
  * Connector properties
  */
-static ssize_t status_show(struct device *device,
+static ssize_t detect_show(struct device *device,
 			   struct device_attribute *attr,
 			   char *buf)
 {
@@ -185,6 +185,16 @@  static ssize_t status_show(struct device *device,
 			drm_get_connector_status_name(status));
 }
 
+static ssize_t status_show(struct device *device,
+			   struct device_attribute *attr,
+			   char *buf)
+{
+	struct drm_connector *connector = to_drm_connector(device);
+
+	return snprintf(buf, PAGE_SIZE, "%s\n",
+			drm_get_connector_status_name(connector->status));
+}
+
 static ssize_t dpms_show(struct device *device,
 			   struct device_attribute *attr,
 			   char *buf)
@@ -339,12 +349,14 @@  static ssize_t select_subconnector_show(struct device *device,
 			drm_get_dvi_i_select_name((int)subconnector));
 }
 
+static DEVICE_ATTR_RO(detect);
 static DEVICE_ATTR_RO(status);
 static DEVICE_ATTR_RO(enabled);
 static DEVICE_ATTR_RO(dpms);
 static DEVICE_ATTR_RO(modes);
 
 static struct attribute *connector_dev_attrs[] = {
+	&dev_attr_detect.attr,
 	&dev_attr_status.attr,
 	&dev_attr_enabled.attr,
 	&dev_attr_dpms.attr,