[PATCH 27/33] pcmcia: remove unused p_dev->state flags

Dominik Brodowski linux at dominikbrodowski.net
Fri Mar 31 15:27:41 EST 2006


Remove the unused DEV_RELEASE_PENDING flag, and move the DEV_SUSPEND flag
into the p_dev structure, and make use of it at the core level.

Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>

---

 drivers/net/wireless/atmel_cs.c   |    2 +-
 drivers/net/wireless/ray_cs.c     |    2 +-
 drivers/net/wireless/wavelan_cs.c |    1 -
 drivers/pcmcia/ds.c               |   48 +++++++++++++++++++------------------
 drivers/telephony/ixj_pcmcia.c    |    1 -
 include/pcmcia/ds.h               |    6 ++---
 6 files changed, 30 insertions(+), 30 deletions(-)

f6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 962272c..d09b147 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -220,7 +220,7 @@ do { last_fn = (fn); if ((last_ret = (re
 static int card_present(void *arg)
 { 
 	struct pcmcia_device *link = (struct pcmcia_device *)arg;
-	if (link->state & DEV_SUSPEND)
+	if (link->suspended)
 		return 0;
 	else if (link->state & DEV_PRESENT)
 		return 1;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 8cfe933..e392433 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -1968,7 +1968,7 @@ static irqreturn_t ray_interrupt(int irq
 
     local = (ray_dev_t *)dev->priv;
     link = (struct pcmcia_device *)local->finder;
-    if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) {
+    if ( ! (link->state & DEV_PRESENT) || link->suspended ) {
         DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
         return IRQ_NONE;
     }
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 7373caf..6b67696 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4744,7 +4744,6 @@ static int wavelan_resume(struct pcmcia_
 {
 	struct net_device *	dev = (struct net_device *) link->priv;
 
-	link->state &= ~DEV_SUSPEND;
 	if ((link->state & DEV_CONFIG) && (link->open))	{
 		wv_hw_reset(dev);
 		netif_device_attach(dev);
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index e8fe544..34e634a 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -945,7 +945,7 @@ static ssize_t pcmcia_show_pm_state(stru
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 
-	if (p_dev->dev.power.power_state.event != PM_EVENT_ON)
+	if (p_dev->suspended)
 		return sprintf(buf, "off\n");
 	else
 		return sprintf(buf, "on\n");
@@ -960,11 +960,9 @@ static ssize_t pcmcia_store_pm_state(str
         if (!count)
                 return -EINVAL;
 
-	if ((p_dev->dev.power.power_state.event == PM_EVENT_ON) &&
-	    (!strncmp(buf, "off", 3)))
+	if ((!p_dev->suspended) && !strncmp(buf, "off", 3))
 		ret = dpm_runtime_suspend(dev, PMSG_SUSPEND);
-	else if ((p_dev->dev.power.power_state.event != PM_EVENT_ON) &&
-		 (!strncmp(buf, "on", 2)))
+	else if (p_dev->suspended && !strncmp(buf, "on", 2))
 		dpm_runtime_resume(dev);
 
 	return ret ? ret : count;
@@ -1030,7 +1028,7 @@ static int pcmcia_dev_suspend(struct dev
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 	struct pcmcia_driver *p_drv = NULL;
-	int ret;
+	int ret = 0;
 
 	if (dev->driver)
 		p_drv = to_pcmcia_drv(dev->driver);
@@ -1038,14 +1036,16 @@ static int pcmcia_dev_suspend(struct dev
 	if (p_drv && p_drv->suspend) {
 		ret = p_drv->suspend(p_dev);
 		if (ret)
-			return ret;
-		p_dev->state |= DEV_SUSPEND;
-			if ((p_dev->state & DEV_CONFIG) &&
-			    !(p_dev->state & DEV_SUSPEND_NORELEASE))
-				pcmcia_release_configuration(p_dev);
+			goto out;
+		if ((p_dev->state & DEV_CONFIG) &&
+		    !(p_dev->state & DEV_SUSPEND_NORELEASE))
+			pcmcia_release_configuration(p_dev);
 	}
 
-	return 0;
+ out:
+	if (!ret)
+		p_dev->suspended = 1;
+	return ret;
 }
 
 
@@ -1053,24 +1053,26 @@ static int pcmcia_dev_resume(struct devi
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
         struct pcmcia_driver *p_drv = NULL;
-	int ret;
+	int ret = 0;
 
 	if (dev->driver)
 		p_drv = to_pcmcia_drv(dev->driver);
 
 	if (p_drv && p_drv->resume) {
-		p_dev->state &= ~DEV_SUSPEND;
-			if ((p_dev->state & DEV_CONFIG) &&
-			    !(p_dev->state & DEV_SUSPEND_NORELEASE)){
-				ret = pcmcia_request_configuration(p_dev,
-						 &p_dev->conf);
-				if (ret)
-					return ret;
-			}
-		return p_drv->resume(p_dev);
+		if ((p_dev->state & DEV_CONFIG) &&
+		    !(p_dev->state & DEV_SUSPEND_NORELEASE)){
+			ret = pcmcia_request_configuration(p_dev,
+							   &p_dev->conf);
+			if (ret)
+				goto out;
+		}
+		ret = p_drv->resume(p_dev);
 	}
 
-	return 0;
+ out:
+	if (!ret)
+		p_dev->suspended = 0;
+	return ret;
 }
 
 
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index a27df61..5c7611c 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -60,7 +60,6 @@ static void ixj_detach(struct pcmcia_dev
 {
 	DEBUG(0, "ixj_detach(0x%p)\n", link);
 
-	link->state &= ~DEV_RELEASE_PENDING;
 	if (link->state & DEV_CONFIG)
 		ixj_cs_release(link);
 
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 557d8ae..93a7ebc 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -108,8 +108,6 @@ typedef struct dev_node_t {
 #define DEV_CONFIG		0x02
 #define DEV_SUSPEND_NORELEASE	0x04
 #define DEV_CONFIG_PENDING	0x10
-#define DEV_RELEASE_PENDING	0x20
-#define DEV_SUSPEND		0x40
 #define DEV_BUSY		0x80
 
 #define DEV_OK(l) \
@@ -163,13 +161,15 @@ struct pcmcia_device {
 
 	u_int			p_state;
 
+	u8			suspended:1;
+	u8			reserved:3;
+
 	/* information about this device */
 	u8			has_manf_id:1;
 	u8			has_card_id:1;
 	u8			has_func_id:1;
 
 	u8			allow_func_id_match:1;
-	u8			reserved:4;
 
 	u8			func_id;
 	u16			manf_id;
-- 
1.2.4




More information about the linux-pcmcia mailing list