[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 12 Dec 2019 15:46:27 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Vitor Soares <Vitor.Soares@...opsys.com>
Cc: linux-kernel@...r.kernel.org, linux-i3c@...ts.infradead.org,
Joao.Pinto@...opsys.com, bbrezillon@...nel.org, wsa@...-dreams.de,
arnd@...db.de, broonie@...nel.org
Subject: Re: [RFC 5/5] i3c: add i3cdev module to expose i3c dev in /dev
On Tue, Dec 10, 2019 at 04:37:33PM +0100, Vitor Soares wrote:
> +static struct i3cdev_data *i3cdev_get_by_minor(unsigned int minor)
Why? Why not just embed the structure in the cdev if you really need
it?
> +static struct i3cdev_data *get_free_i3cdev(struct i3c_device *i3c)
> +{
> + struct i3cdev_data *i3cdev;
> + unsigned long minor;
> +
> + minor = find_first_zero_bit(minors, N_I3C_MINORS);
No locking, fun!!!
:(
Why not use an idr instead, that is what it is there for. Don't try to
roll your own.
thanks,
greg k-h
Powered by blists - more mailing lists