[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1430316005-16480-3-git-send-email-shobhit.kumar@intel.com>
Date: Wed, 29 Apr 2015 19:29:59 +0530
From: Shobhit Kumar <shobhit.kumar@...el.com>
To: intel-gfx <intel-gfx@...ts.freedesktop.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-gpio <linux-gpio@...r.kernel.org>,
linux-pwm <linux-pwm@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
Daniel Vetter <daniel.vetter@...el.com>,
David Airlie <airlied@...ux.ie>,
Samuel Ortiz <sameo@...ux.intel.com>,
Thierry Reding <thierry.reding@...il.com>,
Jani Nikula <jani.nikula@...el.com>,
Lee Jones <lee.jones@...aro.org>,
Povilas Staniulis <wdmonster@...il.com>,
Chih-Wei Huang <cwhuang@...roid-x86.org>,
Shobhit Kumar <shobhit.kumar@...el.com>
Subject: [PATCH 2/8] drivers/pwm/core: Add support to remove registered consumer lookup tables
In case some drivers are unloading, they can remove lookup tables which
they would have registered during their load time to avoid redundant
entries if loaded again
v2: Ccing maintainers
CC: Samuel Ortiz <sameo@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>
Cc: Alexandre Courbot <gnurou@...il.com>
Cc: Thierry Reding <thierry.reding@...il.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@...el.com>
---
drivers/pwm/core.c | 17 +++++++++++++++++
include/linux/pwm.h | 5 +++++
2 files changed, 22 insertions(+)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index ba34c7d..d2fe7c8d 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -586,6 +586,23 @@ void pwm_add_table(struct pwm_lookup *table, size_t num)
}
/**
+ * pwm_remove_table() - un-register PWM device consumers
+ * @table: array of consumers to un-register
+ * @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
* @dev: device for PWM consumer
* @con_id: consumer name
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index e90628c..cfe2d8d 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -290,10 +290,15 @@ struct pwm_lookup {
#if IS_ENABLED(CONFIG_PWM)
void pwm_add_table(struct pwm_lookup *table, size_t num);
+void pwm_remove_table(struct pwm_lookup *table, size_t num);
#else
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
#ifdef CONFIG_PWM_SYSFS
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists