Commit 11092356 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/pci-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 09189bd8 3891cd30
......@@ -499,6 +499,7 @@ config KCORE_AOUT
default y
config KCORE_ELF
bool
default y
source "fs/Kconfig.binfmt"
......
......@@ -162,28 +162,33 @@ void do_gettimeofday(struct timeval *tv)
tv->tv_usec = usec;
}
void do_settimeofday(struct timeval *tv)
int do_settimeofday(struct timespec *tv)
{
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
write_seqlock_irq(&xtime_lock);
/* This is revolting. We need to set the xtime.tv_usec
/*
* This is revolting. We need to set the xtime.tv_usec
* correctly. However, the value in this location is
* is value at the last tick.
* Discover what correction gettimeofday
* would have done, and then undo it!
*/
if (mach_gettimeoffset)
tv->tv_usec -= mach_gettimeoffset();
tv->tv_nsec -= (mach_gettimeoffset() * 1000);
while (tv->tv_usec < 0) {
tv->tv_usec += 1000000;
while (tv->tv_nsec < 0) {
tv->tv_nsec += NSEC_PER_SEC;
tv->tv_sec--;
}
xtime.tv_sec = tv->tv_sec;
xtime.tv_nsec = (tv->tv_usec * 1000);
xtime.tv_nsec = tv->tv_nsec;
time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC;
time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT;
write_sequnlock_irq(&xtime_lock);
return 0;
}
......@@ -18,6 +18,9 @@ obj-$(CONFIG_IEEE1394_CMP) += cmp.o
clean-files := oui.c
quiet_cmd_oui2c = OUI2C $@
cmd_oui2c = $(CONFIG_SHELL) $(obj)/oui2c.sh < $(obj)/oui.db > $@
$(obj)/oui.o: $(obj)/oui.c
$(obj)/oui.c: $(obj)/oui.db $(obj)/oui2c.sh
$(CONFIG_SHELL) $(obj)/oui2c.sh < $(obj)/oui.db > $@
$(call if_changed,oui2c)
......@@ -732,7 +732,7 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
/* Fill IEEE1394 headers */
packet->db->header_desc.header[0] =
(SPEED_100 << 16) | (0x01 << 14) |
(IEEE1394_SPEED_100 << 16) | (0x01 << 14) |
(s->iso_channel << 8) | (TCODE_ISO_DATA << 4);
packet->db->header_desc.header[1] = size << 16;
......
......@@ -138,7 +138,7 @@ static void cmp_add_host(struct hpsb_host *host)
}
ch->host = host;
ch->u.ompr.rate = SPEED_100;
ch->u.ompr.rate = IEEE1394_SPEED_100;
ch->u.ompr.bcast_channel_base = 63;
ch->u.ompr.nplugs = 2;
......
......@@ -2,6 +2,10 @@
#ifndef _IEEE1394_CSR_H
#define _IEEE1394_CSR_H
#ifdef CONFIG_PREEMPT
#include <linux/sched.h>
#endif
#define CSR_REGISTER_BASE 0xfffff0000000ULL
/* register offsets relative to CSR_REGISTER_BASE */
......
......@@ -31,7 +31,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
prog->n_pages = n_bytes / PAGE_SIZE;
prog->kvirt = pci_alloc_consistent(dev, prog->n_pages * PAGE_SIZE, &prog->bus_addr);
if(!prog->kvirt) {
if (!prog->kvirt) {
printk(KERN_ERR "dma_prog_region_alloc: pci_alloc_consistent() failed\n");
dma_prog_region_free(prog);
return -ENOMEM;
......@@ -44,7 +44,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
void dma_prog_region_free(struct dma_prog_region *prog)
{
if(prog->kvirt) {
if (prog->kvirt) {
pci_free_consistent(prog->dev, prog->n_pages * PAGE_SIZE, prog->kvirt, prog->bus_addr);
}
......@@ -75,7 +75,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
n_pages = n_bytes / PAGE_SIZE;
dma->kvirt = vmalloc_32(n_pages * PAGE_SIZE);
if(!dma->kvirt) {
if (!dma->kvirt) {
printk(KERN_ERR "dma_region_alloc: vmalloc_32() failed\n");
goto err;
}
......@@ -87,7 +87,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
/* allocate scatter/gather list */
dma->sglist = kmalloc(dma->n_pages * sizeof(struct scatterlist), GFP_KERNEL);
if(!dma->sglist) {
if (!dma->sglist) {
printk(KERN_ERR "dma_region_alloc: kmalloc(sglist) failed\n");
goto err;
}
......@@ -96,7 +96,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
memset(dma->sglist, 0, dma->n_pages * sizeof(struct scatterlist));
/* fill scatter/gather list with pages */
for(i = 0; i < dma->n_pages; i++) {
for (i = 0; i < dma->n_pages; i++) {
unsigned long va = (unsigned long) dma->kvirt + i * PAGE_SIZE;
dma->sglist[i].page = vmalloc_to_page((void *)va);
......@@ -106,7 +106,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
/* map sglist to the IOMMU */
dma->n_dma_pages = pci_map_sg(dev, &dma->sglist[0], dma->n_pages, direction);
if(dma->n_dma_pages == 0) {
if (dma->n_dma_pages == 0) {
printk(KERN_ERR "dma_region_alloc: pci_map_sg() failed\n");
goto err;
}
......@@ -123,18 +123,18 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
void dma_region_free(struct dma_region *dma)
{
if(dma->n_dma_pages) {
if (dma->n_dma_pages) {
pci_unmap_sg(dma->dev, dma->sglist, dma->n_pages, dma->direction);
dma->n_dma_pages = 0;
dma->dev = NULL;
}
if(dma->sglist) {
if (dma->sglist) {
kfree(dma->sglist);
dma->sglist = NULL;
}
if(dma->kvirt) {
if (dma->kvirt) {
vfree(dma->kvirt);
dma->kvirt = NULL;
dma->n_pages = 0;
......@@ -148,8 +148,8 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset,
int i;
unsigned long off = offset;
for(i = 0; i < dma->n_dma_pages; i++) {
if(off < sg_dma_len(&dma->sglist[i])) {
for (i = 0; i < dma->n_dma_pages; i++) {
if (off < sg_dma_len(&dma->sglist[i])) {
*rem = off;
return i;
}
......@@ -173,7 +173,7 @@ void dma_region_sync(struct dma_region *dma, unsigned long offset, unsigned long
int first, last;
unsigned long rem;
if(!len)
if (!len)
len = 1;
first = dma_region_find(dma, offset, &rem);
......@@ -193,10 +193,10 @@ dma_region_pagefault(struct vm_area_struct *area, unsigned long address, int wri
struct dma_region *dma = (struct dma_region*) area->vm_private_data;
if(!dma->kvirt)
if (!dma->kvirt)
goto out;
if( (address < (unsigned long) area->vm_start) ||
if ( (address < (unsigned long) area->vm_start) ||
(address > (unsigned long) area->vm_start + (PAGE_SIZE * dma->n_pages)) )
goto out;
......@@ -216,16 +216,16 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st
{
unsigned long size;
if(!dma->kvirt)
if (!dma->kvirt)
return -EINVAL;
/* must be page-aligned */
if(vma->vm_pgoff != 0)
if (vma->vm_pgoff != 0)
return -EINVAL;
/* check the length */
size = vma->vm_end - vma->vm_start;
if(size > (PAGE_SIZE * dma->n_pages))
if (size > (PAGE_SIZE * dma->n_pages))
return -EINVAL;
vma->vm_ops = &dma_region_vm_ops;
......
......@@ -76,7 +76,7 @@ dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset
/* round up a number of bytes to be a multiple of the PAGE_SIZE */
static inline unsigned long round_up_to_page(unsigned long len)
{
if(len % PAGE_SIZE)
if (len % PAGE_SIZE)
len += PAGE_SIZE - (len % PAGE_SIZE);
return len;
}
......
......@@ -97,7 +97,7 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
omi->q[3] = 0;
/* IT packet header */
omi->q[4] = cpu_to_le32( (0x0 << 16) /* DMA_SPEED_100 */
omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */
| (tag << 14)
| (channel << 8)
| (TCODE_ISO_DATA << 4)
......@@ -129,10 +129,10 @@ static inline void fill_output_last(struct output_last *ol,
u32 temp = 0;
temp |= 1 << 28; /* OUTPUT_LAST */
if(want_timestamp) /* controller will update timestamp at DMA time */
if (want_timestamp) /* controller will update timestamp at DMA time */
temp |= 1 << 27;
if(want_interrupt)
if (want_interrupt)
temp |= 3 << 20;
temp |= 3 << 18; /* must take branch */
......
This diff is collapsed.
......@@ -64,7 +64,7 @@
ioctl(fd, DV1394_INIT, &init);
while(1) {
while (1) {
read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE );
write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE );
}
......@@ -145,7 +145,7 @@
(checks of system call return values omitted for brevity; always
check return values in your code!)
while( frames left ) {
while ( frames left ) {
struct pollfd *pfd = ...;
......@@ -157,15 +157,15 @@
poll(pfd, 1, -1); (or select(); add a timeout if you want)
if(pfd->revents) {
if (pfd->revents) {
struct dv1394_status status;
ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
if(status.dropped_frames > 0) {
if (status.dropped_frames > 0) {
reset_dv1394();
} else {
for(int i = 0; i < status.n_clear_frames; i++) {
for (int i = 0; i < status.n_clear_frames; i++) {
copy_DV_frame();
}
}
......
This diff is collapsed.
......@@ -46,14 +46,14 @@
#define ACKX_TIMEOUT (-4)
#define SPEED_100 0x00
#define SPEED_200 0x01
#define SPEED_400 0x02
#define SPEED_800 0x03
#define SPEED_1600 0x04
#define SPEED_3200 0x05
#define IEEE1394_SPEED_100 0x00
#define IEEE1394_SPEED_200 0x01
#define IEEE1394_SPEED_400 0x02
#define IEEE1394_SPEED_800 0x03
#define IEEE1394_SPEED_1600 0x04
#define IEEE1394_SPEED_3200 0x05
/* The current highest tested speed supported by the subsystem */
#define SPEED_MAX SPEED_800
#define IEEE1394_SPEED_MAX IEEE1394_SPEED_800
/* Maps speed values above to a string representation */
extern const char *hpsb_speedto_str[];
......
......@@ -289,7 +289,7 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
for (i = 0; i < (nodecount * 64); i += 64) {
for (j = 0; j < nodecount; j++) {
map[i+j] = SPEED_MAX;
map[i+j] = IEEE1394_SPEED_MAX;
}
}
......@@ -458,7 +458,7 @@ int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
struct hpsb_packet *packet;
int retval = 0;
if(rootid >= ALL_NODES || rootid < -1 || gapcnt > 0x3f || gapcnt < -1 ||
if (rootid >= ALL_NODES || rootid < -1 || gapcnt > 0x3f || gapcnt < -1 ||
(rootid == -1 && gapcnt == -1)) {
HPSB_DEBUG("Invalid Parameter: rootid = %d gapcnt = %d",
rootid, gapcnt);
......@@ -470,22 +470,21 @@ int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
return -ENOMEM;
packet->host = host;
packet->header_size = 16;
packet->header_size = 8;
packet->data_size = 0;
packet->expect_response = 0;
packet->no_waiter = 0;
packet->type = hpsb_raw;
packet->header[0] = 0;
if(rootid != -1)
if (rootid != -1)
packet->header[0] |= rootid << 24 | 1 << 23;
if(gapcnt != -1)
if (gapcnt != -1)
packet->header[0] |= gapcnt << 16 | 1 << 22;
packet->header[1] = ~packet->header[0];
packet->generation = get_hpsb_generation(host);
HPSB_DEBUG("Sending PHY configuration packet (I hope)...");
if (!hpsb_send_packet(packet)) {
retval = -EINVAL;
goto fail;
......@@ -1030,12 +1029,12 @@ int ieee1394_register_chardev(int blocknum,
{
int retval;
if( (blocknum < 0) || (blocknum > 15) )
if ( (blocknum < 0) || (blocknum > 15) )
return -EINVAL;
write_lock(&ieee1394_chardevs_lock);
if(ieee1394_chardevs[blocknum].file_ops == NULL) {
if (ieee1394_chardevs[blocknum].file_ops == NULL) {
/* grab the minor block */
ieee1394_chardevs[blocknum].file_ops = file_ops;
ieee1394_chardevs[blocknum].module = module;
......@@ -1054,12 +1053,12 @@ int ieee1394_register_chardev(int blocknum,
/* release a block of minor numbers */
void ieee1394_unregister_chardev(int blocknum)
{
if( (blocknum < 0) || (blocknum > 15) )
if ( (blocknum < 0) || (blocknum > 15) )
return;
write_lock(&ieee1394_chardevs_lock);
if(ieee1394_chardevs[blocknum].file_ops) {
if (ieee1394_chardevs[blocknum].file_ops) {
ieee1394_chardevs[blocknum].file_ops = NULL;
ieee1394_chardevs[blocknum].module = NULL;
}
......@@ -1139,7 +1138,7 @@ static int ieee1394_dispatch_open(struct inode *inode, struct file *file)
/* look up the driver */
if(ieee1394_get_chardev(blocknum, &module, &file_ops) == 0)
if (ieee1394_get_chardev(blocknum, &module, &file_ops) == 0)
return -ENODEV;
/* redirect all subsequent requests to the driver's
......
......@@ -34,7 +34,7 @@ struct hpsb_packet {
} __attribute__((packed)) state;
/* These are core internal. */
char tlabel;
signed char tlabel;
char ack_code;
char tcode;
......
......@@ -95,7 +95,7 @@ static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data)
packet->data_size = 0;
packet->expect_response = 0;
packet->type = hpsb_raw; /* No CRC added */
packet->speed_code = SPEED_100; /* Force speed to be 100Mbps */
packet->speed_code = IEEE1394_SPEED_100; /* Force speed to be 100Mbps */
}
static void fill_async_stream_packet(struct hpsb_packet *packet, int length,
......@@ -147,7 +147,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet, int wait)
spin_lock_irqsave(&tp->lock, flags);
packet->tlabel = find_next_zero_bit(tp->pool, 64, tp->next);
if(packet->tlabel > 63)
if (packet->tlabel > 63)
packet->tlabel = find_first_zero_bit(tp->pool, 64);
tp->next = (packet->tlabel + 1) % 64;
/* Should _never_ happen */
......
......@@ -40,7 +40,7 @@ do { \
(_tp)->next = 0; \
(_tp)->allocations = 0; \
sema_init(&(_tp)->count, 63); \
} while(0)
} while (0)
typedef u32 quadlet_t;
......
......@@ -25,7 +25,7 @@ void hpsb_iso_stop(struct hpsb_iso *iso)
void hpsb_iso_shutdown(struct hpsb_iso *iso)
{
if(iso->flags & HPSB_ISO_DRIVER_INIT) {
if (iso->flags & HPSB_ISO_DRIVER_INIT) {
hpsb_iso_stop(iso);
iso->host->driver->isoctl(iso, iso->type == HPSB_ISO_XMIT ?
XMIT_SHUTDOWN : RECV_SHUTDOWN, 0);
......@@ -47,7 +47,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
int dma_direction;
/* make sure driver supports the ISO API */
if(!host->driver->isoctl) {
if (!host->driver->isoctl) {
printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n",
host->driver->name);
return NULL;
......@@ -55,23 +55,23 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
/* sanitize parameters */
if(buf_packets < 2)
if (buf_packets < 2)
buf_packets = 2;
if(irq_interval < 1 || irq_interval > buf_packets / 2)
if (irq_interval < 1 || irq_interval > buf_packets / 2)
irq_interval = buf_packets / 2;
if(channel < -1 || channel >= 64)
if (channel < -1 || channel >= 64)
return NULL;
/* channel = -1 is OK for multi-channel recv but not for xmit */
if(type == HPSB_ISO_XMIT && channel < 0)
if (type == HPSB_ISO_XMIT && channel < 0)
return NULL;
/* allocate and write the struct hpsb_iso */
iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL);
if(!iso)
if (!iso)
return NULL;
iso->infos = (struct hpsb_iso_packet_info *)(iso + 1);
......@@ -90,7 +90,7 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
iso->first_packet = 0;
spin_lock_init(&iso->lock);
if(iso->type == HPSB_ISO_XMIT) {
if (iso->type == HPSB_ISO_XMIT) {
iso->n_ready_packets = iso->buf_packets;
dma_direction = PCI_DMA_TODEVICE;
} else {
......@@ -103,7 +103,7 @@ 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;
......@@ -137,13 +137,13 @@ 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, irq_interval, callback);
if(!iso)
if (!iso)
return NULL;
iso->speed = speed;
/* tell the driver to start working */
if(host->driver->isoctl(iso, XMIT_INIT, 0))
if (host->driver->isoctl(iso, XMIT_INIT, 0))
goto err;
iso->flags |= HPSB_ISO_DRIVER_INIT;
......@@ -164,11 +164,11 @@ 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, irq_interval, callback);
if(!iso)
if (!iso)
return NULL;
/* tell the driver to start working */
if(host->driver->isoctl(iso, RECV_INIT, 0))
if (host->driver->isoctl(iso, RECV_INIT, 0))
goto err;
iso->flags |= HPSB_ISO_DRIVER_INIT;
......@@ -181,21 +181,21 @@ struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel)
{
if(iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)
if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)
return -EINVAL;
return iso->host->driver->isoctl(iso, RECV_LISTEN_CHANNEL, channel);
}
int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel)
{
if(iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)
if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)
return -EINVAL;
return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel);
}
int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
{
if(iso->type != HPSB_ISO_RECV || iso->channel != -1)
if (iso->type != HPSB_ISO_RECV || iso->channel != -1)
return -EINVAL;
return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long) &mask);
}
......@@ -203,7 +203,7 @@ int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
static int do_iso_xmit_start(struct hpsb_iso *iso, int cycle)
{
int retval = iso->host->driver->isoctl(iso, XMIT_START, cycle);
if(retval)
if (retval)
return retval;
iso->flags |= HPSB_ISO_DRIVER_STARTED;
......@@ -212,25 +212,25 @@ static int do_iso_xmit_start(struct hpsb_iso *iso, int cycle)
int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer)
{
if(iso->type != HPSB_ISO_XMIT)
if (iso->type != HPSB_ISO_XMIT)
return -1;
if(iso->flags & HPSB_ISO_DRIVER_STARTED)
if (iso->flags & HPSB_ISO_DRIVER_STARTED)
return 0;
if(cycle < -1)
if (cycle < -1)
cycle = -1;
else if(cycle >= 8000)
else if (cycle >= 8000)
cycle %= 8000;
iso->xmit_cycle = cycle;
if(prebuffer < 0)
if (prebuffer < 0)
prebuffer = iso->buf_packets;
else if(prebuffer == 0)
else if (prebuffer == 0)
prebuffer = 1;
if(prebuffer > iso->buf_packets)
if (prebuffer > iso->buf_packets)
prebuffer = iso->buf_packets;
iso->prebuffer = prebuffer;
......@@ -247,20 +247,20 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
int retval = 0;
int isoctl_args[3];
if(iso->type != HPSB_ISO_RECV)
if (iso->type != HPSB_ISO_RECV)
return -1;
if(iso->flags & HPSB_ISO_DRIVER_STARTED)
if (iso->flags & HPSB_ISO_DRIVER_STARTED)
return 0;
if(cycle < -1)
if (cycle < -1)
cycle = -1;
else if(cycle >= 8000)
else if (cycle >= 8000)
cycle %= 8000;
isoctl_args[0] = cycle;
if(tag_mask < 0)
if (tag_mask < 0)
/* match all tags */
tag_mask = 0xF;
isoctl_args[1] = tag_mask;
......@@ -268,7 +268,7 @@ 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]);
if(retval)
if (retval)
return retval;
iso->flags |= HPSB_ISO_DRIVER_STARTED;
......@@ -282,15 +282,15 @@ 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)
{
if(offset >= iso->buf_size)
if (offset >= iso->buf_size)
return -EFAULT;
/* make sure the packet does not go beyond the end of the buffer */
if(offset + len > iso->buf_size)
if (offset + len > iso->buf_size)
return -EFAULT;
/* check for wrap-around */
if(offset + len < offset)
if (offset + len < offset)
return -EFAULT;
/* now we can trust 'offset' and 'length' */
......@@ -307,18 +307,18 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
unsigned long flags;
int rv;
if(iso->type != HPSB_ISO_XMIT)
if (iso->type != HPSB_ISO_XMIT)
return -EINVAL;
/* is there space in the buffer? */
if(iso->n_ready_packets <= 0) {
if (iso->n_ready_packets <= 0) {
return -EBUSY;
}
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;
......@@ -327,7 +327,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
spin_lock_irqsave(&iso->lock, flags);
rv = iso->host->driver->isoctl(iso, XMIT_QUEUE, (unsigned long) info);
if(rv)
if (rv)
goto out;
/* increment cursors */
......@@ -335,9 +335,9 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
iso->xmit_cycle = (iso->xmit_cycle+1) % 8000;
iso->n_ready_packets--;
if(iso->prebuffer != 0) {
if (iso->prebuffer != 0) {
iso->prebuffer--;
if(iso->prebuffer <= 0) {
if (iso->prebuffer <= 0) {
iso->prebuffer = 0;
rv = do_iso_xmit_start(iso, iso->start_cycle);
}
......@@ -350,7 +350,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
int hpsb_iso_xmit_sync(struct hpsb_iso *iso)
{
if(iso->type != HPSB_ISO_XMIT)
if (iso->type != HPSB_ISO_XMIT)
return -EINVAL;
return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets);
......@@ -371,7 +371,7 @@ void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error)
iso->n_ready_packets++;
iso->pkt_dma = (iso->pkt_dma + 1) % iso->buf_packets;
if(iso->n_ready_packets == iso->buf_packets || error != 0) {
if (iso->n_ready_packets == iso->buf_packets || error != 0) {
/* the buffer has run empty! */
atomic_inc(&iso->overflows);
}
......@@ -385,7 +385,7 @@ void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
unsigned long flags;
spin_lock_irqsave(&iso->lock, flags);
if(iso->n_ready_packets == iso->buf_packets) {
if (iso->n_ready_packets == iso->buf_packets) {
/* overflow! */
atomic_inc(&iso->overflows);
} else {
......@@ -410,14 +410,14 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets)
unsigned int i;
int rv = 0;
if(iso->type != HPSB_ISO_RECV)
if (iso->type != HPSB_ISO_RECV)
return -1;
spin_lock_irqsave(&iso->lock, flags);
for(i = 0; i < n_packets; i++) {
for (i = 0; i < n_packets; i++) {
rv = iso->host->driver->isoctl(iso, RECV_RELEASE,
(unsigned long) &iso->infos[iso->first_packet]);
if(rv)
if (rv)
break;
iso->first_packet = (iso->first_packet+1) % iso->buf_packets;
......@@ -431,6 +431,6 @@ void hpsb_iso_wake(struct hpsb_iso *iso)
{
wake_up_interruptible(&iso->waitq);
if(iso->callback)
if (iso->callback)
iso->callback(iso);
}
......@@ -66,7 +66,7 @@ struct hpsb_iso {
/* wait for buffer space */
wait_queue_head_t waitq;
int speed; /* SPEED_100, 200, or 400 */
int speed; /* IEEE1394_SPEED_100, 200, or 400 */
int channel; /* -1 if multichannel */
/* greatest # of packets between interrupts - controls
......
......@@ -1167,7 +1167,7 @@ do { \
return -ENOMEM; \
++length; \
scratch = buffer + length; \
} while(0)
} while (0)
PUT_ENVP("VENDOR_ID=%06x", ud->vendor_id);
PUT_ENVP("MODEL_ID=%06x", ud->model_id);
......@@ -1547,12 +1547,12 @@ static void nodemgr_do_irm_duties(struct hpsb_host *host)
/* If there is no bus manager then we should set the root node's
* force_root bit to promote bus stability per the 1394
* spec. (8.4.2.6) */
if (host->busmgr_id == 0x3f && host->node_count > 1)
if (host->busmgr_id == 0xffff && host->node_count > 1)
{
u16 root_node = host->node_count - 1;
struct node_entry *ne = hpsb_nodeid_get_entry(host, root_node);
struct node_entry *ne = find_entry_by_nodeid(host, root_node | LOCAL_BUS);
if (ne->busopt.cmc)
if (ne && ne->busopt.cmc)
hpsb_send_phy_config(host, root_node, -1);
else {
HPSB_DEBUG("The root node is not cycle master capable; "
......
This diff is collapsed.
......@@ -601,7 +601,7 @@ static void handle_iso_listen(struct file_info *fi, struct pending_request *req)
if (fi->listen_channels & (1ULL << channel)) {
req->req.error = RAW1394_ERROR_ALREADY;
} else {
if(hpsb_listen_channel(&raw1394_highlevel, fi->host, channel)) {
if (hpsb_listen_channel(&raw1394_highlevel, fi->host, channel)) {
req->req.error = RAW1394_ERROR_ALREADY;
} else {
fi->listen_channels |= 1ULL << channel;
......@@ -2008,7 +2008,7 @@ static inline int __rawiso_event_in_queue(struct file_info *fi)
list_for_each(lh, &fi->req_complete) {
req = list_entry(lh, struct pending_request, list);
if(req->req.type == RAW1394_REQ_RAWISO_ACTIVITY) {
if (req->req.type == RAW1394_REQ_RAWISO_ACTIVITY) {
return 1;
}
}
......@@ -2024,17 +2024,17 @@ static void queue_rawiso_event(struct file_info *fi)
spin_lock_irqsave(&fi->reqlists_lock, flags);
/* only one ISO activity event may be in the queue */
if(!__rawiso_event_in_queue(fi)) {
if (!__rawiso_event_in_queue(fi)) {
struct pending_request *req = __alloc_pending_request(SLAB_ATOMIC);
if(req) {
if (req) {
req->file_info = fi;
req->req.type = RAW1394_REQ_RAWISO_ACTIVITY;
req->req.generation = get_hpsb_generation(fi->host);
__queue_complete_req(req);
} else {
/* on allocation failure, signal an overflow */
if(fi->iso_handle) {
if (fi->iso_handle) {
atomic_inc(&fi->iso_handle->overflows);
}
}
......@@ -2054,7 +2054,7 @@ static void rawiso_activity_cb(struct hpsb_iso *iso)
if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) {
struct file_info *fi = list_entry(lh, struct file_info, list);
if(fi->iso_handle == iso)
if (fi->iso_handle == iso)
queue_rawiso_event(fi);
}
}
......@@ -2079,7 +2079,7 @@ static int raw1394_iso_xmit_init(struct file_info *fi, void *uaddr)
{
struct raw1394_iso_status stat;
if(copy_from_user(&stat, uaddr, sizeof(stat)))
if (copy_from_user(&stat, uaddr, sizeof(stat)))
return -EFAULT;
fi->iso_handle = hpsb_iso_xmit_init(fi->host,
......@@ -2089,13 +2089,13 @@ static int raw1394_iso_xmit_init(struct file_info *fi, void *uaddr)
stat.config.speed,
stat.config.irq_interval,
rawiso_activity_cb);
if(!fi->iso_handle)
if (!fi->iso_handle)
return -ENOMEM;
fi->iso_state = RAW1394_ISO_XMIT;
raw1394_iso_fill_status(fi->iso_handle, &stat);
if(copy_to_user(uaddr, &stat, sizeof(stat)))
if (copy_to_user(uaddr, &stat, sizeof(stat)))
return -EFAULT;
/* queue an event to get things started */
......@@ -2108,7 +2108,7 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
{
struct raw1394_iso_status stat;
if(copy_from_user(&stat, uaddr, sizeof(stat)))
if (copy_from_user(&stat, uaddr, sizeof(stat)))
return -EFAULT;
fi->iso_handle = hpsb_iso_recv_init(fi->host,
......@@ -2117,13 +2117,13 @@ static int raw1394_iso_recv_init(struct file_info *fi, void *uaddr)
stat.config.channel,
stat.config.irq_interval,
rawiso_activity_cb);
if(!fi->iso_handle)
if (!fi->iso_handle)
return -ENOMEM;
fi->iso_state = RAW1394_ISO_RECV;
raw1394_iso_fill_status(fi->iso_handle, &stat);
if(copy_to_user(uaddr, &stat, sizeof(stat)))
if (copy_to_user(uaddr, &stat, sizeof(stat)))
return -EFAULT;
return 0;
}
......@@ -2134,7 +2134,7 @@ static int raw1394_iso_get_status(struct file_info *fi, void *uaddr)
struct hpsb_iso *iso = fi->iso_handle;
raw1394_iso_fill_status(fi->iso_handle, &stat);
if(copy_to_user(uaddr, &stat, sizeof(stat)))
if (copy_to_user(uaddr, &stat, sizeof(stat)))
return -EFAULT;
/* reset overflow counter */
......@@ -2150,20 +2150,20 @@ static int raw1394_iso_recv_packets(struct file_info *fi, void *uaddr)
unsigned int packet = fi->iso_handle->first_packet;
int i;
if(copy_from_user(&upackets, uaddr, sizeof(upackets)))
if (copy_from_user(&upackets, uaddr, sizeof(upackets)))
return -EFAULT;
if(upackets.n_packets > hpsb_iso_n_ready(fi->iso_handle))
if (upackets.n_packets > hpsb_iso_n_ready(fi->iso_handle))
return -EINVAL;
/* ensure user-supplied buffer is accessible and big enough */
if(verify_area(VERIFY_WRITE, upackets.infos,
if (verify_area(VERIFY_WRITE, upackets.infos,
upackets.n_packets * sizeof(struct raw1394_iso_packet_info)))
return -EFAULT;
/* copy the packet_infos out */
for(i = 0; i < upackets.n_packets; i++) {
if(__copy_to_user(&upackets.infos[i],
for (i = 0; i < upackets.n_packets; i++) {
if (__copy_to_user(&upackets.infos[i],
&fi->iso_handle->infos[packet],
sizeof(struct raw1394_iso_packet_info)))
return -EFAULT;
......@@ -2180,28 +2180,28 @@ static int raw1394_iso_send_packets(struct file_info *fi, void *uaddr)
struct raw1394_iso_packets upackets;
int i, rv;
if(copy_from_user(&upackets, uaddr, sizeof(upackets)))
if (copy_from_user(&upackets, uaddr, sizeof(upackets)))
return -EFAULT;
if(upackets.n_packets > hpsb_iso_n_ready(fi->iso_handle))
if (upackets.n_packets > hpsb_iso_n_ready(fi->iso_handle))
return -EINVAL;
/* ensure user-supplied buffer is accessible and big enough */
if(verify_area(VERIFY_READ, upackets.infos,
if (verify_area(VERIFY_READ, upackets.infos,
upackets.n_packets * sizeof(struct raw1394_iso_packet_info)))
return -EFAULT;
/* copy the infos structs in and queue the packets */
for(i = 0; i < upackets.n_packets; i++) {
for (i = 0; i < upackets.n_packets; i++) {
struct raw1394_iso_packet_info info;
if(__copy_from_user(&info, &upackets.infos[i],
if (__copy_from_user(&info, &upackets.infos[i],
sizeof(struct raw1394_iso_packet_info)))
return -EFAULT;
rv = hpsb_iso_xmit_queue_packet(fi->iso_handle, info.offset,
info.len, info.tag, info.sy);
if(rv)
if (rv)
return rv;
}
......@@ -2210,7 +2210,7 @@ static int raw1394_iso_send_packets(struct file_info *fi, void *uaddr)
static void raw1394_iso_shutdown(struct file_info *fi)
{
if(fi->iso_handle)
if (fi->iso_handle)
hpsb_iso_shutdown(fi->iso_handle);
fi->iso_handle = NULL;
......@@ -2222,7 +2222,7 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
{
struct file_info *fi = file->private_data;
if(fi->iso_state == RAW1394_ISO_INACTIVE)
if (fi->iso_state == RAW1394_ISO_INACTIVE)
return -EINVAL;
return dma_region_mmap(&fi->iso_handle->data_buf, file, vma);
......@@ -2249,7 +2249,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
case RAW1394_IOC_ISO_RECV_START: {
/* copy args from user-space */
int args[3];
if(copy_from_user(&args[0], (void*) arg, sizeof(args)))
if (copy_from_user(&args[0], (void*) arg, sizeof(args)))
return -EFAULT;
return hpsb_iso_recv_start(fi->iso_handle, args[0], args[1], args[2]);
}
......@@ -2263,7 +2263,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
case RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK: {
/* copy the u64 from user-space */
u64 mask;
if(copy_from_user(&mask, (void*) arg, sizeof(mask)))
if (copy_from_user(&mask, (void*) arg, sizeof(mask)))
return -EFAULT;
return hpsb_iso_recv_set_channel_mask(fi->iso_handle, mask);
}
......@@ -2286,7 +2286,7 @@ static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cm
case RAW1394_IOC_ISO_XMIT_START: {
/* copy two ints from user-space */
int args[2];
if(copy_from_user(&args[0], (void*) arg, sizeof(args)))
if (copy_from_user(&args[0], (void*) arg, sizeof(args)))
return -EFAULT;
return hpsb_iso_xmit_start(fi->iso_handle, args[0], args[1]);
}
......@@ -2374,7 +2374,7 @@ static int raw1394_release(struct inode *inode, struct file *file)
struct arm_addr *arm_addr = NULL;
int another_host;
if(fi->iso_state != RAW1394_ISO_INACTIVE)
if (fi->iso_state != RAW1394_ISO_INACTIVE)
raw1394_iso_shutdown(fi);
for (i = 0; i < 64; i++) {
......
......@@ -79,7 +79,7 @@
#include "sbp2.h"
static char version[] __devinitdata =
"$Rev: 942 $ Ben Collins <bcollins@debian.org>";
"$Rev: 967 $ Ben Collins <bcollins@debian.org>";
/*
* Module load parameter definitions
......@@ -93,7 +93,7 @@ static char version[] __devinitdata =
* (probably due to PCI latency/throughput issues with the part). You can
* bump down the speed if you are running into problems.
*/
static int max_speed = SPEED_MAX;
static int max_speed = IEEE1394_SPEED_MAX;
module_param(max_speed, int, 0644);
MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb default, 1 = 200mb, 0 = 100mb)");
......@@ -780,8 +780,8 @@ static int sbp2_start_ud(struct sbp2scsi_host_info *hi, struct unit_directory *u
scsi_id->ne = ud->ne;
scsi_id->hi = hi;
scsi_id->speed_code = SPEED_100;
scsi_id->max_payload_size = sbp2_speedto_max_payload[SPEED_100];
scsi_id->speed_code = IEEE1394_SPEED_100;
scsi_id->max_payload_size = sbp2_speedto_max_payload[IEEE1394_SPEED_100];
atomic_set(&scsi_id->sbp2_login_complete, 0);
INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse);
INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed);
......
......@@ -589,7 +589,7 @@ static void initialize_dma_it_prg(struct dma_iso_ctx *d, int n, int sync_tag)
it_prg[i].begin.status = 0;
it_prg[i].data[0] = cpu_to_le32(
(SPEED_100 << 16)
(IEEE1394_SPEED_100 << 16)
| (/* tag */ 1 << 14)
| (d->channel << 8)
| (TCODE_ISO_DATA << 4));
......@@ -705,7 +705,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct dma_iso_ctx *d;
int i;
if(copy_from_user(&v, (void *)arg, sizeof(v)))
if (copy_from_user(&v, (void *)arg, sizeof(v)))
return -EFAULT;
/* if channel < 0, find lowest available one */
......@@ -802,7 +802,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
v.channel);
}
if(copy_to_user((void *)arg, &v, sizeof(v)))
if (copy_to_user((void *)arg, &v, sizeof(v)))
return -EFAULT;
return 0;
......@@ -814,7 +814,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
u64 mask;
struct dma_iso_ctx *d;
if(copy_from_user(&channel, (void *)arg, sizeof(int)))
if (copy_from_user(&channel, (void *)arg, sizeof(int)))
return -EFAULT;
if (channel<0 || channel>(ISO_CHANNELS-1)) {
......@@ -849,7 +849,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct video1394_wait v;
struct dma_iso_ctx *d;
if(copy_from_user(&v, (void *)arg, sizeof(v)))
if (copy_from_user(&v, (void *)arg, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
......@@ -911,7 +911,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct dma_iso_ctx *d;
int i;
if(copy_from_user(&v, (void *)arg, sizeof(v)))
if (copy_from_user(&v, (void *)arg, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
......@@ -939,12 +939,12 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
}
#if 1
while(d->buffer_status[v.buffer]!=
while (d->buffer_status[v.buffer]!=
VIDEO1394_BUFFER_READY) {
spin_unlock_irqrestore(&d->lock, flags);
interruptible_sleep_on(&d->waitq);
spin_lock_irqsave(&d->lock, flags);
if(signal_pending(current)) {
if (signal_pending(current)) {
spin_unlock_irqrestore(&d->lock,flags);
return -EINTR;
}
......@@ -981,7 +981,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
spin_unlock_irqrestore(&d->lock, flags);
v.buffer=i;
if(copy_to_user((void *)arg, &v, sizeof(v)))
if (copy_to_user((void *)arg, &v, sizeof(v)))
return -EFAULT;
return 0;
......@@ -994,7 +994,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
qv.packet_sizes = NULL;
if(copy_from_user(&v, (void *)arg, sizeof(v)))
if (copy_from_user(&v, (void *)arg, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel);
......@@ -1097,7 +1097,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
struct video1394_wait v;
struct dma_iso_ctx *d;
if(copy_from_user(&v, (void *)arg, sizeof(v)))
if (copy_from_user(&v, (void *)arg, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel);
......@@ -1114,10 +1114,10 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
return 0;
case VIDEO1394_BUFFER_QUEUED:
#if 1
while(d->buffer_status[v.buffer]!=
while (d->buffer_status[v.buffer]!=
VIDEO1394_BUFFER_READY) {
interruptible_sleep_on(&d->waitq);
if(signal_pending(current)) return -EINTR;
if (signal_pending(current)) return -EINTR;
}
#else
if (wait_event_interruptible(d->waitq,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment