diff mbox

[net-next,3/3] caif: Add wakeline status tracking

Message ID 1328181565-13781-3-git-send-email-sjur.brandeland@stericsson.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

sjur.brandeland@stericsson.com Feb. 2, 2012, 11:19 a.m. UTC
Add initial support for tracking of wake-line status so we at any time
know when we have a timer running and HSI wake-line high.

The cfhsi_notify_rx, and cfhsi_wakeline_aquired/released are
dummies for now.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
 drivers/net/caif/caif_hsi.c |   25 +++++++++++++++++++++++--
 include/net/caif/caif_hsi.h |    8 ++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

Comments

David Miller Feb. 2, 2012, 7:30 p.m. UTC | #1
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Thu,  2 Feb 2012 12:19:25 +0100

> Add initial support for tracking of wake-line status so we at any time
> know when we have a timer running and HSI wake-line high.
> 
> The cfhsi_notify_rx, and cfhsi_wakeline_aquired/released are
> dummies for now.
> 
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>

Magic unused ifdefs and empty methods for a new feature not even
implemented.

No thanks on both counts.

I'm not applying this.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 0a4fc62..749586f 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -399,6 +399,7 @@  static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
 			netif_rx(skb);
 		else
 			netif_rx_ni(skb);
+		cfhsi_notify_rx(cfhsi);
 
 		/* Update network statistics. */
 		cfhsi->ndev->stats.rx_packets++;
@@ -500,6 +501,7 @@  static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
 			netif_rx(skb);
 		else
 			netif_rx_ni(skb);
+		cfhsi_notify_rx(cfhsi);
 
 		/* Update network statistics. */
 		cfhsi->ndev->stats.rx_packets++;
@@ -787,6 +789,9 @@  static void cfhsi_wake_down(struct work_struct *work)
 	if (test_bit(CFHSI_SHUTDOWN, &cfhsi->bits))
 		return;
 
+	/* Clear spurious states (if any) */
+	WARN_ON(test_and_clear_bit(CFHSI_WAKE_DOWN_ACK, &cfhsi->bits));
+
 	/* Deactivate wake line. */
 	cfhsi->dev->cfhsi_wake_down(cfhsi->dev);
 
@@ -836,6 +841,10 @@  static void cfhsi_wake_down(struct work_struct *work)
 	/* Cancel pending RX requests. */
 	cfhsi->dev->cfhsi_rx_cancel(cfhsi->dev);
 
+	spin_lock_bh(&cfhsi->lock);
+	if (!test_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+		cfhsi_wakeline_released(cfhsi);
+	spin_unlock_bh(&cfhsi->lock);
 }
 
 static void cfhsi_out_of_sync(struct work_struct *work)
@@ -864,8 +873,12 @@  static void cfhsi_wake_up_cb(struct cfhsi_drv *drv)
 		return;
 
 	/* Schedule wake up work queue if the peer initiates. */
-	if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+	spin_lock_bh(&cfhsi->lock);
+	if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits)) {
+		cfhsi_wakeline_aquired(cfhsi);
 		queue_work(cfhsi->wq, &cfhsi->wake_up_work);
+	}
+	spin_unlock_bh(&cfhsi->lock);
 }
 
 static void cfhsi_wake_down_cb(struct cfhsi_drv *drv)
@@ -944,8 +957,12 @@  static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
 		}
 	} else {
 		/* Schedule wake up work queue if the we initiate. */
-		if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+		spin_lock_bh(&cfhsi->lock);
+		if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits)) {
+			cfhsi_wakeline_aquired(cfhsi);
 			queue_work(cfhsi->wq, &cfhsi->wake_up_work);
+		}
+		spin_unlock_bh(&cfhsi->lock);
 	}
 
 	return 0;
@@ -1099,6 +1116,8 @@  int cfhsi_probe(struct platform_device *pdev)
 	cfhsi->rx_slowpath_timer.data = (unsigned long)cfhsi;
 	cfhsi->rx_slowpath_timer.function = cfhsi_rx_slowpath;
 
+	cfhsi_wakeline_init();
+
 	/* Add CAIF HSI device to list. */
 	spin_lock(&cfhsi_list_lock);
 	list_add_tail(&cfhsi->list, &cfhsi_list);
@@ -1180,6 +1199,8 @@  static void cfhsi_shutdown(struct cfhsi *cfhsi)
 	/* Deactivate interface */
 	cfhsi->dev->cfhsi_down(cfhsi->dev);
 
+	cfhsi_wakeline_deinit();
+
 	/* Finally unregister the network device. */
 	unregister_netdev(cfhsi->ndev);
 
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 8d55251..5caefc6 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -157,4 +157,12 @@  struct cfhsi {
 
 extern struct platform_driver cfhsi_driver;
 
+#ifndef CFHSI_WAKELOCKS
+#define cfhsi_wakeline_aquired(dev)
+#define cfhsi_wakeline_released(dev)
+#define cfhsi_notify_rx(dev)
+#define cfhsi_wakeline_init(dev)
+#define cfhsi_wakeline_deinit(dev)
+#endif
+
 #endif		/* CAIF_HSI_H_ */