• Arnd Bergmann's avatar
    regulator: twl: make twl_info tables const · 0ffff5a6
    Arnd Bergmann authored
    I currently carry the series to make of_device_id->data const in the
    arm-soc tree, which fixes a number of issues, but leaves one new
    compiler warning about the twl-regulator driver:
    
    drivers/regulator/twl-regulator.c: In function 'twlreg_probe':
    drivers/regulator/twl-regulator.c:1130:8: warning: assignment discards 'const'
    qualifier from pointer target type [enabled by default]
    drivers/regulator/twl-regulator.c:1139:9: warning: assignment discards 'const'
    qualifier from pointer target type [enabled by default]
    
    The warning indicates that the driver takes a static table with
    initialization data for each regulator, modifies the data in place
    and passes a pointer to that structure to the regulator_register
    function. This is probably ok because a system contains only one
    instance of each regulator, but it's still bad style because any
    driver should be written to support multiple instances of the same
    hardware.
    
    This patch changes the code to dynamically allocate the memory
    we pass to the regulator core so the table can be constant.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
    0ffff5a6
twl-regulator.c 33.6 KB