Re: [PATCH v3 3/4] i2c: Replace list-based mechanism for handling userspace-created clients

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 01, 2024 at 11:11:39PM +0100, Heiner Kallweit wrote:
> Similar to the list of auto-detected clients, we can also replace the
> list of userspace-created clients with flagging such client devices.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>

Applied to for-next, thanks! Some edits:

> +	mutex_lock (&core_lock);

Superfluous space before parens. Fixed it and the other two occasions.

> +	child_dev = device_find_child(&adap->dev, &addr, __i2c_find_user_addr);
> +	if (!child_dev) {
> +		mutex_unlock (&core_lock);
> +		dev_err(dev, "Can't find userspace-created device at %#x\n", addr);
> +		return -ENOENT;
>  	}
> -	mutex_unlock(&adap->userspace_clients_lock);
> +	client = i2c_verify_client(child_dev);
> +	i2c_unregister_device(client);
> +	put_device(child_dev);
> +	mutex_unlock (&core_lock);

With locks, I really prefer to have a single exit point. Reordered the
code to:

	if (child_dev) {
		unreg
		put
	} else {
		dev_err
		count = -ENOENT
	}

and got rid of the 'client' variable while here which was only used
once.

> +#define I2C_CLIENT_USER		0x200	/* for board_info; userspace-created */

Like in the previous patch, I fixed the flag desc a little.

You might want to check my for-mergewindow branch to double check my
edits.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux