rtc: ds1511: clean up ds1511_nvram_read()/ds1511_nvram_write()
authorVladimir Zapolskiy <vz@mleia.com>
Wed, 5 Aug 2015 18:12:58 +0000 (21:12 +0300)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sat, 5 Sep 2015 11:19:10 +0000 (13:19 +0200)
commit8ccba14233000f48639aad4cab55ed7b61260db5
tree5a4e2fed7b7eeb13d78c96aded6c4a723080a57d
parentf4843b19d2c7b5effd25e2a65b487d02bf55e96f
rtc: ds1511: clean up ds1511_nvram_read()/ds1511_nvram_write()

The change removes redundant sysfs binary file boundary checks, since
this task is already done on caller side in fs/sysfs/file.c

The change enables burst mode of access to SRAM for any read()/write()
operations, it is worth to mention that this may influence on
userspace, for instance prior to the change

  read(fd, buf, 1);
  read(fd, buf + 1, 1);

and

  read(fd, buf, 2);

sequences of syscalls over DS1511's sysfs "nvram" fd led to different
DS1511 state changes and/or buf content, if some userspace applications
are written specifically for DS1511 and exploit this strange
"feature", they may be impacted.

Also the change corrects NVRAM size accessible to userspace from 255
bytes to 256 bytes.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1511.c