Re: [PATCH v3] rtc: ds1307: generalise ram size and offset

From: Wolfram Sang
Date: Thu Jan 19 2012 - 14:45:49 EST



Sorry, found another thing.

> + if (chip) {
> + if (chip->nvram_size)
> + ds1307->nvram_size = chip->nvram_size;
> + if (chip->nvram_offset)
> + ds1307->nvram_offset = chip->nvram_offset;
> + }

I moved only the assignments...

>
> buf = ds1307->regs;
> if (i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
> @@ -893,11 +907,12 @@ read_rtc:
> dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
> }
>
> - if (chip && chip->nvram56) {
> + if (chip && chip->nvram_size) {

.. to here when I saw...

> + nvram.size = ds1307->nvram_size;

... that nvram is static and we are changing it. Yeah, it is very unlikely but
if we have two RTC with different nvram sizes, one of them will not work correctly.

Regards,

Wolfram

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |

Attachment: signature.asc
Description: Digital signature