[1/2] media: dvbdev: export adapter's name and bus ID to DVB uevent variables

Message ID 22e1d85d8896681a3f3f9abdc323e634b49fa1fd.1708422122.git.mchehab@kernel.org
State New
Headers
Series Add some uevent variables on DVB to support persistent names on udev |

Commit Message

Mauro Carvalho Chehab Feb. 20, 2024, 9:46 a.m. UTC
  Add two new variables for uevent, helping udev to be able to setup
a persistent name for the device.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 drivers/media/dvb-core/dvbdev.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Hans Verkuil Feb. 26, 2024, 8:41 a.m. UTC | #1
On 20/02/2024 10:46, Mauro Carvalho Chehab wrote:
> Add two new variables for uevent, helping udev to be able to setup
> a persistent name for the device.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
>  drivers/media/dvb-core/dvbdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
> index 733d0bc4b4cc..01227c695cbd 100644
> --- a/drivers/media/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb-core/dvbdev.c
> @@ -1064,6 +1064,8 @@ static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
>  {
>  	const struct dvb_device *dvbdev = dev_get_drvdata(dev);
>  
> +	add_uevent_var(env, "DVB_ADAPTER_NAME=%s", dvbdev->adapter->name);
> +	add_uevent_var(env, "DVB_ADAPTER_PDEV=%s", dev_name(dev->parent));
>  	add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num);
>  	add_uevent_var(env, "DVB_DEVICE_TYPE=%s", dnames[dvbdev->type]);
>  	add_uevent_var(env, "DVB_DEVICE_NUM=%d", dvbdev->id);
  

Patch

diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 733d0bc4b4cc..01227c695cbd 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -1064,6 +1064,8 @@  static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
 	const struct dvb_device *dvbdev = dev_get_drvdata(dev);
 
+	add_uevent_var(env, "DVB_ADAPTER_NAME=%s", dvbdev->adapter->name);
+	add_uevent_var(env, "DVB_ADAPTER_PDEV=%s", dev_name(dev->parent));
 	add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num);
 	add_uevent_var(env, "DVB_DEVICE_TYPE=%s", dnames[dvbdev->type]);
 	add_uevent_var(env, "DVB_DEVICE_NUM=%d", dvbdev->id);