Re: [patch 03/22] NET: DM9000: Pass IRQ flags via platform data

2007-11-23 Thread Jeff Garzik

ACK

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 03/22] NET: DM9000: Pass IRQ flags via platform data

2007-11-19 Thread Ben Dooks
Use the platform data to pass modifications to the flags
passed to request_irq() to alter the behaviour of the IRQ.

This can be used to specify IRQ type for the platform the
DM9000 is connected to.

Signed-off-by: Ben Dooks <[EMAIL PROTECTED]>

Index: linux-2.6.22-quilt6/drivers/net/dm9000.c
===
--- linux-2.6.22-quilt6.orig/drivers/net/dm9000.c   2007-08-20 
18:26:22.0 +0100
+++ linux-2.6.22-quilt6/drivers/net/dm9000.c2007-08-20 18:37:54.0 
+0100
@@ -89,9 +89,6 @@
 #define writesboutsb
 #define writeswoutsw
 #define writesloutsl
-#define DM9000_IRQ_FLAGS   (IRQF_SHARED | IRQF_TRIGGER_HIGH)
-#else
-#define DM9000_IRQ_FLAGS   IRQF_SHARED
 #endif
 
 /*
@@ -124,6 +121,8 @@ typedef struct board_info {
 
struct device   *dev;/* parent device */
 
+   struct dm9000_plat_data *platdata;
+
struct resource *addr_res;   /* resources found */
struct resource *data_res;
struct resource *addr_req;   /* resources requested */
@@ -496,9 +495,11 @@ dm9000_probe(struct platform_device *pde
 
/* check to see if anything is being over-ridden */
if (pdata != NULL) {
+   db->platdata = pdata;
+
/* check to see if the driver wants to over-ride the
 * default IO width */
-
+ 
if (pdata->flags & DM9000_PLATF_8BITONLY)
dm9000_set_io(db, 1);
 
@@ -619,10 +620,14 @@ static int
 dm9000_open(struct net_device *dev)
 {
board_info_t *db = (board_info_t *) dev->priv;
+   unsigned long irqflags = IRQF_SHARED;
 
dev_dbg(db->dev, "entering %s\n", __func__);
 
-   if (request_irq(dev->irq, &dm9000_interrupt, DM9000_IRQ_FLAGS, 
dev->name, dev))
+   if (db->platdata)
+   irqflags |= db->platdata->irqflags;
+
+   if (request_irq(dev->irq, &dm9000_interrupt, irqflags, dev->name, dev))
return -EAGAIN;
 
/* Initialize DM9000 board */
Index: linux-2.6.22-quilt6/include/linux/dm9000.h
===
--- linux-2.6.22-quilt6.orig/include/linux/dm9000.h 2007-08-20 
18:19:04.0 +0100
+++ linux-2.6.22-quilt6/include/linux/dm9000.h  2007-08-20 18:28:37.0 
+0100
@@ -25,6 +25,7 @@
 
 struct dm9000_plat_data {
unsigned intflags;
+   unsigned long   irqflags;   /* to pass to request_irq() */
 
/* allow replacement IO routines */
 

-- 
Ben ([EMAIL PROTECTED], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html