Skip to contentSkip to conversation

drm/dsi: Add uevent callback

PATCH In review Thierry Reding 2 participants 3 messages Jun 3, 2016 – Jun 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/dsi: Add uevent callback

From: Thierry Reding <[email protected]>

Implement a uevent callback for devices on the MIPI DSI bus. This callback will append MODALIAS information to the uevent and allow modules to be loaded when devices are added to the bus.

---
 drivers/gpu/drm/drm_mipi_dsi.c | 16 ++++++++++++++++
 include/drm/drm_mipi_dsi.h     |  2 ++
 2 files changed, 18 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +16 -0
index f5d80839a90c..2181699d5b3b 100644
@@ -60,6 +60,21 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
 	return 0;
 }
 
+static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
+	int err;
+
+	err = of_device_uevent_modalias(dev, env);
+	if (err != -ENODEV)
+		return err;
+
+	add_uevent_var(env, "MODALIAS=%s%s", MIPI_DSI_MODULE_PREFIX,
+		       dsi->name);
+
+	return 0;
+}
+
 static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
 	.runtime_suspend = pm_generic_runtime_suspend,
 	.runtime_resume = pm_generic_runtime_resume,
@@ -74,6 +89,7 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
 static struct bus_type mipi_dsi_bus_type = {
 	.name = "mipi-dsi",
 	.match = mipi_dsi_device_match,
+	.uevent = mipi_dsi_uevent,
 	.pm = &mipi_dsi_device_pm_ops,
 };
 
include/drm/drm_mipi_dsi.h +2 -0
index 7a9840f8b38e..765c04348b7f 100644
@@ -180,6 +180,8 @@ struct mipi_dsi_device {
 	unsigned long mode_flags;
 };
 
+#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"
+
 static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
 {
 	return container_of(dev, struct mipi_dsi_device, dev);
Signature · 6 lines
2.8.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Implement a uevent callback for devices on the MIPI DSI bus. This callback will append MODALIAS information to the uevent and allow modules to be loaded when devices are added to the bus.

Quoted 55 lines
---
  drivers/gpu/drm/drm_mipi_dsi.c | 16 ++++++++++++++++
  include/drm/drm_mipi_dsi.h     |  2 ++
  2 files changed, 18 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +16 -0
index f5d80839a90c..2181699d5b3b 100644
@@ -60,6 +60,21 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
  	return 0;
  }
 
+static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
+	int err;
+
+	err = of_device_uevent_modalias(dev, env);
+	if (err != -ENODEV)
+		return err;
+
+	add_uevent_var(env, "MODALIAS=%s%s", MIPI_DSI_MODULE_PREFIX,
+		       dsi->name);
+
+	return 0;
+}
+
  static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
  	.runtime_suspend = pm_generic_runtime_suspend,
  	.runtime_resume = pm_generic_runtime_resume,
@@ -74,6 +89,7 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
  static struct bus_type mipi_dsi_bus_type = {
  	.name = "mipi-dsi",
  	.match = mipi_dsi_device_match,
+	.uevent = mipi_dsi_uevent,
  	.pm = &mipi_dsi_device_pm_ops,
  };
 
include/drm/drm_mipi_dsi.h +2 -0
index 7a9840f8b38e..765c04348b7f 100644
@@ -180,6 +180,8 @@ struct mipi_dsi_device {
  	unsigned long mode_flags;
  };
 
+#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"
+
  static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
  {
  	return container_of(dev, struct mipi_dsi_device, dev);
Signature · 5 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author Applied
#2 lore raw
Quoted 10 lines · Archit Taneja
Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Implement a uevent callback for devices on the MIPI DSI bus. This callback will append MODALIAS information to the uevent and allow modules to be loaded when devices are added to the bus.

Applied to topic/drm-misc.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel