Re: [RFC 5/5] i3c: add i3cdev module to expose i3c dev in /dev

From: Greg KH
Date: Thu Dec 12 2019 - 09:46:31 EST

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

> +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.


greg k-h