[PATCH 6/7] firedtv: move some code back to ieee1394 core

Stefan Richter stefanr at s5r6.in-berlin.de
Sun Aug 24 21:30:00 UTC 2008


Partially reverts "ieee1394: remove unused code" of Linux 2.6.25.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/ieee1394/ieee1394_core.c         |    1 
 drivers/ieee1394/ieee1394_transactions.c |   29 ++++++++++
 drivers/ieee1394/ieee1394_transactions.h |    2 
 drivers/media/dvb/firesat/cmp.c          |   61 +----------------------
 4 files changed, 35 insertions(+), 58 deletions(-)

Index: linux/drivers/ieee1394/ieee1394_core.c
===================================================================
--- linux.orig/drivers/ieee1394/ieee1394_core.c
+++ linux/drivers/ieee1394/ieee1394_core.c
@@ -1314,6 +1314,7 @@ EXPORT_SYMBOL(hpsb_make_lock64packet);
 EXPORT_SYMBOL(hpsb_make_phypacket);
 EXPORT_SYMBOL(hpsb_read);
 EXPORT_SYMBOL(hpsb_write);
+EXPORT_SYMBOL(hpsb_lock);
 EXPORT_SYMBOL(hpsb_packet_success);
 
 /** highlevel.c **/
Index: linux/drivers/ieee1394/ieee1394_transactions.c
===================================================================
--- linux.orig/drivers/ieee1394/ieee1394_transactions.c
+++ linux/drivers/ieee1394/ieee1394_transactions.c
@@ -570,3 +570,32 @@ int hpsb_write(struct hpsb_host *host, n
 
 	return retval;
 }
+
+int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
+	      u64 addr, int extcode, quadlet_t *data, quadlet_t arg)
+{
+	struct hpsb_packet *packet;
+	int retval = 0;
+
+	BUG_ON(in_interrupt());
+
+	packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg);
+	if (!packet)
+		return -ENOMEM;
+
+	packet->generation = generation;
+	retval = hpsb_send_packet_and_wait(packet);
+	if (retval < 0)
+		goto hpsb_lock_fail;
+
+	retval = hpsb_packet_success(packet);
+
+	if (retval == 0)
+		*data = packet->data[0];
+
+hpsb_lock_fail:
+	hpsb_free_tlabel(packet);
+	hpsb_free_packet(packet);
+
+	return retval;
+}
Index: linux/drivers/ieee1394/ieee1394_transactions.h
===================================================================
--- linux.orig/drivers/ieee1394/ieee1394_transactions.h
+++ linux/drivers/ieee1394/ieee1394_transactions.h
@@ -30,6 +30,8 @@ int hpsb_read(struct hpsb_host *host, no
 	      u64 addr, quadlet_t *buffer, size_t length);
 int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
 	       u64 addr, quadlet_t *buffer, size_t length);
+int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
+	      u64 addr, int extcode, quadlet_t *data, quadlet_t arg);
 
 #ifdef HPSB_DEBUG_TLABELS
 extern spinlock_t hpsb_tlabel_lock;
Index: linux/drivers/media/dvb/firesat/cmp.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/cmp.c
+++ linux/drivers/media/dvb/firesat/cmp.c
@@ -10,8 +10,6 @@
  *	the License, or (at your option) any later version.
  */
 
-#include <linux/bug.h>
-#include <linux/hardirq.h>
 #include <linux/kernel.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
@@ -44,42 +42,6 @@ typedef struct _OPCR
 
 #define FIRESAT_SPEED IEEE1394_SPEED_400
 
-/* hpsb_lock is being removed from the kernel-source,
- * therefor we define our own 'firesat_hpsb_lock'*/
-
-int send_packet_and_wait(struct hpsb_packet *packet);
-
-int firesat_hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
-		u64 addr, int extcode, quadlet_t * data, quadlet_t arg) {
-
-	struct hpsb_packet *packet;
-	int retval = 0;
-
-	BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
-
-	packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg);
-	if (!packet)
-		return -ENOMEM;
-
-	packet->generation = generation;
-	retval = send_packet_and_wait(packet);
-	if (retval < 0)
-		goto hpsb_lock_fail;
-
-	retval = hpsb_packet_success(packet);
-
-	if (retval == 0) {
-		*data = packet->data[0];
-	}
-
-	hpsb_lock_fail:
-	hpsb_free_tlabel(packet);
-	hpsb_free_packet(packet);
-
-	return retval;
-}
-
-
 static int cmp_read(struct firesat *firesat, void *buf, u64 addr, size_t len)
 {
 	int ret;
@@ -102,9 +64,9 @@ static int cmp_lock(struct firesat *fire
 	if (mutex_lock_interruptible(&firesat->avc_mutex))
 		return -EINTR;
 
-	ret = firesat_hpsb_lock(firesat->host, firesat->nodeentry->nodeid,
-				firesat->nodeentry->generation,
-				addr, ext_tcode, data, arg);
+	ret = hpsb_lock(firesat->host, firesat->nodeentry->nodeid,
+			firesat->nodeentry->generation,
+			addr, ext_tcode, data, arg);
 
 	mutex_unlock(&firesat->avc_mutex);
 	return ret;
@@ -235,20 +197,3 @@ int try_CMPBreakPPconnection(struct fire
     }
 	return 0;
 }
-
-static void complete_packet(void *data) {
-	complete((struct completion *) data);
-}
-
-int send_packet_and_wait(struct hpsb_packet *packet) {
-	struct completion done;
-	int retval;
-
-	init_completion(&done);
-	hpsb_set_packet_complete_task(packet, complete_packet, &done);
-	retval = hpsb_send_packet(packet);
-	if (retval == 0)
-		wait_for_completion(&done);
-
-	return retval;
-}

-- 
Stefan Richter
-=====-==--- =--- ==---
http://arcgraph.de/sr/




More information about the devel mailing list