Re: [PATCH v5 01/21] gpu: host1x: Use different lock classes for each client

Thierry Reding
2021-03-22T14:46:38Z

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

On Mon, Jan 11, 2021 at 02:59:59PM +0200, Mikko Perttunen wrote:
> To avoid false lockdep warnings, give each client lock a different
> lock class, passed from the initialization site by macro.
>
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
> drivers/gpu/host1x/bus.c | 7 ++++---
> include/linux/host1x.h | 9 ++++++++-
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> index 347fb962b6c9..8fc79e9cb652 100644
> --- a/drivers/gpu/host1x/bus.c
> +++ b/drivers/gpu/host1x/bus.c
> @@ -715,13 +715,14 @@ EXPORT_SYMBOL(host1x_driver_unregister);
> * device and call host1x_device_init(), which will in turn call each client's
> * &host1x_client_ops.init implementation.
> */
> -int host1x_client_register(struct host1x_client *client)
> +int __host1x_client_register(struct host1x_client *client,
> + struct lock_class_key *key)

I've seen the kbuild robot warn about this because the kerneldoc is now
out of date.

> {
> struct host1x *host1x;
> int err;
>
> INIT_LIST_HEAD(&client->list);
> - mutex_init(&client->lock);
> + __mutex_init(&client->lock, "host1x client lock", key);

Should we maybe attempt to make this unique? Could we use something like
dev_name(client->dev) for this?

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]