Re: [PATCH] i2c-eeprom_slave: Add read only mode

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

 



> +			if (eeprom->read_only)
> +				return 0;

What about:

	if (!eeprom->read_only) {
		spin_lock(&eeprom->buffer_lock);
		eeprom->buffer[eeprom->buffer_idx++ & eeprom->address_mask] = *val;
		spin_unlock(&eeprom->buffer_lock);
	}

We can still keep only one exit point from the function this way.

>  	{ "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8,  0) },
> +	{ "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8,  I2C_SLAVE_FLAG_RO) },

"ro" missing. You haven't tested this entry ;)

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