diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/leds.h | 29 | ||||
| -rw-r--r-- | include/linux/mutex.h | 27 | 
2 files changed, 42 insertions, 14 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h index db6b114bb3d9..6300313c46b7 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -455,6 +455,9 @@ struct led_trigger {  	int		(*activate)(struct led_classdev *led_cdev);  	void		(*deactivate)(struct led_classdev *led_cdev); +	/* Brightness set by led_trigger_event */ +	enum led_brightness brightness; +  	/* LED-private triggers have this set */  	struct led_hw_trigger_type *trigger_type; @@ -508,6 +511,12 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev)  	return led_cdev->trigger_data;  } +static inline enum led_brightness +led_trigger_get_brightness(const struct led_trigger *trigger) +{ +	return trigger ? trigger->brightness : LED_OFF; +} +  #define module_led_trigger(__led_trigger) \  	module_driver(__led_trigger, led_trigger_register, \  		      led_trigger_unregister) @@ -544,6 +553,12 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev)  	return NULL;  } +static inline enum led_brightness +led_trigger_get_brightness(const struct led_trigger *trigger) +{ +	return LED_OFF; +} +  #endif /* CONFIG_LEDS_TRIGGERS */  /* Trigger specific enum */ @@ -690,18 +705,4 @@ enum led_audio {  	NUM_AUDIO_LEDS  }; -#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO) -enum led_brightness ledtrig_audio_get(enum led_audio type); -void ledtrig_audio_set(enum led_audio type, enum led_brightness state); -#else -static inline enum led_brightness ledtrig_audio_get(enum led_audio type) -{ -	return LED_OFF; -} -static inline void ledtrig_audio_set(enum led_audio type, -				     enum led_brightness state) -{ -} -#endif -  #endif		/* __LINUX_LEDS_H_INCLUDED */ diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 67edc4ca2bee..a561c629d89f 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -22,6 +22,8 @@  #include <linux/cleanup.h>  #include <linux/mutex_types.h> +struct device; +  #ifdef CONFIG_DEBUG_LOCK_ALLOC  # define __DEP_MAP_MUTEX_INITIALIZER(lockname)			\  		, .dep_map = {					\ @@ -117,6 +119,31 @@ do {							\  } while (0)  #endif /* CONFIG_PREEMPT_RT */ +#ifdef CONFIG_DEBUG_MUTEXES + +int __devm_mutex_init(struct device *dev, struct mutex *lock); + +#else + +static inline int __devm_mutex_init(struct device *dev, struct mutex *lock) +{ +	/* +	 * When CONFIG_DEBUG_MUTEXES is off mutex_destroy() is just a nop so +	 * no really need to register it in the devm subsystem. +	 */ +	return 0; +} + +#endif + +#define devm_mutex_init(dev, mutex)			\ +({							\ +	typeof(mutex) mutex_ = (mutex);			\ +							\ +	mutex_init(mutex_);				\ +	__devm_mutex_init(dev, mutex_);			\ +}) +  /*   * See kernel/locking/mutex.c for detailed documentation of these APIs.   * Also see Documentation/locking/mutex-design.rst.  | 
