[lkml]   [2019]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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

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

 \ /
  Last update: 2019-12-12 15:47    [W:0.134 / U:3.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site