diff mbox series

[11/30] net: eepro100: Use standard I/O accessors

Message ID 20200523163837.407592-11-marek.vasut+renesas@gmail.com
State New
Headers show
Series [01/30] net: eepro100: Remove EEPRO100_SROM_WRITE | expand

Commit Message

Marek Vasut May 23, 2020, 4:38 p.m. UTC
The current eepro100 driver accesses its memory mapped registers directly
instead of using the standard I/O accessors. This can cause problems on
some systems as the accesses can get out of order. So convert the direct
volatile dereferences to use the normal in/out macros.

Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
---
 drivers/net/eepro100.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ramon Fried May 23, 2020, 5:15 p.m. UTC | #1
On Sat, May 23, 2020 at 7:42 PM Marek Vasut <marek.vasut at gmail.com> wrote:
>
> The current eepro100 driver accesses its memory mapped registers directly
> instead of using the standard I/O accessors. This can cause problems on
> some systems as the accesses can get out of order. So convert the direct
> volatile dereferences to use the normal in/out macros.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> ---
>  drivers/net/eepro100.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
> index d3ced08761..5d11665fdc 100644
> --- a/drivers/net/eepro100.c
> +++ b/drivers/net/eepro100.c
> @@ -220,23 +220,23 @@ static void eepro100_halt(struct eth_device *dev);
>
>  static inline int INW(struct eth_device *dev, u_long addr)
>  {
> -       return le16_to_cpu(*(volatile u16 *)(addr + (u_long)dev->iobase));
> +       return le16_to_cpu(readw(addr + (void *)dev->iobase));
>  }
>
>  static inline void OUTW(struct eth_device *dev, int command, u_long addr)
>  {
> -       *(volatile u16 *)((addr + (u_long)dev->iobase)) = cpu_to_le16(command);
> +       writew(cpu_to_le16(command), addr + (void *)dev->iobase);
>  }
>
>  static inline void OUTL(struct eth_device *dev, int command, u_long addr)
>  {
> -       *(volatile u32 *)((addr + (u_long)dev->iobase)) = cpu_to_le32(command);
> +       writel(cpu_to_le32(command), addr + (void *)dev->iobase);
>  }
>
>  #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
>  static inline int INL(struct eth_device *dev, u_long addr)
>  {
> -       return le32_to_cpu(*(volatile u32 *)(addr + (u_long)dev->iobase));
> +       return le32_to_cpu(readl(addr + (void *)dev->iobase));
>  }
>
>  static int get_phyreg(struct eth_device *dev, unsigned char addr,
> --
> 2.25.1
>
Reviewed-By: Ramon Fried <rfried.dev at gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index d3ced08761..5d11665fdc 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -220,23 +220,23 @@  static void eepro100_halt(struct eth_device *dev);
 
 static inline int INW(struct eth_device *dev, u_long addr)
 {
-	return le16_to_cpu(*(volatile u16 *)(addr + (u_long)dev->iobase));
+	return le16_to_cpu(readw(addr + (void *)dev->iobase));
 }
 
 static inline void OUTW(struct eth_device *dev, int command, u_long addr)
 {
-	*(volatile u16 *)((addr + (u_long)dev->iobase)) = cpu_to_le16(command);
+	writew(cpu_to_le16(command), addr + (void *)dev->iobase);
 }
 
 static inline void OUTL(struct eth_device *dev, int command, u_long addr)
 {
-	*(volatile u32 *)((addr + (u_long)dev->iobase)) = cpu_to_le32(command);
+	writel(cpu_to_le32(command), addr + (void *)dev->iobase);
 }
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 static inline int INL(struct eth_device *dev, u_long addr)
 {
-	return le32_to_cpu(*(volatile u32 *)(addr + (u_long)dev->iobase));
+	return le32_to_cpu(readl(addr + (void *)dev->iobase));
 }
 
 static int get_phyreg(struct eth_device *dev, unsigned char addr,