patch-2.4.23 linux-2.4.23/drivers/ieee1394/ieee1394_core.c

Next file: linux-2.4.23/drivers/ieee1394/ieee1394_transactions.c
Previous file: linux-2.4.23/drivers/ieee1394/ieee1394-ioctl.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/drivers/ieee1394/ieee1394_core.c linux-2.4.23/drivers/ieee1394/ieee1394_core.c
@@ -59,19 +59,22 @@
 /* Some globals used */
 const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" };
 
+#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
 static void dump_packet(const char *text, quadlet_t *data, int size)
 {
-        int i;
+	int i;
 
-        size /= 4;
-        size = (size > 4 ? 4 : size);
+	size /= 4;
+	size = (size > 4 ? 4 : size);
 
-        printk(KERN_DEBUG "ieee1394: %s", text);
-        for (i = 0; i < size; i++) {
-                printk(" %8.8x", data[i]);
-        }
-        printk("\n");
+	printk(KERN_DEBUG "ieee1394: %s", text);
+	for (i = 0; i < size; i++)
+		printk(" %08x", data[i]);
+	printk("\n");
 }
+#else
+#define dump_packet(x,y,z)
+#endif
 
 static void run_packet_complete(struct hpsb_packet *packet)
 {
@@ -277,8 +280,8 @@
 
 static void build_speed_map(struct hpsb_host *host, int nodecount)
 {
-        char speedcap[nodecount];
-        char cldcnt[nodecount];
+	u8 speedcap[nodecount];
+        u8 cldcnt[nodecount];
         u8 *map = host->speed_map;
         struct selfid *sid;
         struct ext_selfid *esid;
@@ -329,7 +332,7 @@
         for (i = 1; i < nodecount; i++) {
                 for (j = cldcnt[i], n = i - 1; j > 0; j--) {
                         cldcnt[i] += cldcnt[n];
-                        speedcap[n] = MIN(speedcap[n], speedcap[i]);
+                        speedcap[n] = min(speedcap[n], speedcap[i]);
                         n -= cldcnt[n] + 1;
                 }
         }
@@ -338,11 +341,11 @@
                 for (i = n - cldcnt[n]; i <= n; i++) {
                         for (j = 0; j < (n - cldcnt[n]); j++) {
                                 map[j*64 + i] = map[i*64 + j] =
-                                        MIN(map[i*64 + j], speedcap[n]);
+                                        min(map[i*64 + j], speedcap[n]);
                         }
                         for (j = n + 1; j < nodecount; j++) {
                                 map[j*64 + i] = map[i*64 + j] =
-                                        MIN(map[i*64 + j], speedcap[n]);
+                                        min(map[i*64 + j], speedcap[n]);
                         }
                 }
         }
@@ -352,9 +355,7 @@
 void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid)
 {
         if (host->in_bus_reset) {
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
-                HPSB_INFO("Including SelfID 0x%x", sid);
-#endif
+                HPSB_VERBOSE("Including SelfID 0x%x", sid);
                 host->topology_map[host->selfid_count++] = sid;
         } else {
                 HPSB_NOTICE("Spurious SelfID packet (0x%08x) received from bus %d",
@@ -388,10 +389,9 @@
                 build_speed_map(host, host->node_count);
         }
 
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
-        HPSB_INFO("selfid_complete called with successful SelfID stage "
-		"... irm_id: 0x%X node_id: 0x%X",host->irm_id,host->node_id);
-#endif
+	HPSB_VERBOSE("selfid_complete called with successful SelfID stage "
+		     "... irm_id: 0x%X node_id: 0x%X",host->irm_id,host->node_id);
+
         /* irm_id is kept up to date by check_selfids() */
         if (host->irm_id == host->node_id) {
                 host->is_irm = 1;
@@ -549,10 +549,9 @@
                         }
                 }
 
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
                 dump_packet("send packet local:", packet->header,
                             packet->header_size);
-#endif
+
                 hpsb_packet_sent(host, packet,  packet->expect_response?ACK_PENDING:ACK_COMPLETE);
                 hpsb_packet_received(host, data, size, 0);
 
@@ -567,7 +566,6 @@
                                        + NODEID_TO_NODE(packet->node_id)];
         }
 
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
         switch (packet->speed_code) {
         case 2:
                 dump_packet("send packet 400:", packet->header,
@@ -581,7 +579,6 @@
                 dump_packet("send packet 100:", packet->header,
                             packet->header_size);
         }
-#endif
 
         return host->driver->transmit_packet(host, packet);
 }
@@ -616,7 +613,7 @@
         }
 
         if (lh == &host->pending_packets) {
-                HPSB_DEBUG("unsolicited response packet received - np");
+                HPSB_DEBUG("unsolicited response packet received - no tlabel match");
                 dump_packet("contents:", data, 16);
                 spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
                 return;
@@ -640,7 +637,7 @@
 
         if (!tcode_match || (packet->tlabel != tlabel)
             || (packet->node_id != (data[1] >> 16))) {
-                HPSB_INFO("unsolicited response packet received");
+                HPSB_INFO("unsolicited response packet received - tcode mismatch");
                 dump_packet("contents:", data, 16);
 
                 spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
@@ -822,6 +819,8 @@
                 if (rcode >= 0) {
                         fill_async_readblock_resp(packet, rcode, length);
                         send_packet_nocare(packet);
+                } else {
+                        free_hpsb_packet(packet);
                 }
                 break;
 
@@ -895,9 +894,7 @@
                 return;
         }
 
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
         dump_packet("received packet:", data, size);
-#endif
 
         tcode = (data[0] >> 4) & 0xf;
 
@@ -1276,6 +1273,7 @@
 EXPORT_SYMBOL(hpsb_free_tlabel);
 EXPORT_SYMBOL(hpsb_make_readpacket);
 EXPORT_SYMBOL(hpsb_make_writepacket);
+EXPORT_SYMBOL(hpsb_make_streampacket);
 EXPORT_SYMBOL(hpsb_make_lockpacket);
 EXPORT_SYMBOL(hpsb_make_lock64packet);
 EXPORT_SYMBOL(hpsb_make_phypacket);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)