## Automatically generated incremental diff ## From: linux-2.4.21-bk19 ## To: linux-2.4.21-bk20 ## Robot: $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $ diff -urN linux-2.4.21-bk19/Makefile linux-2.4.21-bk20/Makefile --- linux-2.4.21-bk19/Makefile 2003-07-28 02:54:13.000000000 -0700 +++ linux-2.4.21-bk20/Makefile 2003-07-28 02:54:19.000000000 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 21 -EXTRAVERSION = -bk19 +EXTRAVERSION = -bk20 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) diff -urN linux-2.4.21-bk19/drivers/ieee1394/csr.c linux-2.4.21-bk20/drivers/ieee1394/csr.c --- linux-2.4.21-bk19/drivers/ieee1394/csr.c 2003-07-28 02:54:16.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/csr.c 2003-07-28 02:54:21.000000000 -0700 @@ -19,6 +19,7 @@ #include #include /* needed for MODULE_PARM */ +#include #include "ieee1394_types.h" #include "hosts.h" @@ -87,6 +88,35 @@ 0x3f1)); } +/* + * HI == seconds (bits 0:2) + * LO == fraction units of 1/8000 of a second, as per 1394 (bits 19:31) + * + * Convert to units and then to HZ, for comparison to jiffies. + * + * By default this will end up being 800 units, or 100ms (125usec per + * unit). + * + * NOTE: The spec says 1/8000, but also says we can compute based on 1/8192 + * like CSR specifies. Should make our math less complex. + */ +static inline void calculate_expire(struct csr_control *csr) +{ + unsigned long units; + + /* Take the seconds, and convert to units */ + units = (unsigned long)(csr->split_timeout_hi & 0x07) << 13; + + /* Add in the fractional units */ + units += (unsigned long)(csr->split_timeout_lo >> 19); + + /* Convert to jiffies */ + csr->expire = (unsigned long)(units * HZ) >> 13UL; + + /* Just to keep from rounding low */ + csr->expire++; +} + static void add_host(struct hpsb_host *host) { @@ -98,6 +128,7 @@ host->csr.node_ids = 0; host->csr.split_timeout_hi = 0; host->csr.split_timeout_lo = 800 << 19; + calculate_expire(&host->csr); host->csr.cycle_time = 0; host->csr.bus_time = 0; host->csr.bus_manager_id = 0x3f; @@ -334,10 +365,12 @@ case CSR_SPLIT_TIMEOUT_HI: host->csr.split_timeout_hi = be32_to_cpu(*(data++)) & 0x00000007; + calculate_expire(&host->csr); out; case CSR_SPLIT_TIMEOUT_LO: host->csr.split_timeout_lo = be32_to_cpu(*(data++)) & 0xfff80000; + calculate_expire(&host->csr); out; /* address gap */ diff -urN linux-2.4.21-bk19/drivers/ieee1394/csr.h linux-2.4.21-bk20/drivers/ieee1394/csr.h --- linux-2.4.21-bk19/drivers/ieee1394/csr.h 2003-07-28 02:54:16.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/csr.h 2003-07-28 02:54:21.000000000 -0700 @@ -41,6 +41,7 @@ quadlet_t state; quadlet_t node_ids; quadlet_t split_timeout_hi, split_timeout_lo; + unsigned long expire; // Calculated from split_timeout quadlet_t cycle_time; quadlet_t bus_time; quadlet_t bus_manager_id; diff -urN linux-2.4.21-bk19/drivers/ieee1394/dma.c linux-2.4.21-bk20/drivers/ieee1394/dma.c --- linux-2.4.21-bk19/drivers/ieee1394/dma.c 2003-07-28 02:54:16.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/dma.c 2003-07-28 02:54:21.000000000 -0700 @@ -151,16 +151,15 @@ for (i = 0; i < dma->n_dma_pages; i++) { if (off < sg_dma_len(&dma->sglist[i])) { *rem = off; - return i; + break; } off -= sg_dma_len(&dma->sglist[i]); } - printk("dma_region_find: offset %lu beyond end of DMA mapping\n", offset); - BUG(); + BUG_ON(i >= dma->n_dma_pages); - return -ENOENT; + return i; } dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset) diff -urN linux-2.4.21-bk19/drivers/ieee1394/hosts.c linux-2.4.21-bk20/drivers/ieee1394/hosts.c --- linux-2.4.21-bk19/drivers/ieee1394/hosts.c 2003-06-13 07:51:34.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/hosts.c 2003-07-28 02:54:21.000000000 -0700 @@ -138,7 +138,10 @@ atomic_set(&h->generation, 0); - INIT_TQUEUE(&h->timeout_tq, (void (*)(void*))abort_timedouts, h); + init_timer(&h->timeout); + h->timeout.data = (unsigned long) h; + h->timeout.function = abort_timedouts; + h->timeout_interval = HZ / 20; // 50ms by default h->topology_map = h->csr.topology_map + 3; h->speed_map = (u8 *)(h->csr.speed_map + 2); diff -urN linux-2.4.21-bk19/drivers/ieee1394/hosts.h linux-2.4.21-bk20/drivers/ieee1394/hosts.h --- linux-2.4.21-bk19/drivers/ieee1394/hosts.h 2003-07-28 02:54:16.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/hosts.h 2003-07-28 02:54:21.000000000 -0700 @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include "ieee1394_types.h" @@ -32,7 +32,8 @@ struct list_head pending_packets; spinlock_t pending_pkt_lock; - struct tq_struct timeout_tq; + struct timer_list timeout; + unsigned long timeout_interval; unsigned char iso_listen_count[64]; diff -urN linux-2.4.21-bk19/drivers/ieee1394/ieee1394_core.c linux-2.4.21-bk20/drivers/ieee1394/ieee1394_core.c --- linux-2.4.21-bk19/drivers/ieee1394/ieee1394_core.c 2003-07-28 02:54:16.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/ieee1394_core.c 2003-07-28 02:54:21.000000000 -0700 @@ -439,7 +439,7 @@ spin_unlock_irqrestore(&host->pending_pkt_lock, flags); up(&packet->state_change); - schedule_task(&host->timeout_tq); + mod_timer(&host->timeout, jiffies + host->timeout_interval); } /** @@ -958,28 +958,23 @@ } } -void abort_timedouts(struct hpsb_host *host) +void abort_timedouts(unsigned long __opaque) { + struct hpsb_host *host = (struct hpsb_host *)__opaque; unsigned long flags; struct hpsb_packet *packet; unsigned long expire; - struct list_head *lh, *next, *tlh; + struct list_head *lh, *tlh; LIST_HEAD(expiredlist); spin_lock_irqsave(&host->csr.lock, flags); - expire = (host->csr.split_timeout_hi * 8000 - + (host->csr.split_timeout_lo >> 19)) - * HZ / 8000; - /* Avoid shortening of timeout due to rounding errors: */ - expire++; + expire = host->csr.expire; spin_unlock_irqrestore(&host->csr.lock, flags); - spin_lock_irqsave(&host->pending_pkt_lock, flags); - for (lh = host->pending_packets.next; lh != &host->pending_packets; lh = next) { + list_for_each_safe(lh, tlh, &host->pending_packets) { packet = list_entry(lh, struct hpsb_packet, list); - next = lh->next; if (time_before(packet->sendtime + expire, jiffies)) { list_del(&packet->list); list_add(&packet->list, &expiredlist); @@ -987,7 +982,7 @@ } if (!list_empty(&host->pending_packets)) - schedule_task(&host->timeout_tq); + mod_timer(&host->timeout, jiffies + host->timeout_interval); spin_unlock_irqrestore(&host->pending_pkt_lock, flags); diff -urN linux-2.4.21-bk19/drivers/ieee1394/ieee1394_core.h linux-2.4.21-bk20/drivers/ieee1394/ieee1394_core.h --- linux-2.4.21-bk19/drivers/ieee1394/ieee1394_core.h 2003-07-28 02:54:16.000000000 -0700 +++ linux-2.4.21-bk20/drivers/ieee1394/ieee1394_core.h 2003-07-28 02:54:21.000000000 -0700 @@ -88,7 +88,7 @@ return list_entry(l, struct hpsb_packet, driver_list); } -void abort_timedouts(struct hpsb_host *host); +void abort_timedouts(unsigned long __opaque); void abort_requests(struct hpsb_host *host); struct hpsb_packet *alloc_hpsb_packet(size_t data_size);