Skip to contentSkip to conversation

smc91x: remove "irq_flags" from "struct smc91x_platdata"

PATCH New Eric Miao 1 participant 1 message Jun 6, 2008

Subsystems (3)
lore
Share & tools
lore

Eric Miao

author
#0 lore raw

PATCH 1/1 smc91x: remove "irq_flags" from "struct smc91x_platdata"

IRQ trigger type can be specified in the IRQ resource definition by IORESOURCE_IRQ_*, we need only one way to specify this.

This also fixes the following small issue:

To allow dynamic support for multiple platforms, when those relevant macros are not defined for one specific platform, the default case will be:

- SMC_DYNAMIC_BUS_CONFIG defined
- and SMC_IRQ_FLAGS = IRQF_TRIGGER_RISING

However, if "irq_flags" is missing when defining the smc91x_platdata, usually as follows:

  static struct smc91x_platdata xxxx_smc91x_data = {
	.flags	= SMC91X_USE_XXBIT,

};

The lp->cfg.irq_flags will always be overriden by the above structure (due to a memcpy), thus rendering lp->cfg.irq_flags to be "0" always. (regardless of the default SMC_IRQ_FLAGS or IORESOURCE_IRQ_* flags)

---
 arch/sh/boards/renesas/migor/setup.c |    3 +--
 drivers/net/smc91x.c                 |    7 ++++---
 include/linux/smc91x.h               |    1 -
 3 files changed, 5 insertions(+), 6 deletions(-)
arch/sh/boards/renesas/migor/setup.c +1 -2
index 01af442..963c993 100644
@@ -30,7 +30,6 @@
 
 static struct smc91x_platdata smc91x_info = {
 	.flags = SMC91X_USE_16BIT,
-	.irq_flags = IRQF_TRIGGER_HIGH,
 };
 
 static struct resource smc91x_eth_resources[] = {
@@ -42,7 +41,7 @@ static struct resource smc91x_eth_resources[] = {
 	},
 	[1] = {
 		.start  = 32, /* IRQ0 */
-		.flags  = IORESOURCE_IRQ,
+		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
 	},
 };
 
drivers/net/smc91x.c +4 -3
index a188e33..46097df 100644
@@ -2134,6 +2134,7 @@ static int smc_drv_probe(struct platform_device *pdev)
 	struct net_device *ndev;
 	struct resource *res, *ires;
 	unsigned int __iomem *addr;
+	unsigned long irq_flags = SMC_IRQ_FLAGS;
 	int ret;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs");
@@ -2163,7 +2164,6 @@ static int smc_drv_probe(struct platform_device *pdev)
 	 */
 
 	lp = netdev_priv(ndev);
-	lp->cfg.irq_flags = SMC_IRQ_FLAGS;
 
 #ifdef SMC_DYNAMIC_BUS_CONFIG
 	if (pd)
@@ -2188,8 +2188,9 @@ static int smc_drv_probe(struct platform_device *pdev)
 	}
 
 	ndev->irq = ires->start;
+
 	if (SMC_IRQ_FLAGS == -1)
-		lp->cfg.irq_flags = ires->flags & IRQF_TRIGGER_MASK;
+		irq_flags = ires->flags & IRQF_TRIGGER_MASK;
 
 	ret = smc_request_attrib(pdev);
 	if (ret)
@@ -2216,7 +2217,7 @@ static int smc_drv_probe(struct platform_device *pdev)
 	}
 #endif
 
-	ret = smc_probe(ndev, addr, lp->cfg.irq_flags);
+	ret = smc_probe(ndev, addr, irq_flags);
 	if (ret != 0)
 		goto out_iounmap;
 
include/linux/smc91x.h +0 -1
index 8e0556b..fc7682f 100644
@@ -7,7 +7,6 @@
 
 struct smc91x_platdata {
 	unsigned long flags;
-	unsigned long irq_flags; /* IRQF_... */
 };
 
 #endif /* __SMC91X_H__ */
Signature · 1 line
1.5.4.3