All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/4] drm/tinydrm: drm_of_find_backlight helper
@ 2017-09-30  9:03 ` Meghana Madhyastha
  0 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:03 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

This patchset introduces some changes such as move
tinydrm_of_find_backlight to drm_of.c and rename it to
drm_of_find_backlight for better organizational structure.

Changes in v5:
-Fix kbuild errors and warnings

Meghana Madhyastha (4):
  drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
  drm/tinydrm: Add devres versions of drm_of_find_backlight
  drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
  drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE

 drivers/gpu/drm/Kconfig                        |  2 +
 drivers/gpu/drm/drm_of.c                       | 91 ++++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 -----------
 drivers/gpu/drm/tinydrm/mi0283qt.c             |  3 +-
 include/drm/drm_of.h                           | 15 +++++
 include/drm/tinydrm/tinydrm-helpers.h          |  1 -
 6 files changed, 110 insertions(+), 42 deletions(-)

-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 0/4] drm/tinydrm: drm_of_find_backlight helper
@ 2017-09-30  9:03 ` Meghana Madhyastha
  0 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:03 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

This patchset introduces some changes such as move
tinydrm_of_find_backlight to drm_of.c and rename it to
drm_of_find_backlight for better organizational structure.

Changes in v5:
-Fix kbuild errors and warnings

Meghana Madhyastha (4):
  drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
  drm/tinydrm: Add devres versions of drm_of_find_backlight
  drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
  drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE

 drivers/gpu/drm/Kconfig                        |  2 +
 drivers/gpu/drm/drm_of.c                       | 91 ++++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 -----------
 drivers/gpu/drm/tinydrm/mi0283qt.c             |  3 +-
 include/drm/drm_of.h                           | 15 +++++
 include/drm/tinydrm/tinydrm-helpers.h          |  1 -
 6 files changed, 110 insertions(+), 42 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 1/4] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
  2017-09-30  9:03 ` Meghana Madhyastha
@ 2017-09-30  9:04   ` Meghana Madhyastha
  -1 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:04 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Rename tinydrm_of_find_backlight to drm_of_find_backlight
and move it into drm_of.c from tinydrm-helpers.c. This is
because other drivers in the drm subsystem might need to call
this function. In that case and otherwise, it is better from
an organizational point of view to move it into drm_of.c along
with the other _of.c functions.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-None

 drivers/gpu/drm/drm_of.c                       | 44 ++++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 -----------------------
 drivers/gpu/drm/tinydrm/mi0283qt.c             |  3 +-
 include/drm/drm_of.h                           |  1 +
 include/drm/tinydrm/tinydrm-helpers.h          |  1 -
 5 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 8dafbdf..d878d3a 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -1,6 +1,7 @@
 #include <linux/component.h>
 #include <linux/export.h>
 #include <linux/list.h>
+#include <linux/backlight.h>
 #include <linux/of_graph.h>
 #include <drm/drmP.h>
 #include <drm/drm_bridge.h>
@@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
+
+/**
+ * drm_of_find_backlight - Find backlight device in device-tree
+ * @dev: Device
+ *
+ * This function looks for a DT node pointed to by a property named 'backlight'
+ * and uses of_find_backlight_by_node() to get the backlight device.
+ * Additionally if the brightness property is zero, it is set to
+ * max_brightness.
+ *
+ * Note: It is the responsibility of the caller to call put_device() when
+ * releasing the resource.
+ *
+ * Returns:
+ * NULL if there's no backlight property.
+ * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
+ * is found.
+ * If the backlight device is found, a pointer to the structure is returned.
+ */
+struct backlight_device *drm_of_find_backlight(struct device *dev)
+{
+	struct backlight_device *backlight;
+	struct device_node *np;
+
+	np = of_parse_phandle(dev->of_node, "backlight", 0);
+	if (!np)
+		return NULL;
+
+	backlight = of_find_backlight_by_node(np);
+	of_node_put(np);
+
+	if (!backlight)
+		return ERR_PTR(-EPROBE_DEFER);
+
+	if (!backlight->props.brightness) {
+		backlight->props.brightness = backlight->props.max_brightness;
+		DRM_DEBUG_KMS("Backlight brightness set to %d\n",
+			      backlight->props.brightness);
+	}
+
+	return backlight;
+}
+EXPORT_SYMBOL(drm_of_find_backlight);
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index bd6cce0..cd4c6a5 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -237,46 +237,6 @@ void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
 EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8);
 
 /**
- * tinydrm_of_find_backlight - Find backlight device in device-tree
- * @dev: Device
- *
- * This function looks for a DT node pointed to by a property named 'backlight'
- * and uses of_find_backlight_by_node() to get the backlight device.
- * Additionally if the brightness property is zero, it is set to
- * max_brightness.
- *
- * Returns:
- * NULL if there's no backlight property.
- * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
- * is found.
- * If the backlight device is found, a pointer to the structure is returned.
- */
-struct backlight_device *tinydrm_of_find_backlight(struct device *dev)
-{
-	struct backlight_device *backlight;
-	struct device_node *np;
-
-	np = of_parse_phandle(dev->of_node, "backlight", 0);
-	if (!np)
-		return NULL;
-
-	backlight = of_find_backlight_by_node(np);
-	of_node_put(np);
-
-	if (!backlight)
-		return ERR_PTR(-EPROBE_DEFER);
-
-	if (!backlight->props.brightness) {
-		backlight->props.brightness = backlight->props.max_brightness;
-		DRM_DEBUG_KMS("Backlight brightness set to %d\n",
-			      backlight->props.brightness);
-	}
-
-	return backlight;
-}
-EXPORT_SYMBOL(tinydrm_of_find_backlight);
-
-/**
  * tinydrm_enable_backlight - Enable backlight helper
  * @backlight: Backlight device
  *
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 7e5bb7d..5e3d635 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -12,6 +12,7 @@
 #include <drm/tinydrm/ili9341.h>
 #include <drm/tinydrm/mipi-dbi.h>
 #include <drm/tinydrm/tinydrm-helpers.h>
+#include <drm/drm_of.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -189,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 	if (IS_ERR(mipi->regulator))
 		return PTR_ERR(mipi->regulator);
 
-	mipi->backlight = tinydrm_of_find_backlight(dev);
+	mipi->backlight = drm_of_find_backlight(dev);
 	if (IS_ERR(mipi->backlight))
 		return PTR_ERR(mipi->backlight);
 
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 104dd51..e8fba5b 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -29,6 +29,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 				int port, int endpoint,
 				struct drm_panel **panel,
 				struct drm_bridge **bridge);
+struct backlight_device *drm_of_find_backlight(struct device *dev);
 #else
 static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
 						  struct device_node *port)
diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
index d554ded..e40ef2d 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -46,7 +46,6 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
 void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
 			       struct drm_clip_rect *clip);
 
-struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
 int tinydrm_enable_backlight(struct backlight_device *backlight);
 int tinydrm_disable_backlight(struct backlight_device *backlight);
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 1/4] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c
@ 2017-09-30  9:04   ` Meghana Madhyastha
  0 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:04 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Rename tinydrm_of_find_backlight to drm_of_find_backlight
and move it into drm_of.c from tinydrm-helpers.c. This is
because other drivers in the drm subsystem might need to call
this function. In that case and otherwise, it is better from
an organizational point of view to move it into drm_of.c along
with the other _of.c functions.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-None

 drivers/gpu/drm/drm_of.c                       | 44 ++++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 -----------------------
 drivers/gpu/drm/tinydrm/mi0283qt.c             |  3 +-
 include/drm/drm_of.h                           |  1 +
 include/drm/tinydrm/tinydrm-helpers.h          |  1 -
 5 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 8dafbdf..d878d3a 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -1,6 +1,7 @@
 #include <linux/component.h>
 #include <linux/export.h>
 #include <linux/list.h>
+#include <linux/backlight.h>
 #include <linux/of_graph.h>
 #include <drm/drmP.h>
 #include <drm/drm_bridge.h>
@@ -260,3 +261,46 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
+
+/**
+ * drm_of_find_backlight - Find backlight device in device-tree
+ * @dev: Device
+ *
+ * This function looks for a DT node pointed to by a property named 'backlight'
+ * and uses of_find_backlight_by_node() to get the backlight device.
+ * Additionally if the brightness property is zero, it is set to
+ * max_brightness.
+ *
+ * Note: It is the responsibility of the caller to call put_device() when
+ * releasing the resource.
+ *
+ * Returns:
+ * NULL if there's no backlight property.
+ * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
+ * is found.
+ * If the backlight device is found, a pointer to the structure is returned.
+ */
+struct backlight_device *drm_of_find_backlight(struct device *dev)
+{
+	struct backlight_device *backlight;
+	struct device_node *np;
+
+	np = of_parse_phandle(dev->of_node, "backlight", 0);
+	if (!np)
+		return NULL;
+
+	backlight = of_find_backlight_by_node(np);
+	of_node_put(np);
+
+	if (!backlight)
+		return ERR_PTR(-EPROBE_DEFER);
+
+	if (!backlight->props.brightness) {
+		backlight->props.brightness = backlight->props.max_brightness;
+		DRM_DEBUG_KMS("Backlight brightness set to %d\n",
+			      backlight->props.brightness);
+	}
+
+	return backlight;
+}
+EXPORT_SYMBOL(drm_of_find_backlight);
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index bd6cce0..cd4c6a5 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -237,46 +237,6 @@ void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
 EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8);
 
 /**
- * tinydrm_of_find_backlight - Find backlight device in device-tree
- * @dev: Device
- *
- * This function looks for a DT node pointed to by a property named 'backlight'
- * and uses of_find_backlight_by_node() to get the backlight device.
- * Additionally if the brightness property is zero, it is set to
- * max_brightness.
- *
- * Returns:
- * NULL if there's no backlight property.
- * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
- * is found.
- * If the backlight device is found, a pointer to the structure is returned.
- */
-struct backlight_device *tinydrm_of_find_backlight(struct device *dev)
-{
-	struct backlight_device *backlight;
-	struct device_node *np;
-
-	np = of_parse_phandle(dev->of_node, "backlight", 0);
-	if (!np)
-		return NULL;
-
-	backlight = of_find_backlight_by_node(np);
-	of_node_put(np);
-
-	if (!backlight)
-		return ERR_PTR(-EPROBE_DEFER);
-
-	if (!backlight->props.brightness) {
-		backlight->props.brightness = backlight->props.max_brightness;
-		DRM_DEBUG_KMS("Backlight brightness set to %d\n",
-			      backlight->props.brightness);
-	}
-
-	return backlight;
-}
-EXPORT_SYMBOL(tinydrm_of_find_backlight);
-
-/**
  * tinydrm_enable_backlight - Enable backlight helper
  * @backlight: Backlight device
  *
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 7e5bb7d..5e3d635 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -12,6 +12,7 @@
 #include <drm/tinydrm/ili9341.h>
 #include <drm/tinydrm/mipi-dbi.h>
 #include <drm/tinydrm/tinydrm-helpers.h>
+#include <drm/drm_of.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -189,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 	if (IS_ERR(mipi->regulator))
 		return PTR_ERR(mipi->regulator);
 
-	mipi->backlight = tinydrm_of_find_backlight(dev);
+	mipi->backlight = drm_of_find_backlight(dev);
 	if (IS_ERR(mipi->backlight))
 		return PTR_ERR(mipi->backlight);
 
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 104dd51..e8fba5b 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -29,6 +29,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 				int port, int endpoint,
 				struct drm_panel **panel,
 				struct drm_bridge **bridge);
+struct backlight_device *drm_of_find_backlight(struct device *dev);
 #else
 static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
 						  struct device_node *port)
diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
index d554ded..e40ef2d 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -46,7 +46,6 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
 void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
 			       struct drm_clip_rect *clip);
 
-struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
 int tinydrm_enable_backlight(struct backlight_device *backlight);
 int tinydrm_disable_backlight(struct backlight_device *backlight);
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 2/4] drm/tinydrm: Add devres versions of drm_of_find_backlight
  2017-09-30  9:03 ` Meghana Madhyastha
@ 2017-09-30  9:05   ` Meghana Madhyastha
  -1 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:05 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Add devm_drm_of_find_backlight and the corresponding release
function because some drivers such as tinydrm use devres versions
of functions for requiring device resources.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-None

 drivers/gpu/drm/drm_of.c           | 47 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
 include/drm/drm_of.h               |  1 +
 3 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index d878d3a..cd80dfc 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -304,3 +304,50 @@ struct backlight_device *drm_of_find_backlight(struct device *dev)
 	return backlight;
 }
 EXPORT_SYMBOL(drm_of_find_backlight);
+
+/**
+ * devm_drm_of_find_backlight_release - Release backlight device
+ * @dev: Device
+ *
+ * This is the release function corresponding to the devm_drm_of_find_backlight.
+ * Each devres entry is associated with a release function.
+ */
+static void devm_drm_of_find_backlight_release(void *data)
+{
+	put_device(data);
+}
+
+/**
+ * devm_drm_of_find_backlight - Find backlight device in device-tree
+ * devres version of the function
+ * @dev: Device
+ *
+ * This is the devres version of the function drm_of_find_backlight.
+ * Some drivers use devres versions of functions for
+ * requiring device resources.
+ *
+ * Returns:
+ * NULL if there's no backlight property.
+ * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
+ * is found.
+ * If the backlight device is found, a pointer to the structure is returned.
+ */
+struct backlight_device *devm_drm_of_find_backlight(struct device *dev)
+{
+	struct backlight_device *backlight;
+	int ret;
+
+	backlight = drm_of_find_backlight(dev);
+	if (IS_ERR_OR_NULL(backlight))
+		return backlight;
+
+	ret = devm_add_action(dev, devm_drm_of_find_backlight_release,
+			      &backlight->dev);
+	if (ret) {
+		put_device(&backlight->dev);
+		return ERR_PTR(ret);
+	}
+
+	return backlight;
+}
+EXPORT_SYMBOL(devm_drm_of_find_backlight);
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 5e3d635..d37f658 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 	if (IS_ERR(mipi->regulator))
 		return PTR_ERR(mipi->regulator);
 
-	mipi->backlight = drm_of_find_backlight(dev);
+	mipi->backlight = devm_drm_of_find_backlight(dev);
 	if (IS_ERR(mipi->backlight))
 		return PTR_ERR(mipi->backlight);
 
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index e8fba5b..b2d6e0c 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -30,6 +30,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 				struct drm_panel **panel,
 				struct drm_bridge **bridge);
 struct backlight_device *drm_of_find_backlight(struct device *dev);
+struct backlight_device *devm_drm_of_find_backlight(struct device *dev);
 #else
 static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
 						  struct device_node *port)
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 2/4] drm/tinydrm: Add devres versions of drm_of_find_backlight
@ 2017-09-30  9:05   ` Meghana Madhyastha
  0 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:05 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Add devm_drm_of_find_backlight and the corresponding release
function because some drivers such as tinydrm use devres versions
of functions for requiring device resources.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-None

 drivers/gpu/drm/drm_of.c           | 47 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
 include/drm/drm_of.h               |  1 +
 3 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index d878d3a..cd80dfc 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -304,3 +304,50 @@ struct backlight_device *drm_of_find_backlight(struct device *dev)
 	return backlight;
 }
 EXPORT_SYMBOL(drm_of_find_backlight);
+
+/**
+ * devm_drm_of_find_backlight_release - Release backlight device
+ * @dev: Device
+ *
+ * This is the release function corresponding to the devm_drm_of_find_backlight.
+ * Each devres entry is associated with a release function.
+ */
+static void devm_drm_of_find_backlight_release(void *data)
+{
+	put_device(data);
+}
+
+/**
+ * devm_drm_of_find_backlight - Find backlight device in device-tree
+ * devres version of the function
+ * @dev: Device
+ *
+ * This is the devres version of the function drm_of_find_backlight.
+ * Some drivers use devres versions of functions for
+ * requiring device resources.
+ *
+ * Returns:
+ * NULL if there's no backlight property.
+ * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
+ * is found.
+ * If the backlight device is found, a pointer to the structure is returned.
+ */
+struct backlight_device *devm_drm_of_find_backlight(struct device *dev)
+{
+	struct backlight_device *backlight;
+	int ret;
+
+	backlight = drm_of_find_backlight(dev);
+	if (IS_ERR_OR_NULL(backlight))
+		return backlight;
+
+	ret = devm_add_action(dev, devm_drm_of_find_backlight_release,
+			      &backlight->dev);
+	if (ret) {
+		put_device(&backlight->dev);
+		return ERR_PTR(ret);
+	}
+
+	return backlight;
+}
+EXPORT_SYMBOL(devm_drm_of_find_backlight);
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 5e3d635..d37f658 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 	if (IS_ERR(mipi->regulator))
 		return PTR_ERR(mipi->regulator);
 
-	mipi->backlight = drm_of_find_backlight(dev);
+	mipi->backlight = devm_drm_of_find_backlight(dev);
 	if (IS_ERR(mipi->backlight))
 		return PTR_ERR(mipi->backlight);
 
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index e8fba5b..b2d6e0c 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -30,6 +30,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
 				struct drm_panel **panel,
 				struct drm_bridge **bridge);
 struct backlight_device *drm_of_find_backlight(struct device *dev);
+struct backlight_device *devm_drm_of_find_backlight(struct device *dev);
 #else
 static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
 						  struct device_node *port)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 3/4] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
  2017-09-30  9:03 ` Meghana Madhyastha
@ 2017-09-30  9:07   ` Meghana Madhyastha
  -1 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:07 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Add the dummy versions (function definition returning -EINVAL) of
drm_of_find_backlight and devm_drm_of_find_backlight in the #else
part of the conditional directive in drm_of.h. This is needed
for drivers where CONFIG_OF is optional.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-Fix the kbuild errors and warnings such as return 0 instead of -EINVAL.

 include/drm/drm_of.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index b2d6e0c..55c9304 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -60,6 +60,7 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node,
 {
 	return -EINVAL;
 }
+
 static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
 					      int port, int endpoint,
 					      struct drm_panel **panel,
@@ -67,6 +68,18 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
 {
 	return -EINVAL;
 }
+
+static inline struct backlight_device *drm_of_find_backlight(
+					struct device *dev)
+{
+	return 0;
+}
+
+static inline struct backlight_device *devm_drm_of_find_backlight(
+						struct device *dev)
+{
+	return 0;
+}
 #endif
 
 static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 3/4] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
@ 2017-09-30  9:07   ` Meghana Madhyastha
  0 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:07 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Add the dummy versions (function definition returning -EINVAL) of
drm_of_find_backlight and devm_drm_of_find_backlight in the #else
part of the conditional directive in drm_of.h. This is needed
for drivers where CONFIG_OF is optional.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-Fix the kbuild errors and warnings such as return 0 instead of -EINVAL.

 include/drm/drm_of.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index b2d6e0c..55c9304 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -60,6 +60,7 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node,
 {
 	return -EINVAL;
 }
+
 static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
 					      int port, int endpoint,
 					      struct drm_panel **panel,
@@ -67,6 +68,18 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
 {
 	return -EINVAL;
 }
+
+static inline struct backlight_device *drm_of_find_backlight(
+					struct device *dev)
+{
+	return 0;
+}
+
+static inline struct backlight_device *devm_drm_of_find_backlight(
+						struct device *dev)
+{
+	return 0;
+}
 #endif
 
 static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
  2017-09-30  9:03 ` Meghana Madhyastha
@ 2017-09-30  9:10   ` Meghana Madhyastha
  -1 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:10 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Add select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE to
the Kconfig of drm. This is required for the successful build of
drm_of_find_backlight helpers.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-This commit was not present in v4. Selecting BACKLIGHT_LCD_SUPPORT,
BACKLIGHT_CLASS_DEVICE in the Kconfig file under the symbol DRM seems
to fix the Kbuild error drm_of.c:(.text+0x3bc): undefined reference to
`of_find_backlight_by_node'.

 drivers/gpu/drm/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 83cb2a8..3ba5632 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -7,6 +7,8 @@
 menuconfig DRM
 	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
 	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
+	select BACKLIGHT_LCD_SUPPORT
+	select BACKLIGHT_CLASS_DEVICE
 	select HDMI
 	select FB_CMDLINE
 	select I2C
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
@ 2017-09-30  9:10   ` Meghana Madhyastha
  0 siblings, 0 replies; 20+ messages in thread
From: Meghana Madhyastha @ 2017-09-30  9:10 UTC (permalink / raw)
  To: daniel, noralf, outreachy-kernel, dri-devel

Add select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE to
the Kconfig of drm. This is required for the successful build of
drm_of_find_backlight helpers.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
Changes in v5:
-This commit was not present in v4. Selecting BACKLIGHT_LCD_SUPPORT,
BACKLIGHT_CLASS_DEVICE in the Kconfig file under the symbol DRM seems
to fix the Kbuild error drm_of.c:(.text+0x3bc): undefined reference to
`of_find_backlight_by_node'.

 drivers/gpu/drm/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 83cb2a8..3ba5632 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -7,6 +7,8 @@
 menuconfig DRM
 	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
 	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
+	select BACKLIGHT_LCD_SUPPORT
+	select BACKLIGHT_CLASS_DEVICE
 	select HDMI
 	select FB_CMDLINE
 	select I2C
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 2/4] drm/tinydrm: Add devres versions of drm_of_find_backlight
  2017-09-30  9:05   ` Meghana Madhyastha
@ 2017-09-30 13:43     ` Noralf Trønnes
  -1 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-09-30 13:43 UTC (permalink / raw)
  To: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel


Den 30.09.2017 11.05, skrev Meghana Madhyastha:
> Add devm_drm_of_find_backlight and the corresponding release
> function because some drivers such as tinydrm use devres versions
> of functions for requiring device resources.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---
> Changes in v5:
> -None
>
>   drivers/gpu/drm/drm_of.c           | 47 ++++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
>   include/drm/drm_of.h               |  1 +
>   3 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> index d878d3a..cd80dfc 100644
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -304,3 +304,50 @@ struct backlight_device *drm_of_find_backlight(struct device *dev)
>   	return backlight;
>   }
>   EXPORT_SYMBOL(drm_of_find_backlight);
> +
> +/**
> + * devm_drm_of_find_backlight_release - Release backlight device
> + * @dev: Device
> + *
> + * This is the release function corresponding to the devm_drm_of_find_backlight.
> + * Each devres entry is associated with a release function.
> + */

No docs on internal functions.

> +static void devm_drm_of_find_backlight_release(void *data)
> +{
> +	put_device(data);
> +}
> +
> +/**
> + * devm_drm_of_find_backlight - Find backlight device in device-tree
> + * devres version of the function
> + * @dev: Device
> + *
> + * This is the devres version of the function drm_of_find_backlight.
> + * Some drivers use devres versions of functions for
> + * requiring device resources.
> + *
> + * Returns:
> + * NULL if there's no backlight property.
> + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
> + * is found.
> + * If the backlight device is found, a pointer to the structure is returned.
> + */
> +struct backlight_device *devm_drm_of_find_backlight(struct device *dev)
> +{
> +	struct backlight_device *backlight;
> +	int ret;
> +
> +	backlight = drm_of_find_backlight(dev);
> +	if (IS_ERR_OR_NULL(backlight))
> +		return backlight;
> +
> +	ret = devm_add_action(dev, devm_drm_of_find_backlight_release,
> +			      &backlight->dev);
> +	if (ret) {
> +		put_device(&backlight->dev);
> +		return ERR_PTR(ret);
> +	}
> +
> +	return backlight;
> +}
> +EXPORT_SYMBOL(devm_drm_of_find_backlight);
> diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
> index 5e3d635..d37f658 100644
> --- a/drivers/gpu/drm/tinydrm/mi0283qt.c
> +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
> @@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
>   	if (IS_ERR(mipi->regulator))
>   		return PTR_ERR(mipi->regulator);
>   
> -	mipi->backlight = drm_of_find_backlight(dev);
> +	mipi->backlight = devm_drm_of_find_backlight(dev);
>   	if (IS_ERR(mipi->backlight))
>   		return PTR_ERR(mipi->backlight);
>   
> diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
> index e8fba5b..b2d6e0c 100644
> --- a/include/drm/drm_of.h
> +++ b/include/drm/drm_of.h
> @@ -30,6 +30,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
>   				struct drm_panel **panel,
>   				struct drm_bridge **bridge);
>   struct backlight_device *drm_of_find_backlight(struct device *dev);
> +struct backlight_device *devm_drm_of_find_backlight(struct device *dev);
>   #else
>   static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
>   						  struct device_node *port)

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 2/4] drm/tinydrm: Add devres versions of drm_of_find_backlight
@ 2017-09-30 13:43     ` Noralf Trønnes
  0 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-09-30 13:43 UTC (permalink / raw)
  To: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel


Den 30.09.2017 11.05, skrev Meghana Madhyastha:
> Add devm_drm_of_find_backlight and the corresponding release
> function because some drivers such as tinydrm use devres versions
> of functions for requiring device resources.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---
> Changes in v5:
> -None
>
>   drivers/gpu/drm/drm_of.c           | 47 ++++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
>   include/drm/drm_of.h               |  1 +
>   3 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> index d878d3a..cd80dfc 100644
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -304,3 +304,50 @@ struct backlight_device *drm_of_find_backlight(struct device *dev)
>   	return backlight;
>   }
>   EXPORT_SYMBOL(drm_of_find_backlight);
> +
> +/**
> + * devm_drm_of_find_backlight_release - Release backlight device
> + * @dev: Device
> + *
> + * This is the release function corresponding to the devm_drm_of_find_backlight.
> + * Each devres entry is associated with a release function.
> + */

No docs on internal functions.

> +static void devm_drm_of_find_backlight_release(void *data)
> +{
> +	put_device(data);
> +}
> +
> +/**
> + * devm_drm_of_find_backlight - Find backlight device in device-tree
> + * devres version of the function
> + * @dev: Device
> + *
> + * This is the devres version of the function drm_of_find_backlight.
> + * Some drivers use devres versions of functions for
> + * requiring device resources.
> + *
> + * Returns:
> + * NULL if there's no backlight property.
> + * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
> + * is found.
> + * If the backlight device is found, a pointer to the structure is returned.
> + */
> +struct backlight_device *devm_drm_of_find_backlight(struct device *dev)
> +{
> +	struct backlight_device *backlight;
> +	int ret;
> +
> +	backlight = drm_of_find_backlight(dev);
> +	if (IS_ERR_OR_NULL(backlight))
> +		return backlight;
> +
> +	ret = devm_add_action(dev, devm_drm_of_find_backlight_release,
> +			      &backlight->dev);
> +	if (ret) {
> +		put_device(&backlight->dev);
> +		return ERR_PTR(ret);
> +	}
> +
> +	return backlight;
> +}
> +EXPORT_SYMBOL(devm_drm_of_find_backlight);
> diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
> index 5e3d635..d37f658 100644
> --- a/drivers/gpu/drm/tinydrm/mi0283qt.c
> +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
> @@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
>   	if (IS_ERR(mipi->regulator))
>   		return PTR_ERR(mipi->regulator);
>   
> -	mipi->backlight = drm_of_find_backlight(dev);
> +	mipi->backlight = devm_drm_of_find_backlight(dev);
>   	if (IS_ERR(mipi->backlight))
>   		return PTR_ERR(mipi->backlight);
>   
> diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
> index e8fba5b..b2d6e0c 100644
> --- a/include/drm/drm_of.h
> +++ b/include/drm/drm_of.h
> @@ -30,6 +30,7 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
>   				struct drm_panel **panel,
>   				struct drm_bridge **bridge);
>   struct backlight_device *drm_of_find_backlight(struct device *dev);
> +struct backlight_device *devm_drm_of_find_backlight(struct device *dev);
>   #else
>   static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
>   						  struct device_node *port)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 3/4] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
  2017-09-30  9:07   ` Meghana Madhyastha
@ 2017-09-30 13:46     ` Noralf Trønnes
  -1 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-09-30 13:46 UTC (permalink / raw)
  To: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel


Den 30.09.2017 11.07, skrev Meghana Madhyastha:
> Add the dummy versions (function definition returning -EINVAL) of
> drm_of_find_backlight and devm_drm_of_find_backlight in the #else
> part of the conditional directive in drm_of.h. This is needed
> for drivers where CONFIG_OF is optional.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---

You have to fold this into the previous patches, or else someone bisecting
might end up with a broken build.
And you need to return NULL. This shows that you haven't tried building
with CONFIG_OF=n ;-)

Noralf.

> Changes in v5:
> -Fix the kbuild errors and warnings such as return 0 instead of -EINVAL.
>
>   include/drm/drm_of.h | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
> index b2d6e0c..55c9304 100644
> --- a/include/drm/drm_of.h
> +++ b/include/drm/drm_of.h
> @@ -60,6 +60,7 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node,
>   {
>   	return -EINVAL;
>   }
> +
>   static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
>   					      int port, int endpoint,
>   					      struct drm_panel **panel,
> @@ -67,6 +68,18 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
>   {
>   	return -EINVAL;
>   }
> +
> +static inline struct backlight_device *drm_of_find_backlight(
> +					struct device *dev)
> +{
> +	return 0;
> +}
> +
> +static inline struct backlight_device *devm_drm_of_find_backlight(
> +						struct device *dev)
> +{
> +	return 0;
> +}
>   #endif
>   
>   static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 3/4] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions
@ 2017-09-30 13:46     ` Noralf Trønnes
  0 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-09-30 13:46 UTC (permalink / raw)
  To: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel


Den 30.09.2017 11.07, skrev Meghana Madhyastha:
> Add the dummy versions (function definition returning -EINVAL) of
> drm_of_find_backlight and devm_drm_of_find_backlight in the #else
> part of the conditional directive in drm_of.h. This is needed
> for drivers where CONFIG_OF is optional.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---

You have to fold this into the previous patches, or else someone bisecting
might end up with a broken build.
And you need to return NULL. This shows that you haven't tried building
with CONFIG_OF=n ;-)

Noralf.

> Changes in v5:
> -Fix the kbuild errors and warnings such as return 0 instead of -EINVAL.
>
>   include/drm/drm_of.h | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
> index b2d6e0c..55c9304 100644
> --- a/include/drm/drm_of.h
> +++ b/include/drm/drm_of.h
> @@ -60,6 +60,7 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node,
>   {
>   	return -EINVAL;
>   }
> +
>   static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
>   					      int port, int endpoint,
>   					      struct drm_panel **panel,
> @@ -67,6 +68,18 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
>   {
>   	return -EINVAL;
>   }
> +
> +static inline struct backlight_device *drm_of_find_backlight(
> +					struct device *dev)
> +{
> +	return 0;
> +}
> +
> +static inline struct backlight_device *devm_drm_of_find_backlight(
> +						struct device *dev)
> +{
> +	return 0;
> +}
>   #endif
>   
>   static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
  2017-09-30  9:10   ` Meghana Madhyastha
@ 2017-09-30 13:49     ` Noralf Trønnes
  -1 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-09-30 13:49 UTC (permalink / raw)
  To: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel


Den 30.09.2017 11.10, skrev Meghana Madhyastha:
> Add select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE to
> the Kconfig of drm. This is required for the successful build of
> drm_of_find_backlight helpers.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---
> Changes in v5:
> -This commit was not present in v4. Selecting BACKLIGHT_LCD_SUPPORT,
> BACKLIGHT_CLASS_DEVICE in the Kconfig file under the symbol DRM seems
> to fix the Kbuild error drm_of.c:(.text+0x3bc): undefined reference to
> `of_find_backlight_by_node'.
>
>   drivers/gpu/drm/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 83cb2a8..3ba5632 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -7,6 +7,8 @@
>   menuconfig DRM
>   	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
>   	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> +	select BACKLIGHT_LCD_SUPPORT
> +	select BACKLIGHT_CLASS_DEVICE
>   	select HDMI
>   	select FB_CMDLINE
>   	select I2C

A night's sleep has made this more clear, we don't need 'depends on'
or select as you have tried here, it's enough that we make a change in
the backlight subsystem as I outlined earlier:

include/linux/backlight.h:

-#ifdef CONFIG_OF
+#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
  struct backlight_device *of_find_backlight_by_node(struct device_node 
*node);
  #else
  static inline struct backlight_device *
  of_find_backlight_by_node(struct device_node *node)
  {
      return NULL;
  }
  #endif

Now we don't have to care about backlight being built-in, module or 
disabled.

This patch has to be the first in the patchset. No single patch can 
break anything
even if it's fixed later. This is so people can bisect.

Noralf.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
@ 2017-09-30 13:49     ` Noralf Trønnes
  0 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-09-30 13:49 UTC (permalink / raw)
  To: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel


Den 30.09.2017 11.10, skrev Meghana Madhyastha:
> Add select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE to
> the Kconfig of drm. This is required for the successful build of
> drm_of_find_backlight helpers.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---
> Changes in v5:
> -This commit was not present in v4. Selecting BACKLIGHT_LCD_SUPPORT,
> BACKLIGHT_CLASS_DEVICE in the Kconfig file under the symbol DRM seems
> to fix the Kbuild error drm_of.c:(.text+0x3bc): undefined reference to
> `of_find_backlight_by_node'.
>
>   drivers/gpu/drm/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 83cb2a8..3ba5632 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -7,6 +7,8 @@
>   menuconfig DRM
>   	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
>   	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> +	select BACKLIGHT_LCD_SUPPORT
> +	select BACKLIGHT_CLASS_DEVICE
>   	select HDMI
>   	select FB_CMDLINE
>   	select I2C

A night's sleep has made this more clear, we don't need 'depends on'
or select as you have tried here, it's enough that we make a change in
the backlight subsystem as I outlined earlier:

include/linux/backlight.h:

-#ifdef CONFIG_OF
+#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
  struct backlight_device *of_find_backlight_by_node(struct device_node 
*node);
  #else
  static inline struct backlight_device *
  of_find_backlight_by_node(struct device_node *node)
  {
      return NULL;
  }
  #endif

Now we don't have to care about backlight being built-in, module or 
disabled.

This patch has to be the first in the patchset. No single patch can 
break anything
even if it's fixed later. This is so people can bisect.

Noralf.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
  2017-09-30 13:49     ` Noralf Trønnes
@ 2017-10-02  7:58       ` Daniel Vetter
  -1 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2017-10-02  7:58 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Meghana Madhyastha, outreachy-kernel, dri-devel

On Sat, Sep 30, 2017 at 03:49:43PM +0200, Noralf Trønnes wrote:
> 
> Den 30.09.2017 11.10, skrev Meghana Madhyastha:
> > Add select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE to
> > the Kconfig of drm. This is required for the successful build of
> > drm_of_find_backlight helpers.
> > 
> > Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> > ---
> > Changes in v5:
> > -This commit was not present in v4. Selecting BACKLIGHT_LCD_SUPPORT,
> > BACKLIGHT_CLASS_DEVICE in the Kconfig file under the symbol DRM seems
> > to fix the Kbuild error drm_of.c:(.text+0x3bc): undefined reference to
> > `of_find_backlight_by_node'.
> > 
> >   drivers/gpu/drm/Kconfig | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> > index 83cb2a8..3ba5632 100644
> > --- a/drivers/gpu/drm/Kconfig
> > +++ b/drivers/gpu/drm/Kconfig
> > @@ -7,6 +7,8 @@
> >   menuconfig DRM
> >   	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
> >   	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> > +	select BACKLIGHT_LCD_SUPPORT
> > +	select BACKLIGHT_CLASS_DEVICE
> >   	select HDMI
> >   	select FB_CMDLINE
> >   	select I2C
> 
> A night's sleep has made this more clear, we don't need 'depends on'
> or select as you have tried here, it's enough that we make a change in
> the backlight subsystem as I outlined earlier:
> 
> include/linux/backlight.h:
> 
> -#ifdef CONFIG_OF
> +#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
>  struct backlight_device *of_find_backlight_by_node(struct device_node
> *node);
>  #else
>  static inline struct backlight_device *
>  of_find_backlight_by_node(struct device_node *node)
>  {
>      return NULL;
>  }
>  #endif
> 
> Now we don't have to care about backlight being built-in, module or
> disabled.
> 
> This patch has to be the first in the patchset. No single patch can break
> anything
> even if it's fixed later. This is so people can bisect.

Adding Jani to double-check this plan ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
@ 2017-10-02  7:58       ` Daniel Vetter
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2017-10-02  7:58 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Meghana Madhyastha, daniel, outreachy-kernel, dri-devel, Jani Nikula

On Sat, Sep 30, 2017 at 03:49:43PM +0200, Noralf Tr�nnes wrote:
> 
> Den 30.09.2017 11.10, skrev Meghana Madhyastha:
> > Add select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE to
> > the Kconfig of drm. This is required for the successful build of
> > drm_of_find_backlight helpers.
> > 
> > Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> > ---
> > Changes in v5:
> > -This commit was not present in v4. Selecting BACKLIGHT_LCD_SUPPORT,
> > BACKLIGHT_CLASS_DEVICE in the Kconfig file under the symbol DRM seems
> > to fix the Kbuild error drm_of.c:(.text+0x3bc): undefined reference to
> > `of_find_backlight_by_node'.
> > 
> >   drivers/gpu/drm/Kconfig | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> > index 83cb2a8..3ba5632 100644
> > --- a/drivers/gpu/drm/Kconfig
> > +++ b/drivers/gpu/drm/Kconfig
> > @@ -7,6 +7,8 @@
> >   menuconfig DRM
> >   	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
> >   	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> > +	select BACKLIGHT_LCD_SUPPORT
> > +	select BACKLIGHT_CLASS_DEVICE
> >   	select HDMI
> >   	select FB_CMDLINE
> >   	select I2C
> 
> A night's sleep has made this more clear, we don't need 'depends on'
> or select as you have tried here, it's enough that we make a change in
> the backlight subsystem as I outlined earlier:
> 
> include/linux/backlight.h:
> 
> -#ifdef CONFIG_OF
> +#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
> �struct backlight_device *of_find_backlight_by_node(struct device_node
> *node);
> �#else
> �static inline struct backlight_device *
> �of_find_backlight_by_node(struct device_node *node)
> �{
> ���� return NULL;
> �}
> �#endif
> 
> Now we don't have to care about backlight being built-in, module or
> disabled.
> 
> This patch has to be the first in the patchset. No single patch can break
> anything
> even if it's fixed later. This is so people can bisect.

Adding Jani to double-check this plan ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
  2017-09-30  9:10   ` Meghana Madhyastha
@ 2017-10-03  0:56     ` kbuild test robot
  -1 siblings, 0 replies; 20+ messages in thread
From: kbuild test robot @ 2017-10-03  0:56 UTC (permalink / raw)
  To: Meghana Madhyastha; +Cc: outreachy-kernel, dri-devel, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

Hi Meghana,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc3 next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-drm_of_find_backlight-helper/20171003-030102
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x078-201740 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

warning: (DRM && DRM_RADEON && DRM_AMDGPU && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 && DRM_SHMOBILE && DRM_TILCDC && DRM_FSL_DCU && DRM_TINYDRM && DRM_PARADE_PS8622 && FB_BACKLIGHT && FB_ARMCLCD && FB_MX3 && USB_APPLEDISPLAY && FB_OLPC_DCON && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25134 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE
@ 2017-10-03  0:56     ` kbuild test robot
  0 siblings, 0 replies; 20+ messages in thread
From: kbuild test robot @ 2017-10-03  0:56 UTC (permalink / raw)
  To: Meghana Madhyastha
  Cc: kbuild-all, daniel, noralf, outreachy-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

Hi Meghana,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc3 next-20170929]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/drm-tinydrm-drm_of_find_backlight-helper/20171003-030102
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x078-201740 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

warning: (DRM && DRM_RADEON && DRM_AMDGPU && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 && DRM_SHMOBILE && DRM_TILCDC && DRM_FSL_DCU && DRM_TINYDRM && DRM_PARADE_PS8622 && FB_BACKLIGHT && FB_ARMCLCD && FB_MX3 && USB_APPLEDISPLAY && FB_OLPC_DCON && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25134 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-10-03  0:57 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-30  9:03 [PATCH v5 0/4] drm/tinydrm: drm_of_find_backlight helper Meghana Madhyastha
2017-09-30  9:03 ` Meghana Madhyastha
2017-09-30  9:04 ` [PATCH v5 1/4] drm/tinydrm: Move tinydrm_of_find_backlight into drm_of.c Meghana Madhyastha
2017-09-30  9:04   ` Meghana Madhyastha
2017-09-30  9:05 ` [PATCH v5 2/4] drm/tinydrm: Add devres versions of drm_of_find_backlight Meghana Madhyastha
2017-09-30  9:05   ` Meghana Madhyastha
2017-09-30 13:43   ` Noralf Trønnes
2017-09-30 13:43     ` Noralf Trønnes
2017-09-30  9:07 ` [PATCH v5 3/4] drm/tinydrm: Add the dummy versions of drm_of_find_backlight functions Meghana Madhyastha
2017-09-30  9:07   ` Meghana Madhyastha
2017-09-30 13:46   ` Noralf Trønnes
2017-09-30 13:46     ` Noralf Trønnes
2017-09-30  9:10 ` [PATCH v5 4/4] drm/tinydrm: select BACKLIGHT_LCD_SUPPORT, BACKLIGHT_CLASS_DEVICE Meghana Madhyastha
2017-09-30  9:10   ` Meghana Madhyastha
2017-09-30 13:49   ` Noralf Trønnes
2017-09-30 13:49     ` Noralf Trønnes
2017-10-02  7:58     ` Daniel Vetter
2017-10-02  7:58       ` Daniel Vetter
2017-10-03  0:56   ` kbuild test robot
2017-10-03  0:56     ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.