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

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

 



> On 5 Sep 2019, at 18:15, Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
> 
> 
>> +            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.


Yes, that is better, I will fix tomorrow.

> 
>>    { "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 ;)
> 

Guilty! I discovered when I was about to send the patch that I’ve missed that eeprom, so I added it there. But I discovered my error when I backported it to our system:-)

Ba 




[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