[PATCH] mtd: aspeed: fix compile warning in aspeed_smc_read_from_ahb()

Brian Norris computersforpeace at gmail.com
Wed Feb 8 15:37:28 PST 2017


On Thu, Jan 19, 2017 at 10:13:18AM +0100, Cédric Le Goater wrote:
> The first argument of ioread32_rep() and ioread8_rep is not
> const. Change aspeed_smc_read_from_ahb() prototype to fix compile
> warning :
> 
>    drivers/mtd/spi-nor/aspeed-smc.c: In function 'aspeed_smc_read_from_ahb':
>    drivers/mtd/spi-nor/aspeed-smc.c:212:16: warning: passing argument 1 of 'ioread32_rep' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>       ioread32_rep(src, buf, len >> 2);

But why isn't that param constant? Seems like that's a bug in the
ioread* APIs. Some of their implementations are const, but some are not.

I see for instance that the implementation in lib/iomap.c is not const,
where there's zero reason it shouldn't be (if we also fix, e.g., its
mmio_insl()).

Brian



More information about the linux-mtd mailing list