• Arnd Bergmann's avatar
    i2c: viai2c: turn common code into a proper module · 10345887
    Arnd Bergmann authored
    The i2c-viai2c-common.c file is used by two drivers, but is not a proper
    abstraction and can get linked into both modules in the same configuration,
    which results in a warning:
    
    scripts/Makefile.build:236: drivers/i2c/busses/Makefile: i2c-viai2c-common.o is added to multiple modules: i2c-wmt i2c-zhaoxin
    
    The other problems with this include the incorrect use of a __weak function
    when both are built-in, and the fact that the "common" module is sprinked
    with 'if (i2c->plat == ...)' checks that have knowledge about the differences
    between the drivers using it.
    
    Avoid the link time warning by making the common driver a proper module
    with MODULE_LICENCE()/MODULE_AUTHOR() tags, and remove the __weak function
    by slightly rearranging the code.
    
    This adds a little more duplication between the two main drivers, but
    those versions get more readable in the process.
    
    Fixes: a06b80e8 ("i2c: add zhaoxin i2c controller driver")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Tested-by: default avatarHans Hu <HansHu-oc@zhaoxin.com>
    Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
    10345887
i2c-viai2c-common.h 2.01 KB