[PATCH] i2c: mv64xxx: Fix locked bus when offload is selected but not used on a message

Wolfram Sang wsa at the-dreams.de
Thu Feb 13 04:41:17 EST 2014


> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -461,8 +461,15 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
>  	case MV64XXX_I2C_ACTION_OFFLOAD_SEND_START:
>  		if (!mv64xxx_i2c_offload_msg(drv_data))
>  			break;
> -		else
> +		else {

Here you break the coding style...

>  			drv_data->action = MV64XXX_I2C_ACTION_SEND_START;
> +			/*
> +			 * Switch to the standard path, so we finally need to
> +			 * prepare the io that have not been done in
> +			 * mv64xxx_i2c_execute_msg
> +			 */
> +			mv64xxx_i2c_prepare_for_io(drv_data, drv_data->msgs);
> +		}

... but more importantly, NACK. The code is already hard to follow which
is the cause for this bug. This snipplet makes the code even harder to
read, so it needs some simplification IMO. I'll fire up a counterpatch
in a minute to explain what I mean.

>  		/* FALLTHRU */
>  	case MV64XXX_I2C_ACTION_SEND_START:
>  		writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_START,
> -- 
> 1.8.1.2
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140213/cee40674/attachment.sig>


More information about the linux-arm-kernel mailing list