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

Brian Norris computersforpeace at gmail.com
Fri Feb 10 10:11:13 PST 2017


On Thu, Feb 09, 2017 at 10:05:39AM +0100, Marek Vasut wrote:
> On 02/09/2017 12:37 AM, Brian Norris wrote:
> > 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()).
> 
> Maybe it's worth fixing the ioread*_rep then ? Then again, that seems to
> be way far off the scope of this patch.

To be clear: I agree, it's out of the scope of this patch. I've pulled
this in anyway. But I am happy for any work in the meantime to improve
the consistency here.

Thanks,
Brian



More information about the linux-mtd mailing list