From 5207fb2f311b0c45a9abfa1c84b7a7b657ffa550 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Thu, 30 Dec 2021 16:02:41 +0100 Subject: counter: Provide a wrapper to access device private data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: William Breathitt Gray Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20211230150300.72196-5-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/counter/counter-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/counter') 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 @@ -45,6 +45,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 -- cgit