You need to sign in or sign up before continuing.
提交 efb0de55 编写于 作者: S Shobhit Kumar 提交者: Thierry Reding

pwm: Add support to remove registered consumer lookup tables

In case some drivers are unloading, they can remove lookup tables which
they had registered during their load time to avoid redundant entries if
loaded again.

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: NShobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
上级 b787f68c
...@@ -585,6 +585,23 @@ void pwm_add_table(struct pwm_lookup *table, size_t num) ...@@ -585,6 +585,23 @@ void pwm_add_table(struct pwm_lookup *table, size_t num)
mutex_unlock(&pwm_lookup_lock); mutex_unlock(&pwm_lookup_lock);
} }
/**
* pwm_remove_table() - unregister PWM device consumers
* @table: array of consumers to unregister
* @num: number of consumers in table
*/
void pwm_remove_table(struct pwm_lookup *table, size_t num)
{
mutex_lock(&pwm_lookup_lock);
while (num--) {
list_del(&table->list);
table++;
}
mutex_unlock(&pwm_lookup_lock);
}
/** /**
* pwm_get() - look up and request a PWM device * pwm_get() - look up and request a PWM device
* @dev: device for PWM consumer * @dev: device for PWM consumer
......
...@@ -290,10 +290,15 @@ struct pwm_lookup { ...@@ -290,10 +290,15 @@ struct pwm_lookup {
#if IS_ENABLED(CONFIG_PWM) #if IS_ENABLED(CONFIG_PWM)
void pwm_add_table(struct pwm_lookup *table, size_t num); void pwm_add_table(struct pwm_lookup *table, size_t num);
void pwm_remove_table(struct pwm_lookup *table, size_t num);
#else #else
static inline void pwm_add_table(struct pwm_lookup *table, size_t num) static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
{ {
} }
static inline void pwm_remove_table(struct pwm_lookup *table, size_t num)
{
}
#endif #endif
#ifdef CONFIG_PWM_SYSFS #ifdef CONFIG_PWM_SYSFS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册