diff mbox

[RFC] mmc: tmio: use ioread* for repeated access to a register

Message ID 20171218000021.16655-1-wsa+renesas@sang-engineering.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Wolfram Sang Dec. 18, 2017, midnight UTC
Not all archs define reads* and writes*. Switch to ioread*_rep and
friends which is defined everywhere, so we can enable COMPILE_TEST after
that.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

So, I pushed this to buildbot on top of Yamada-san's patch series and there
were no complaints, even with COMPILE_TEST enabled. I also did some tests on
HW and checksuming huge files on SD cards still works.

However, I am not sure about this mixture of read* and ioread* functions. Shall
we convert maybe all of those?

 drivers/mmc/host/tmio_mmc.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ian Molton Dec. 18, 2017, 12:13 a.m. UTC | #1
On 18/12/17 00:00, Wolfram Sang wrote:
> Not all archs define reads* and writes*. Switch to ioread*_rep and
> friends which is defined everywhere, so we can enable COMPILE_TEST after
> that.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> So, I pushed this to buildbot on top of Yamada-san's patch series and there
> were no complaints, even with COMPILE_TEST enabled. I also did some tests on
> HW and checksuming huge files on SD cards still works.
> 
> However, I am not sure about this mixture of read* and ioread* functions. Shall
> we convert maybe all of those?

Might as well. They've been in Linux since what 2.6.9?

>  drivers/mmc/host/tmio_mmc.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 76094345cbacf3..03519c4ca0aa1a 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -233,7 +233,7 @@ static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
>  static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
>  				      u16 *buf, int count)
>  {
> -	readsw(host->ctl + (addr << host->bus_shift), buf, count);
> +	ioread16_rep(host->ctl + (addr << host->bus_shift), buf, count);
>  }
>  
>  static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
> @@ -246,7 +246,7 @@ static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
>  static inline void sd_ctrl_read32_rep(struct tmio_mmc_host *host, int addr,
>  				      u32 *buf, int count)
>  {
> -	readsl(host->ctl + (addr << host->bus_shift), buf, count);
> +	ioread32_rep(host->ctl + (addr << host->bus_shift), buf, count);
>  }
>  
>  static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
> @@ -263,7 +263,7 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
>  static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
>  				       u16 *buf, int count)
>  {
> -	writesw(host->ctl + (addr << host->bus_shift), buf, count);
> +	iowrite16_rep(host->ctl + (addr << host->bus_shift), buf, count);
>  }
>  
>  static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
> @@ -276,7 +276,7 @@ static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
>  static inline void sd_ctrl_write32_rep(struct tmio_mmc_host *host, int addr,
>  				       const u32 *buf, int count)
>  {
> -	writesl(host->ctl + (addr << host->bus_shift), buf, count);
> +	iowrite32_rep(host->ctl + (addr << host->bus_shift), buf, count);
>  }
>  
>  #endif
>
Ulf Hansson Dec. 18, 2017, 1:01 p.m. UTC | #2
On 18 December 2017 at 01:00, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Not all archs define reads* and writes*. Switch to ioread*_rep and
> friends which is defined everywhere, so we can enable COMPILE_TEST after
> that.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks, applied for next!

I put the patch in front of Yamada-san's patch that made it possible
to use COMPILE_TEST. Thus avoiding breaking bisecting.

> ---
>
> So, I pushed this to buildbot on top of Yamada-san's patch series and there
> were no complaints, even with COMPILE_TEST enabled. I also did some tests on
> HW and checksuming huge files on SD cards still works.
>
> However, I am not sure about this mixture of read* and ioread* functions. Shall
> we convert maybe all of those?

Yes, seems like a good idea.

[...]

Kind regards
Uffe
Masahiro Yamada Dec. 18, 2017, 4:01 p.m. UTC | #3
2017-12-18 22:01 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
> On 18 December 2017 at 01:00, Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
>> Not all archs define reads* and writes*. Switch to ioread*_rep and
>> friends which is defined everywhere, so we can enable COMPILE_TEST after
>> that.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Thanks, applied for next!
>
> I put the patch in front of Yamada-san's patch that made it possible
> to use COMPILE_TEST. Thus avoiding breaking bisecting.
>
>> ---
>>
>> So, I pushed this to buildbot on top of Yamada-san's patch series and there
>> were no complaints, even with COMPILE_TEST enabled. I also did some tests on
>> HW and checksuming huge files on SD cards still works.
>>
>> However, I am not sure about this mixture of read* and ioread* functions. Shall
>> we convert maybe all of those?
>
> Yes, seems like a good idea.
>
> [...]
>

BTW, is ioread* preferred to read*?

We need to eliminate the root cause.
Other drivers using reads* cannot enable COMPILE_TEST for the same reason.

Wolfram,
Can you send a patch for sparc64?
Wolfram Sang Dec. 19, 2017, 1:20 p.m. UTC | #4
Yamada-san,

> BTW, is ioread* preferred to read*?

Technically, yes. In reality, mostly not.

> We need to eliminate the root cause.
> Other drivers using reads* cannot enable COMPILE_TEST for the same reason.

Sure, I understand this. There are not many left, however. I'd assume
most switched to io*_rep. The sparc64 issue is known for at least two
years.

> Wolfram,
> Can you send a patch for sparc64?

As I wrote here already [1], this is too much of a side task for me. But
if you like, please have a go...

But I'll send the consistency patch for tmio in a second.

Kind regards,

   Wolfram


[1] https://lkml.org/lkml/2017/12/15/816
diff mbox

Patch

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 76094345cbacf3..03519c4ca0aa1a 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -233,7 +233,7 @@  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
 				      u16 *buf, int count)
 {
-	readsw(host->ctl + (addr << host->bus_shift), buf, count);
+	ioread16_rep(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
 static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
@@ -246,7 +246,7 @@  static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
 static inline void sd_ctrl_read32_rep(struct tmio_mmc_host *host, int addr,
 				      u32 *buf, int count)
 {
-	readsl(host->ctl + (addr << host->bus_shift), buf, count);
+	ioread32_rep(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
 static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
@@ -263,7 +263,7 @@  static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
 static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
 				       u16 *buf, int count)
 {
-	writesw(host->ctl + (addr << host->bus_shift), buf, count);
+	iowrite16_rep(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
 static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
@@ -276,7 +276,7 @@  static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
 static inline void sd_ctrl_write32_rep(struct tmio_mmc_host *host, int addr,
 				       const u32 *buf, int count)
 {
-	writesl(host->ctl + (addr << host->bus_shift), buf, count);
+	iowrite32_rep(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
 #endif