[PATCH] fix IORESOURCE_MEM_xxx usage in dm9k driver

zzs213 at 126.com zzs213 at 126.com
Fri Jun 24 20:53:00 PDT 2016


From: 张忠山 <zzs213 at 126.com>

Because the const used in dm9k driver unmatch the new IORESOURCE_MEM_xxx
macro. So whenever the driver start probe, the flowwing error message
appear:

        Wrong io resource size

This patch fix this.

Signed-off-by: 张忠山 <zzs213 at 126.com>
---
 drivers/net/dm9k.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
index ad402e3..7a41868 100644
--- a/drivers/net/dm9k.c
+++ b/drivers/net/dm9k.c
@@ -732,14 +732,10 @@ static int dm9k_init_dev(struct eth_device *edev)
 static int dm9000_setup_buswidth(struct device_d *dev, struct dm9k *priv, uint32_t width)
 {
 	switch (width) {
-	case 1:
-		priv->buswidth = IORESOURCE_MEM_8BIT;
-		break;
-	case 2:
-		priv->buswidth = IORESOURCE_MEM_16BIT;
-		break;
-	case 4:
-		priv->buswidth = IORESOURCE_MEM_32BIT;
+	case IORESOURCE_MEM_8BIT:
+	case IORESOURCE_MEM_16BIT:
+	case IORESOURCE_MEM_32BIT:
+		priv->buswidth = width;
 		break;
 	default:
 		dev_err(dev, "Wrong io resource size\n");
@@ -765,7 +761,7 @@ static int dm9000_parse_dt(struct device_d *dev, struct dm9k *priv)
 
 	if (of_property_read_u32(np, "reg-io-width", &prop)) {
 		/* Use 8-bit registers by default */
-		prop = 1;
+		prop = IORESOURCE_MEM_8BIT;
 	}
 
 	return dm9000_setup_buswidth(dev, priv, prop);
-- 
1.9.1





More information about the barebox mailing list