• Stephen Boyd's avatar
    coresight: STM: Clean up __iomem type usage · e3b78684
    Stephen Boyd authored
    The casting and other things here is odd, and causes sparse to
    complain:
    
    drivers/hwtracing/coresight/coresight-stm.c:279:35: warning: incorrect type in argument 1 (different address spaces)
    drivers/hwtracing/coresight/coresight-stm.c:279:35:    expected void [noderef] <asn:2>*addr
    drivers/hwtracing/coresight/coresight-stm.c:279:35:    got struct stm_drvdata *drvdata
    drivers/hwtracing/coresight/coresight-stm.c:327:17: warning: incorrect type in argument 2 (different address spaces)
    drivers/hwtracing/coresight/coresight-stm.c:327:17:    expected void volatile [noderef] <asn:2>*addr
    drivers/hwtracing/coresight/coresight-stm.c:327:17:    got void *addr
    drivers/hwtracing/coresight/coresight-stm.c:330:17: warning: incorrect type in argument 2 (different address spaces)
    drivers/hwtracing/coresight/coresight-stm.c:330:17:    expected void volatile [noderef] <asn:2>*addr
    drivers/hwtracing/coresight/coresight-stm.c:330:17:    got void *addr
    drivers/hwtracing/coresight/coresight-stm.c:333:17: warning: incorrect type in argument 2 (different address spaces)
    drivers/hwtracing/coresight/coresight-stm.c:333:17:    expected void volatile [noderef] <asn:2>*addr
    drivers/hwtracing/coresight/coresight-stm.c:333:17:    got void *addr
    
    >From what I can tell, we don't really need to treat ch_addr as
    anything besides a pointer, and we can just do pointer math
    instead of ORing in the bits of the offset and achieve the same
    thing.
    
    Also, we were passing a drvdata pointer to the
    coresight_timeout() function, but we really wanted to pass the
    address of the register base. Luckily the base is the first
    member of the structure, so everything works out, but this is
    quite unsafe if we ever change the structure layout. Clean this
    all up so sparse stops complaining on this code.
    Reported-by: default avatarSatyajit Desai <sadesai@codeaurora.org>
    Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
    Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e3b78684
coresight-stm.c 23.3 KB