dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Simon Ser <contact@emersion.fr>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 1/6] drm/sysfs: introduce drm_sysfs_connector_hotplug_event
Date: Fri, 15 Oct 2021 21:37:04 +0200	[thread overview]
Message-ID: <YWnYYNLL+Sg6JXYL@ravnborg.org> (raw)
In-Reply-To: <20211015163336.95188-2-contact@emersion.fr>

Hi Simon,

On Fri, Oct 15, 2021 at 04:33:41PM +0000, Simon Ser wrote:
> This function sends a hotplug uevent with a CONNECTOR property.

A little late feedback.

	Sam

> 
> Signed-off-by: Simon Ser <contact@emersion.fr>
> ---
>  drivers/gpu/drm/drm_sysfs.c | 25 +++++++++++++++++++++++++
>  include/drm/drm_sysfs.h     |  1 +
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index 76ff6ec3421b..430e00b16eec 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -409,6 +409,31 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_sysfs_hotplug_event);
>  
> +/**
> + * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any connector
> + * change
> + * @connector: connector which has changed
> + *
> + * Send a uevent for the DRM connector specified by @connector. This will send
> + * a uevent with the properties HOTPLUG=1 and CONNECTOR.
> + */
> +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector)
> +{
> +	struct drm_device *dev = connector->dev;
> +	char hotplug_str[] = "HOTPLUG=1", conn_id[21];
> +	char *envp[] = { hotplug_str, conn_id, NULL };
> +
> +	snprintf(conn_id, sizeof(conn_id),
> +		 "CONNECTOR=%u", connector->base.id);
We have add_uevent_var() that seems a better choice than handrolling
snprintf here.

	Sam

> +
> +	drm_dbg_kms(connector->dev,
> +		    "[CONNECTOR:%d:%s] generating connector hotplug event\n",
> +		    connector->base.id, connector->name);
> +
> +	kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
> +}
> +EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event);
> +
>  /**
>   * drm_sysfs_connector_status_event - generate a DRM uevent for connector
>   * property status change
> diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h
> index d454ef617b2c..6273cac44e47 100644
> --- a/include/drm/drm_sysfs.h
> +++ b/include/drm/drm_sysfs.h
> @@ -11,6 +11,7 @@ int drm_class_device_register(struct device *dev);
>  void drm_class_device_unregister(struct device *dev);
>  
>  void drm_sysfs_hotplug_event(struct drm_device *dev);
> +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector);
>  void drm_sysfs_connector_status_event(struct drm_connector *connector,
>  				      struct drm_property *property);
>  #endif
> -- 
> 2.33.1
> 

  reply	other threads:[~2021-10-15 19:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 16:33 [PATCH v3 0/6] drm: add per-connector hotplug events Simon Ser
2021-10-15 16:33 ` [PATCH v3 1/6] drm/sysfs: introduce drm_sysfs_connector_hotplug_event Simon Ser
2021-10-15 19:37   ` Sam Ravnborg [this message]
2021-10-15 19:42     ` Sam Ravnborg
2021-10-15 16:33 ` [PATCH v3 2/6] drm/probe-helper: add drm_kms_helper_connector_hotplug_event Simon Ser
2021-10-15 19:43   ` Sam Ravnborg
2021-10-15 16:33 ` [PATCH v3 3/6] drm/connector: use drm_sysfs_connector_hotplug_event Simon Ser
2021-10-15 19:44   ` Sam Ravnborg
2021-10-27 13:15   ` Pekka Paalanen
2021-10-27 13:26     ` Simon Ser
2021-10-28  7:32       ` Pekka Paalanen
2021-10-15 16:33 ` [PATCH v3 4/6] amdgpu: use drm_kms_helper_connector_hotplug_event Simon Ser
2021-10-15 19:26   ` Harry Wentland
2021-10-15 16:33 ` [PATCH v3 5/6] drm/probe-helper: " Simon Ser
2021-10-15 19:41   ` Ville Syrjälä
2021-10-18  8:43     ` Simon Ser
2021-10-15 20:03   ` Sam Ravnborg
2021-10-18  8:45     ` Simon Ser
2021-10-18  8:15   ` Maxime Ripard
2021-10-18  8:44     ` Simon Ser
2021-10-15 16:33 ` [PATCH v3 6/6] i915/display/dp: send a more fine-grained link-status uevent Simon Ser
2021-10-15 19:44   ` Ville Syrjälä
2021-10-18  8:42     ` Simon Ser
2021-10-16 14:03   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWnYYNLL+Sg6JXYL@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=contact@emersion.fr \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox