Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150888
b: refs/heads/master
c: 3ee40c3
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jun 12, 2009
1 parent 6498cd3 commit 3e4bd88
Show file tree
Hide file tree
Showing 35 changed files with 522 additions and 280 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98eb0f53e2fc66482e2ea8033c58b20a079e5260
refs/heads/master: 3ee40c376ad3252d13946141588db7e2f435f958
90 changes: 19 additions & 71 deletions trunk/drivers/bluetooth/hci_vhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>

#define VERSION "1.2"
#define VERSION "1.3"

static int minor = MISC_DYNAMIC_MINOR;

Expand All @@ -51,14 +51,8 @@ struct vhci_data {

wait_queue_head_t read_wait;
struct sk_buff_head readq;

struct fasync_struct *fasync;
};

#define VHCI_FASYNC 0x0010

static struct miscdevice vhci_miscdev;

static int vhci_open_dev(struct hci_dev *hdev)
{
set_bit(HCI_RUNNING, &hdev->flags);
Expand Down Expand Up @@ -105,9 +99,6 @@ static int vhci_send_frame(struct sk_buff *skb)
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
skb_queue_tail(&data->readq, skb);

if (data->flags & VHCI_FASYNC)
kill_fasync(&data->fasync, SIGIO, POLL_IN);

wake_up_interruptible(&data->read_wait);

return 0;
Expand Down Expand Up @@ -179,41 +170,31 @@ static inline ssize_t vhci_put_user(struct vhci_data *data,
static ssize_t vhci_read(struct file *file,
char __user *buf, size_t count, loff_t *pos)
{
DECLARE_WAITQUEUE(wait, current);
struct vhci_data *data = file->private_data;
struct sk_buff *skb;
ssize_t ret = 0;

add_wait_queue(&data->read_wait, &wait);
while (count) {
set_current_state(TASK_INTERRUPTIBLE);

skb = skb_dequeue(&data->readq);
if (!skb) {
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}

if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}

schedule();
continue;
if (skb) {
ret = vhci_put_user(data, skb, buf, count);
if (ret < 0)
skb_queue_head(&data->readq, skb);
else
kfree_skb(skb);
break;
}

if (access_ok(VERIFY_WRITE, buf, count))
ret = vhci_put_user(data, skb, buf, count);
else
ret = -EFAULT;
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}

kfree_skb(skb);
break;
ret = wait_event_interruptible(data->read_wait,
!skb_queue_empty(&data->readq));
if (ret < 0)
break;
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&data->read_wait, &wait);

return ret;
}
Expand All @@ -223,9 +204,6 @@ static ssize_t vhci_write(struct file *file,
{
struct vhci_data *data = file->private_data;

if (!access_ok(VERIFY_READ, buf, count))
return -EFAULT;

return vhci_get_user(data, buf, count);
}

Expand Down Expand Up @@ -259,11 +237,9 @@ static int vhci_open(struct inode *inode, struct file *file)
skb_queue_head_init(&data->readq);
init_waitqueue_head(&data->read_wait);

lock_kernel();
hdev = hci_alloc_dev();
if (!hdev) {
kfree(data);
unlock_kernel();
return -ENOMEM;
}

Expand All @@ -284,12 +260,10 @@ static int vhci_open(struct inode *inode, struct file *file)
BT_ERR("Can't register HCI device");
kfree(data);
hci_free_dev(hdev);
unlock_kernel();
return -EBUSY;
}

file->private_data = data;
unlock_kernel();

return nonseekable_open(inode, file);
}
Expand All @@ -310,48 +284,25 @@ static int vhci_release(struct inode *inode, struct file *file)
return 0;
}

static int vhci_fasync(int fd, struct file *file, int on)
{
struct vhci_data *data = file->private_data;
int err = 0;

lock_kernel();
err = fasync_helper(fd, file, on, &data->fasync);
if (err < 0)
goto out;

if (on)
data->flags |= VHCI_FASYNC;
else
data->flags &= ~VHCI_FASYNC;

out:
unlock_kernel();
return err;
}

static const struct file_operations vhci_fops = {
.owner = THIS_MODULE,
.read = vhci_read,
.write = vhci_write,
.poll = vhci_poll,
.ioctl = vhci_ioctl,
.open = vhci_open,
.release = vhci_release,
.fasync = vhci_fasync,
};

static struct miscdevice vhci_miscdev= {
.name = "vhci",
.fops = &vhci_fops,
.name = "vhci",
.fops = &vhci_fops,
.minor = MISC_DYNAMIC_MINOR,
};

static int __init vhci_init(void)
{
BT_INFO("Virtual HCI driver ver %s", VERSION);

vhci_miscdev.minor = minor;

if (misc_register(&vhci_miscdev) < 0) {
BT_ERR("Can't register misc device with minor %d", minor);
return -EIO;
Expand All @@ -369,9 +320,6 @@ static void __exit vhci_exit(void)
module_init(vhci_init);
module_exit(vhci_exit);

module_param(minor, int, 0444);
MODULE_PARM_DESC(minor, "Miscellaneous minor device number");

MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
MODULE_VERSION(VERSION);
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/isdn/hardware/mISDN/hfcpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1806,10 +1806,9 @@ init_card(struct hfc_pci *hc)
printk(KERN_WARNING
"HFC PCI: IRQ(%d) getting no interrupts "
"during init %d\n", hc->irq, 4 - cnt);
if (cnt == 1) {
spin_unlock_irqrestore(&hc->lock, flags);
return -EIO;
} else {
if (cnt == 1)
break;
else {
reset_hfcpci(hc);
cnt--;
}
Expand Down
41 changes: 30 additions & 11 deletions trunk/drivers/isdn/hisax/hfc_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ release_io_hfcpci(struct IsdnCardState *cs)
Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
del_timer(&cs->hw.hfcpci.timer);
kfree(cs->hw.hfcpci.share_start);
cs->hw.hfcpci.share_start = NULL;
pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
cs->hw.hfcpci.fifos = NULL;
iounmap((void *)cs->hw.hfcpci.pci_io);
}

Expand Down Expand Up @@ -1663,8 +1664,19 @@ setup_hfcpci(struct IsdnCard *card)
dev_hfcpci);
i++;
if (tmp_hfcpci) {
dma_addr_t dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
if (pci_enable_device(tmp_hfcpci))
continue;
if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
printk(KERN_WARNING
"HiSax hfc_pci: No suitable DMA available.\n");
continue;
}
if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
printk(KERN_WARNING
"HiSax hfc_pci: No suitable consistent DMA available.\n");
continue;
}
pci_set_master(tmp_hfcpci);
if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
continue;
Expand Down Expand Up @@ -1693,22 +1705,29 @@ setup_hfcpci(struct IsdnCard *card)
printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
return (0);
}

/* Allocate memory for FIFOS */
/* Because the HFC-PCI needs a 32K physical alignment, we */
/* need to allocate the double mem and align the address */
if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
0x8000, &cs->hw.hfcpci.dma);
if (!cs->hw.hfcpci.fifos) {
printk(KERN_WARNING "HFC-PCI: Error allocating FIFO memory!\n");
return 0;
}
if (cs->hw.hfcpci.dma & 0x7fff) {
printk(KERN_WARNING
"HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
(u_long)cs->hw.hfcpci.dma);
pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
return 0;
}
cs->hw.hfcpci.fifos = (void *)
(((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
printk(KERN_INFO
"HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n",
"HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
cs->hw.hfcpci.pci_io,
cs->hw.hfcpci.fifos,
(u_int) virt_to_bus(cs->hw.hfcpci.fifos),
(u_long)cs->hw.hfcpci.dma,
cs->irq, HZ);

spin_lock_irqsave(&cs->lock, flags);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/hisax/hisax.h
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ struct hfcPCI_hw {
int nt_timer;
struct pci_dev *dev;
unsigned char *pci_io; /* start of PCI IO memory */
void *share_start; /* shared memory for Fifos start */
dma_addr_t dma; /* dma handle for Fifos */
void *fifos; /* FIFO memory */
int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
struct timer_list timer;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/i4l/isdn_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
int retval, line;

line = tty->index;
if (line < 0 || line > ISDN_MAX_CHANNELS)
if (line < 0 || line >= ISDN_MAX_CHANNELS)
return -ENODEV;
info = &dev->mdm.info[line];
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open"))
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/isdn/mISDN/dsp_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,19 @@ static ssize_t
attr_show_args(struct device *dev, struct device_attribute *attr, char *buf)
{
struct mISDN_dsp_element *elem = dev_get_drvdata(dev);
ssize_t len = 0;
int i = 0;
int i;
char *p = buf;

*buf = 0;
for (; i < elem->num_args; ++i)
len = sprintf(buf, "%sName: %s\n%s%s%sDescription: %s\n"
"\n", buf,
for (i = 0; i < elem->num_args; i++)
p += sprintf(p, "Name: %s\n%s%s%sDescription: %s\n\n",
elem->args[i].name,
elem->args[i].def ? "Default: " : "",
elem->args[i].def ? elem->args[i].def : "",
elem->args[i].def ? "\n" : "",
elem->args[i].desc);

return len;
return p - buf;
}

static struct device_attribute element_attributes[] = {
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/isdn/mISDN/tei.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,7 @@ static int
ph_data_ind(struct manager *mgr, struct sk_buff *skb)
{
int ret = -EINVAL;
struct layer2 *l2;
u_long flags;
struct layer2 *l2, *nl2;
u_char mt;

if (skb->len < 8) {
Expand Down Expand Up @@ -908,11 +907,9 @@ ph_data_ind(struct manager *mgr, struct sk_buff *skb)
new_tei_req(mgr, &skb->data[4]);
goto done;
}
read_lock_irqsave(&mgr->lock, flags);
list_for_each_entry(l2, &mgr->layer2, list) {
list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) {
tei_ph_data_ind(l2->tm, mt, &skb->data[4], skb->len - 4);
}
read_unlock_irqrestore(&mgr->lock, flags);
done:
return ret;
}
Expand Down
Loading

0 comments on commit 3e4bd88

Please sign in to comment.