Loading drivers/ieee1394/iso.c +60 −42 Original line number Diff line number Diff line Loading @@ -36,20 +36,22 @@ void hpsb_iso_shutdown(struct hpsb_iso *iso) kfree(iso); } static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_iso_type type, static struct hpsb_iso *hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_iso_type type, unsigned int data_buf_size, unsigned int buf_packets, int channel, int dma_mode, int channel, int dma_mode, int irq_interval, void (*callback)(struct hpsb_iso*)) void (*callback) (struct hpsb_iso *)) { struct hpsb_iso *iso; int dma_direction; /* make sure driver supports the ISO API */ if (!host->driver->isoctl) { printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n", printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n", host->driver->name); return NULL; } Loading @@ -59,7 +61,8 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i if (buf_packets < 2) buf_packets = 2; if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) dma_mode = HPSB_ISO_DMA_DEFAULT; if ((irq_interval < 0) || (irq_interval > buf_packets / 4)) Loading @@ -76,7 +79,10 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i /* allocate and write the struct hpsb_iso */ iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL); iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL); if (!iso) return NULL; Loading Loading @@ -111,7 +117,8 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i iso->prebuffer = 0; /* allocate the packet buffer */ if (dma_region_alloc(&iso->data_buf, iso->buf_size, host->pdev, dma_direction)) if (dma_region_alloc (&iso->data_buf, iso->buf_size, host->pdev, dma_direction)) goto err; return iso; Loading @@ -133,7 +140,6 @@ int hpsb_iso_n_ready(struct hpsb_iso* iso) return val; } struct hpsb_iso *hpsb_iso_xmit_init(struct hpsb_host *host, unsigned int data_buf_size, unsigned int buf_packets, Loading @@ -144,7 +150,9 @@ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, { struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT, data_buf_size, buf_packets, channel, HPSB_ISO_DMA_DEFAULT, irq_interval, callback); channel, HPSB_ISO_DMA_DEFAULT, irq_interval, callback); if (!iso) return NULL; Loading Loading @@ -172,7 +180,8 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, { struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV, data_buf_size, buf_packets, channel, dma_mode, irq_interval, callback); channel, dma_mode, irq_interval, callback); if (!iso) return NULL; Loading Loading @@ -206,7 +215,8 @@ int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask) { if (iso->type != HPSB_ISO_RECV || iso->channel != -1) return -EINVAL; return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long) &mask); return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long)&mask); } int hpsb_iso_recv_flush(struct hpsb_iso *iso) Loading Loading @@ -283,7 +293,9 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) isoctl_args[2] = sync; retval = iso->host->driver->isoctl(iso, RECV_START, (unsigned long) &isoctl_args[0]); retval = iso->host->driver->isoctl(iso, RECV_START, (unsigned long)&isoctl_args[0]); if (retval) return retval; Loading @@ -296,7 +308,8 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, unsigned int offset, unsigned short len, unsigned int *out_offset, unsigned short *out_len) unsigned int *out_offset, unsigned short *out_len) { if (offset >= iso->buf_size) return -EFAULT; Loading @@ -316,8 +329,8 @@ static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, return 0; } int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy) int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy) { struct hpsb_iso_packet_info *info; unsigned long flags; Loading @@ -334,7 +347,8 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag info = &iso->infos[iso->first_packet]; /* check for bogus offset/length */ if (hpsb_iso_check_offset_len(iso, offset, len, &info->offset, &info->len)) if (hpsb_iso_check_offset_len (iso, offset, len, &info->offset, &info->len)) return -EFAULT; info->tag = tag; Loading Loading @@ -369,7 +383,9 @@ int hpsb_iso_xmit_sync(struct hpsb_iso *iso) if (iso->type != HPSB_ISO_XMIT) return -EINVAL; return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets); return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets); } void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) Loading @@ -396,7 +412,8 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) } void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy) u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy) { unsigned long flags; spin_lock_irqsave(&iso->lock, flags); Loading Loading @@ -435,7 +452,8 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets) spin_lock_irqsave(&iso->lock, flags); for (i = 0; i < n_packets; i++) { rv = iso->host->driver->isoctl(iso, RECV_RELEASE, (unsigned long) &iso->infos[iso->first_packet]); (unsigned long)&iso->infos[iso-> first_packet]); if (rv) break; Loading Loading
drivers/ieee1394/iso.c +60 −42 Original line number Diff line number Diff line Loading @@ -36,20 +36,22 @@ void hpsb_iso_shutdown(struct hpsb_iso *iso) kfree(iso); } static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_iso_type type, static struct hpsb_iso *hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_iso_type type, unsigned int data_buf_size, unsigned int buf_packets, int channel, int dma_mode, int channel, int dma_mode, int irq_interval, void (*callback)(struct hpsb_iso*)) void (*callback) (struct hpsb_iso *)) { struct hpsb_iso *iso; int dma_direction; /* make sure driver supports the ISO API */ if (!host->driver->isoctl) { printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n", printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n", host->driver->name); return NULL; } Loading @@ -59,7 +61,8 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i if (buf_packets < 2) buf_packets = 2; if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) if ((dma_mode < HPSB_ISO_DMA_DEFAULT) || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER)) dma_mode = HPSB_ISO_DMA_DEFAULT; if ((irq_interval < 0) || (irq_interval > buf_packets / 4)) Loading @@ -76,7 +79,10 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i /* allocate and write the struct hpsb_iso */ iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL); iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL); if (!iso) return NULL; Loading Loading @@ -111,7 +117,8 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i iso->prebuffer = 0; /* allocate the packet buffer */ if (dma_region_alloc(&iso->data_buf, iso->buf_size, host->pdev, dma_direction)) if (dma_region_alloc (&iso->data_buf, iso->buf_size, host->pdev, dma_direction)) goto err; return iso; Loading @@ -133,7 +140,6 @@ int hpsb_iso_n_ready(struct hpsb_iso* iso) return val; } struct hpsb_iso *hpsb_iso_xmit_init(struct hpsb_host *host, unsigned int data_buf_size, unsigned int buf_packets, Loading @@ -144,7 +150,9 @@ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, { struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT, data_buf_size, buf_packets, channel, HPSB_ISO_DMA_DEFAULT, irq_interval, callback); channel, HPSB_ISO_DMA_DEFAULT, irq_interval, callback); if (!iso) return NULL; Loading Loading @@ -172,7 +180,8 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host, { struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV, data_buf_size, buf_packets, channel, dma_mode, irq_interval, callback); channel, dma_mode, irq_interval, callback); if (!iso) return NULL; Loading Loading @@ -206,7 +215,8 @@ int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask) { if (iso->type != HPSB_ISO_RECV || iso->channel != -1) return -EINVAL; return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long) &mask); return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long)&mask); } int hpsb_iso_recv_flush(struct hpsb_iso *iso) Loading Loading @@ -283,7 +293,9 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) isoctl_args[2] = sync; retval = iso->host->driver->isoctl(iso, RECV_START, (unsigned long) &isoctl_args[0]); retval = iso->host->driver->isoctl(iso, RECV_START, (unsigned long)&isoctl_args[0]); if (retval) return retval; Loading @@ -296,7 +308,8 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, unsigned int offset, unsigned short len, unsigned int *out_offset, unsigned short *out_len) unsigned int *out_offset, unsigned short *out_len) { if (offset >= iso->buf_size) return -EFAULT; Loading @@ -316,8 +329,8 @@ static int hpsb_iso_check_offset_len(struct hpsb_iso *iso, return 0; } int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy) int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy) { struct hpsb_iso_packet_info *info; unsigned long flags; Loading @@ -334,7 +347,8 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag info = &iso->infos[iso->first_packet]; /* check for bogus offset/length */ if (hpsb_iso_check_offset_len(iso, offset, len, &info->offset, &info->len)) if (hpsb_iso_check_offset_len (iso, offset, len, &info->offset, &info->len)) return -EFAULT; info->tag = tag; Loading Loading @@ -369,7 +383,9 @@ int hpsb_iso_xmit_sync(struct hpsb_iso *iso) if (iso->type != HPSB_ISO_XMIT) return -EINVAL; return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets); return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets); } void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) Loading @@ -396,7 +412,8 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error) } void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy) u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy) { unsigned long flags; spin_lock_irqsave(&iso->lock, flags); Loading Loading @@ -435,7 +452,8 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets) spin_lock_irqsave(&iso->lock, flags); for (i = 0; i < n_packets; i++) { rv = iso->host->driver->isoctl(iso, RECV_RELEASE, (unsigned long) &iso->infos[iso->first_packet]); (unsigned long)&iso->infos[iso-> first_packet]); if (rv) break; Loading