• Vladimir Zapolskiy's avatar
    rtc: ds1511: clean up ds1511_nvram_read()/ds1511_nvram_write() · 8ccba142
    Vladimir Zapolskiy authored
    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: default avatarVladimir Zapolskiy <vz@mleia.com>
    Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
    8ccba142
rtc-ds1511.c 13 KB