Skip to contentSkip to conversation

backlight: change the return type of backlight_update_status() to int

PATCH In review Hyungwon Hwang 3 participants 3 messages May 28, 2015 – May 29, 2015 Backlight class/subsystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backlight: change the return type of backlight_update_status() to int

Backlight device returns the result of update_status(), but backlight_update_status() ignores it. So the consumers cannot confirm the result of their function call. This patch makes the result to be returned back for consumers.

---
 include/linux/backlight.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
include/linux/backlight.h +6 -2
index adb14a8..1e7a69a 100644
@@ -117,12 +117,16 @@ struct backlight_device {
 	int use_count;
 };
 
-static inline void backlight_update_status(struct backlight_device *bd)
+static inline int backlight_update_status(struct backlight_device *bd)
 {
+	int ret = -ENOENT;
+
 	mutex_lock(&bd->update_lock);
 	if (bd->ops && bd->ops->update_status)
-		bd->ops->update_status(bd);
+		ret = bd->ops->update_status(bd);
 	mutex_unlock(&bd->update_lock);
+
+	return ret;
 }
 
 extern struct backlight_device *backlight_device_register(const char *name,
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Hyungwon Hwang

Backlight device returns the result of update_status(), but backlight_update_status() ignores it. So the consumers cannot confirm the result of their function call. This patch makes the result to be returned back for consumers.

Quoted 29 lines
---
 include/linux/backlight.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
include/linux/backlight.h +6 -3
index adb14a8..1e7a69a 100644
@@ -117,12 +117,16 @@ struct backlight_device {
 	int use_count;
 };
 
-static inline void backlight_update_status(struct backlight_device *bd)
+static inline int backlight_update_status(struct backlight_device *bd)
 {
+	int ret = -ENOENT;
+
 	mutex_lock(&bd->update_lock);
 	if (bd->ops && bd->ops->update_status)
-		bd->ops->update_status(bd);
+		ret = bd->ops->update_status(bd);
 	mutex_unlock(&bd->update_lock);
+
+	return ret;
 }
 
 extern struct backlight_device *backlight_device_register(const char *name,
--

1.9.1

#2 lore raw
In reply to Hyungwon Hwang
Quoted 9 lines · Hyungwon Hwang

Backlight device returns the result of update_status(), but backlight_update_status() ignores it. So the consumers cannot confirm the result of their function call. This patch makes the result to be returned back for consumers.

---
 include/linux/backlight.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Applied with Jingoo's Ack, thanks.

Quoted 23 lines
include/linux/backlight.h +6 -2
index adb14a8..1e7a69a 100644
@@ -117,12 +117,16 @@ struct backlight_device {
 	int use_count;
 };
 
-static inline void backlight_update_status(struct backlight_device *bd)
+static inline int backlight_update_status(struct backlight_device *bd)
 {
+	int ret = -ENOENT;
+
 	mutex_lock(&bd->update_lock);
 	if (bd->ops && bd->ops->update_status)
-		bd->ops->update_status(bd);
+		ret = bd->ops->update_status(bd);
 	mutex_unlock(&bd->update_lock);
+
+	return ret;
 }
 
 extern struct backlight_device *backlight_device_register(const char *name,
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog