[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211228180137.59c3859c@jic23-huawei>
Date: Tue, 28 Dec 2021 18:01:37 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Cc: William Breathitt Gray <vilhelm.gray@...il.com>,
Lars-Peter Clausen <lars@...afoo.de>, kernel@...gutronix.de,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-iio@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 04/23] counter: Provide a wrapper to access device
private data
On Mon, 27 Dec 2021 10:45:07 +0100
Uwe Kleine-König <u.kleine-koenig@...gutronix.de> wrote:
> 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> ---
> drivers/counter/counter-core.c | 12 ++++++++++++
> include/linux/counter.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> 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
> diff --git a/include/linux/counter.h b/include/linux/counter.h
> index b7d0a00a61cf..8daaa38c71d8 100644
> --- a/include/linux/counter.h
> +++ b/include/linux/counter.h
> @@ -329,6 +329,8 @@ struct counter_device {
> struct mutex ops_exist_lock;
> };
>
> +void *counter_priv(const struct counter_device *const counter);
> +
> int counter_register(struct counter_device *const counter);
> void counter_unregister(struct counter_device *const counter);
> int devm_counter_register(struct device *dev,
Powered by blists - more mailing lists