switch (opcode) {
case XILLYMSG_OPCODE_RELEASEBUF:
-
if ((msg_channel > ep->num_channels) ||
(msg_channel == 0)) {
malformed_message(ep, &buf[i]);
this_buffer = devm_kcalloc(dev, bufnum,
sizeof(struct xilly_buffer),
GFP_KERNEL);
-
if (!this_buffer)
return -ENOMEM;
}
dev,
GFP_KERNEL | __GFP_DMA32 | __GFP_ZERO,
allocorder);
-
if (!s->salami)
return -ENOMEM;
+
s->left_of_salami = allocsize;
}
rc = ep->ephw->map_single(ep, s->salami,
bytebufsize, s->direction,
&dma_addr);
-
if (rc)
return rc;
channel = devm_kcalloc(dev, ep->num_channels,
sizeof(struct xilly_channel), GFP_KERNEL);
-
if (!channel)
return -ENOMEM;
ep->channels = devm_kcalloc(dev, ep->num_channels + 1,
sizeof(struct xilly_channel *),
GFP_KERNEL);
-
if (!ep->channels)
return -ENOMEM;
buffers = devm_kcalloc(dev, bufnum,
sizeof(struct xilly_buffer *),
GFP_KERNEL);
-
if (!buffers)
return -ENOMEM;
} else {
if (channel->wr_synchronous ||
(offsetlimit < (buf_elements - 1))) {
-
mutex_lock(&channel->endpoint->register_mutex);
iowrite32(offsetlimit,
mutex_unlock(&channel->endpoint->
register_mutex);
}
-
}
/*
if (!channel->wr_allow_partial ||
(no_time_left && (bytes_done == 0))) {
-
/*
* This do-loop will run more than once if another
* thread reasserted wr_sleepy before we got the mutex
if (timeout < 0)
goto done; /* Autoflush */
-
/*
* bufidx is now the last buffer written to (or equal to
* rd_fpga_buf_idx if buffer was never written to), and
int rc;
rc = xillybus_myflush(channel, -1);
-
if (rc == -EINTR)
dev_warn(channel->endpoint->dev,
"Autoflush failed because work queue thread got a signal.\n");
channel = endpoint->channels[1 + minor - endpoint->lowest_minor];
filp->private_data = channel;
-
/*
* It gets complicated because:
* 1. We don't want to take a mutex we don't have to
goto unlock;
}
-
if (filp->f_mode & FMODE_READ) {
if (channel->wr_ref_count == 0) { /* First open of file */
/* Move the host to first buffer */
channel->rd_ref_count--;
if (channel->rd_ref_count == 0) {
-
/*
* We rely on the kernel calling flush()
* before we get here.
channel->wr_ref_count--;
if (channel->wr_ref_count == 0) {
-
iowrite32(1 | (channel->chan_num << 1) |
(5 << 24), /* Opcode 5, close channel */
channel->endpoint->registers +
return 0;
}
+
static loff_t xillybus_llseek(struct file *filp, loff_t offset, int whence)
{
struct xilly_channel *channel = filp->private_data;
endpoint->num_channels);
}
-
struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev,
struct device *dev,
struct xilly_endpoint_hardware
endpoint->num_channels = 1;
rc = xilly_setupchannels(endpoint, bogus_idt, 2);
-
if (rc)
goto failed_idt;
rc = xilly_obtain_idt(endpoint);
-
if (rc)
goto failed_idt;
rc = xilly_setupchannels(endpoint,
idt_handle.chandesc,
idt_handle.entries);
-
if (rc)
goto failed_idt;
mutex_unlock(&ep_list_lock);
rc = xillybus_init_chrdev(endpoint, idt_handle.idt);
-
if (rc)
goto failed_chrdevs;