• Finn Thain's avatar
    char/nvram: Implement NVRAM read/write methods · 109b3a89
    Finn Thain authored
    Refactor the RTC "CMOS" NVRAM functions so that they can be used as
    arch_nvram_ops methods. Checksumming logic is moved from the misc device
    operations to the nvram read/write operations. This makes the misc device
    implementation more generic.
    
    This preserves the locking mechanism such that "read if checksum valid"
    and "write and update checksum" remain atomic operations.
    
    Some platforms implement byte-range read/write methods which are similar
    to file_operations struct methods. Other platforms provide only
    byte-at-a-time methods. The former are more efficient but may be
    unavailable so fall back on the latter methods when necessary.
    Tested-by: default avatarStan Johnson <userm57@yahoo.com>
    Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    109b3a89
nvram.c 12.5 KB