Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sdhci: build fix: rename SDHCI I/O accessor functions

Unfortunately some architectures #define their read{b,w,l} and
write{b,w,l} I/O accessors which makes the SDHCI I/O accessor functions of
the same names subject to preprocessing. This leads to the following
compiler error,

In file included from drivers/mmc/host/sdhci.c:26:
drivers/mmc/host/sdhci.h:318:35: error: macro "writel" passed 3 arguments, but takes just 2

Rename the SDHCI I/O functions so that CONFIG_MMC_SDHCI_IO_ACCESSORS can
be enabled for architectures that implement their read{b,w,l} and
write{b,w,l} functions with macros.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Cc: Zhangfei Gao <zgao6@marvell.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Matt Fleming and committed by
Linus Torvalds
dc297c92 a751a7d6

+30 -30
+6 -6
drivers/mmc/host/sdhci-of-esdhc.c
··· 129 129 SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET | 130 130 SDHCI_QUIRK_NO_CARD_NO_RESET, 131 131 .ops = { 132 - .readl = sdhci_be32bs_readl, 133 - .readw = esdhc_readw, 134 - .readb = sdhci_be32bs_readb, 135 - .writel = sdhci_be32bs_writel, 136 - .writew = esdhc_writew, 137 - .writeb = esdhc_writeb, 132 + .read_l = sdhci_be32bs_readl, 133 + .read_w = esdhc_readw, 134 + .read_b = sdhci_be32bs_readb, 135 + .write_l = sdhci_be32bs_writel, 136 + .write_w = esdhc_writew, 137 + .write_b = esdhc_writeb, 138 138 .set_clock = esdhc_set_clock, 139 139 .enable_dma = esdhc_enable_dma, 140 140 .get_max_clock = esdhc_get_max_clock,
+6 -6
drivers/mmc/host/sdhci-of-hlwd.c
··· 55 55 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | 56 56 SDHCI_QUIRK_32BIT_DMA_SIZE, 57 57 .ops = { 58 - .readl = sdhci_be32bs_readl, 59 - .readw = sdhci_be32bs_readw, 60 - .readb = sdhci_be32bs_readb, 61 - .writel = sdhci_hlwd_writel, 62 - .writew = sdhci_hlwd_writew, 63 - .writeb = sdhci_hlwd_writeb, 58 + .read_l = sdhci_be32bs_readl, 59 + .read_w = sdhci_be32bs_readw, 60 + .read_b = sdhci_be32bs_readb, 61 + .write_l = sdhci_hlwd_writel, 62 + .write_w = sdhci_hlwd_writew, 63 + .write_b = sdhci_hlwd_writeb, 64 64 }, 65 65 };
+18 -18
drivers/mmc/host/sdhci.h
··· 296 296 297 297 struct sdhci_ops { 298 298 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS 299 - u32 (*readl)(struct sdhci_host *host, int reg); 300 - u16 (*readw)(struct sdhci_host *host, int reg); 301 - u8 (*readb)(struct sdhci_host *host, int reg); 302 - void (*writel)(struct sdhci_host *host, u32 val, int reg); 303 - void (*writew)(struct sdhci_host *host, u16 val, int reg); 304 - void (*writeb)(struct sdhci_host *host, u8 val, int reg); 299 + u32 (*read_l)(struct sdhci_host *host, int reg); 300 + u16 (*read_w)(struct sdhci_host *host, int reg); 301 + u8 (*read_b)(struct sdhci_host *host, int reg); 302 + void (*write_l)(struct sdhci_host *host, u32 val, int reg); 303 + void (*write_w)(struct sdhci_host *host, u16 val, int reg); 304 + void (*write_b)(struct sdhci_host *host, u8 val, int reg); 305 305 #endif 306 306 307 307 void (*set_clock)(struct sdhci_host *host, unsigned int clock); ··· 316 316 317 317 static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg) 318 318 { 319 - if (unlikely(host->ops->writel)) 320 - host->ops->writel(host, val, reg); 319 + if (unlikely(host->ops->write_l)) 320 + host->ops->write_l(host, val, reg); 321 321 else 322 322 writel(val, host->ioaddr + reg); 323 323 } 324 324 325 325 static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg) 326 326 { 327 - if (unlikely(host->ops->writew)) 328 - host->ops->writew(host, val, reg); 327 + if (unlikely(host->ops->write_w)) 328 + host->ops->write_w(host, val, reg); 329 329 else 330 330 writew(val, host->ioaddr + reg); 331 331 } 332 332 333 333 static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) 334 334 { 335 - if (unlikely(host->ops->writeb)) 336 - host->ops->writeb(host, val, reg); 335 + if (unlikely(host->ops->write_b)) 336 + host->ops->write_b(host, val, reg); 337 337 else 338 338 writeb(val, host->ioaddr + reg); 339 339 } 340 340 341 341 static inline u32 sdhci_readl(struct sdhci_host *host, int reg) 342 342 { 343 - if (unlikely(host->ops->readl)) 344 - return host->ops->readl(host, reg); 343 + if (unlikely(host->ops->read_l)) 344 + return host->ops->read_l(host, reg); 345 345 else 346 346 return readl(host->ioaddr + reg); 347 347 } 348 348 349 349 static inline u16 sdhci_readw(struct sdhci_host *host, int reg) 350 350 { 351 - if (unlikely(host->ops->readw)) 352 - return host->ops->readw(host, reg); 351 + if (unlikely(host->ops->read_w)) 352 + return host->ops->read_w(host, reg); 353 353 else 354 354 return readw(host->ioaddr + reg); 355 355 } 356 356 357 357 static inline u8 sdhci_readb(struct sdhci_host *host, int reg) 358 358 { 359 - if (unlikely(host->ops->readb)) 360 - return host->ops->readb(host, reg); 359 + if (unlikely(host->ops->read_b)) 360 + return host->ops->read_b(host, reg); 361 361 else 362 362 return readb(host->ioaddr + reg); 363 363 }