summaryrefslogtreecommitdiff
path: root/drivers/counter
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-12-30 18:02:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-30 19:44:06 +0300
commit5207fb2f311b0c45a9abfa1c84b7a7b657ffa550 (patch)
tree316ddaf26e9fda72b94b5e2a56cd3632e7042b54 /drivers/counter
parent0880603c8401505d237c8bfd29538a064e3aaf0f (diff)
downloadlinux-5207fb2f311b0c45a9abfa1c84b7a7b657ffa550.tar.xz
counter: Provide a wrapper to access device private data
For now this just wraps accessing struct counter_device::priv. However this is about to change and converting drivers to this helper individually makes fixing device lifetime issues result in easier to review patches. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20211230150300.72196-5-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/counter')
-rw-r--r--drivers/counter/counter-core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/counter/counter-core.c b/drivers/counter/counter-core.c
index f053a43c6c04..00c41f28c101 100644
--- a/drivers/counter/counter-core.c
+++ b/drivers/counter/counter-core.c
@@ -46,6 +46,18 @@ static struct bus_type counter_bus_type = {
static dev_t counter_devt;
/**
+ * counter_priv - access counter device private data
+ * @counter: counter device
+ *
+ * Get the counter device private data
+ */
+void *counter_priv(const struct counter_device *const counter)
+{
+ return counter->priv;
+}
+EXPORT_SYMBOL_GPL(counter_priv);
+
+/**
* counter_register - register Counter to the system
* @counter: pointer to Counter to register
*