Commit af0bfab9 authored by Abanoub Sameh's avatar Abanoub Sameh Committed by Pavel Machek

leds: led-core: Get rid of enum led_brightness

This gets rid of enum led_brightness in the main led files,
because it is deprecated, and an unsigned int can be used instead.

We can get rid of led_brightness completely and
patches can also be supplied for the other drivers' files.
Signed-off-by: default avatarAbanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent d8646452
...@@ -145,8 +145,7 @@ static void led_remove_brightness_hw_changed(struct led_classdev *led_cdev) ...@@ -145,8 +145,7 @@ static void led_remove_brightness_hw_changed(struct led_classdev *led_cdev)
device_remove_file(led_cdev->dev, &dev_attr_brightness_hw_changed); device_remove_file(led_cdev->dev, &dev_attr_brightness_hw_changed);
} }
void led_classdev_notify_brightness_hw_changed(struct led_classdev *led_cdev, void led_classdev_notify_brightness_hw_changed(struct led_classdev *led_cdev, unsigned int brightness)
enum led_brightness brightness)
{ {
if (WARN_ON(!led_cdev->brightness_hw_changed_kn)) if (WARN_ON(!led_cdev->brightness_hw_changed_kn))
return; return;
......
...@@ -39,8 +39,7 @@ const char * const led_colors[LED_COLOR_ID_MAX] = { ...@@ -39,8 +39,7 @@ const char * const led_colors[LED_COLOR_ID_MAX] = {
}; };
EXPORT_SYMBOL_GPL(led_colors); EXPORT_SYMBOL_GPL(led_colors);
static int __led_set_brightness(struct led_classdev *led_cdev, static int __led_set_brightness(struct led_classdev *led_cdev, unsigned int value)
enum led_brightness value)
{ {
if (!led_cdev->brightness_set) if (!led_cdev->brightness_set)
return -ENOTSUPP; return -ENOTSUPP;
...@@ -50,8 +49,7 @@ static int __led_set_brightness(struct led_classdev *led_cdev, ...@@ -50,8 +49,7 @@ static int __led_set_brightness(struct led_classdev *led_cdev,
return 0; return 0;
} }
static int __led_set_brightness_blocking(struct led_classdev *led_cdev, static int __led_set_brightness_blocking(struct led_classdev *led_cdev, unsigned int value)
enum led_brightness value)
{ {
if (!led_cdev->brightness_set_blocking) if (!led_cdev->brightness_set_blocking)
return -ENOTSUPP; return -ENOTSUPP;
...@@ -240,8 +238,7 @@ void led_stop_software_blink(struct led_classdev *led_cdev) ...@@ -240,8 +238,7 @@ void led_stop_software_blink(struct led_classdev *led_cdev)
} }
EXPORT_SYMBOL_GPL(led_stop_software_blink); EXPORT_SYMBOL_GPL(led_stop_software_blink);
void led_set_brightness(struct led_classdev *led_cdev, void led_set_brightness(struct led_classdev *led_cdev, unsigned int brightness)
enum led_brightness brightness)
{ {
/* /*
* If software blink is active, delay brightness setting * If software blink is active, delay brightness setting
...@@ -253,7 +250,7 @@ void led_set_brightness(struct led_classdev *led_cdev, ...@@ -253,7 +250,7 @@ void led_set_brightness(struct led_classdev *led_cdev,
* work queue task to avoid problems in case we are called * work queue task to avoid problems in case we are called
* from hard irq context. * from hard irq context.
*/ */
if (brightness == LED_OFF) { if (!brightness) {
set_bit(LED_BLINK_DISABLE, &led_cdev->work_flags); set_bit(LED_BLINK_DISABLE, &led_cdev->work_flags);
schedule_work(&led_cdev->set_brightness_work); schedule_work(&led_cdev->set_brightness_work);
} else { } else {
...@@ -268,8 +265,7 @@ void led_set_brightness(struct led_classdev *led_cdev, ...@@ -268,8 +265,7 @@ void led_set_brightness(struct led_classdev *led_cdev,
} }
EXPORT_SYMBOL_GPL(led_set_brightness); EXPORT_SYMBOL_GPL(led_set_brightness);
void led_set_brightness_nopm(struct led_classdev *led_cdev, void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value)
enum led_brightness value)
{ {
/* Use brightness_set op if available, it is guaranteed not to sleep */ /* Use brightness_set op if available, it is guaranteed not to sleep */
if (!__led_set_brightness(led_cdev, value)) if (!__led_set_brightness(led_cdev, value))
...@@ -281,8 +277,7 @@ void led_set_brightness_nopm(struct led_classdev *led_cdev, ...@@ -281,8 +277,7 @@ void led_set_brightness_nopm(struct led_classdev *led_cdev,
} }
EXPORT_SYMBOL_GPL(led_set_brightness_nopm); EXPORT_SYMBOL_GPL(led_set_brightness_nopm);
void led_set_brightness_nosleep(struct led_classdev *led_cdev, void led_set_brightness_nosleep(struct led_classdev *led_cdev, unsigned int value)
enum led_brightness value)
{ {
led_cdev->brightness = min(value, led_cdev->max_brightness); led_cdev->brightness = min(value, led_cdev->max_brightness);
...@@ -293,8 +288,7 @@ void led_set_brightness_nosleep(struct led_classdev *led_cdev, ...@@ -293,8 +288,7 @@ void led_set_brightness_nosleep(struct led_classdev *led_cdev,
} }
EXPORT_SYMBOL_GPL(led_set_brightness_nosleep); EXPORT_SYMBOL_GPL(led_set_brightness_nosleep);
int led_set_brightness_sync(struct led_classdev *led_cdev, int led_set_brightness_sync(struct led_classdev *led_cdev, unsigned int value)
enum led_brightness value)
{ {
if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) if (led_cdev->blink_delay_on || led_cdev->blink_delay_off)
return -EBUSY; return -EBUSY;
......
...@@ -19,10 +19,8 @@ static inline int led_get_brightness(struct led_classdev *led_cdev) ...@@ -19,10 +19,8 @@ static inline int led_get_brightness(struct led_classdev *led_cdev)
void led_init_core(struct led_classdev *led_cdev); void led_init_core(struct led_classdev *led_cdev);
void led_stop_software_blink(struct led_classdev *led_cdev); void led_stop_software_blink(struct led_classdev *led_cdev);
void led_set_brightness_nopm(struct led_classdev *led_cdev, void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value);
enum led_brightness value); void led_set_brightness_nosleep(struct led_classdev *led_cdev, unsigned int value);
void led_set_brightness_nosleep(struct led_classdev *led_cdev,
enum led_brightness value);
ssize_t led_trigger_read(struct file *filp, struct kobject *kobj, ssize_t led_trigger_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf, struct bin_attribute *attr, char *buf,
loff_t pos, size_t count); loff_t pos, size_t count);
......
...@@ -63,8 +63,8 @@ struct led_hw_trigger_type { ...@@ -63,8 +63,8 @@ struct led_hw_trigger_type {
struct led_classdev { struct led_classdev {
const char *name; const char *name;
enum led_brightness brightness; unsigned int brightness;
enum led_brightness max_brightness; unsigned int max_brightness;
int flags; int flags;
/* Lower 16 bits reflect status */ /* Lower 16 bits reflect status */
...@@ -253,8 +253,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev, ...@@ -253,8 +253,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev,
* software blink timer that implements blinking when the * software blink timer that implements blinking when the
* hardware doesn't. This function is guaranteed not to sleep. * hardware doesn't. This function is guaranteed not to sleep.
*/ */
void led_set_brightness(struct led_classdev *led_cdev, void led_set_brightness(struct led_classdev *led_cdev, unsigned int brightness);
enum led_brightness brightness);
/** /**
* led_set_brightness_sync - set LED brightness synchronously * led_set_brightness_sync - set LED brightness synchronously
...@@ -267,8 +266,7 @@ void led_set_brightness(struct led_classdev *led_cdev, ...@@ -267,8 +266,7 @@ void led_set_brightness(struct led_classdev *led_cdev,
* *
* Returns: 0 on success or negative error value on failure * Returns: 0 on success or negative error value on failure
*/ */
int led_set_brightness_sync(struct led_classdev *led_cdev, int led_set_brightness_sync(struct led_classdev *led_cdev, unsigned int value);
enum led_brightness value);
/** /**
* led_update_brightness - update LED brightness * led_update_brightness - update LED brightness
...@@ -565,7 +563,7 @@ static inline void ledtrig_cpu(enum cpu_led_event evt) ...@@ -565,7 +563,7 @@ static inline void ledtrig_cpu(enum cpu_led_event evt)
#ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED
void led_classdev_notify_brightness_hw_changed( void led_classdev_notify_brightness_hw_changed(
struct led_classdev *led_cdev, enum led_brightness brightness); struct led_classdev *led_cdev, unsigned int brightness);
#else #else
static inline void led_classdev_notify_brightness_hw_changed( static inline void led_classdev_notify_brightness_hw_changed(
struct led_classdev *led_cdev, enum led_brightness brightness) { } struct led_classdev *led_cdev, enum led_brightness brightness) { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment