[PATCH] drm: Lighten sysfs connector 'status'

Alex Deucher alexdeucher at gmail.com
Wed Mar 4 07:41:16 PST 2015


On Wed, Mar 4, 2015 at 10:25 AM, Chris Wilson <chris at 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 at amd.com>

>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: David Herrmann <dh.herrmann at gmail.com>
> Cc: Dave Airlie <airled at 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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list