static int open_file_generic(struct inode *inode, struct file *file)
{
- file->private_data = inode->i_private;
+ file->private_data = inode->u.generic_ip;
return 0;
}
down(&big_buffer_sem);
- mutex_lock(&bcm->mutex);
- spin_lock_irqsave(&bcm->irq_lock, flags);
- if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
+ bcm43xx_lock_mmio(bcm, flags);
+ if (!bcm->initialized) {
fappend("Board not initialized.\n");
goto out;
}
fappend("subsystem_vendor: 0x%04x subsystem_device: 0x%04x\n",
pci_dev->subsystem_vendor, pci_dev->subsystem_device);
fappend("IRQ: %d\n", bcm->irq);
- fappend("mmio_addr: 0x%p\n", bcm->mmio_addr);
+ fappend("mmio_addr: 0x%p mmio_len: %u\n", bcm->mmio_addr, bcm->mmio_len);
fappend("chip_id: 0x%04x chip_rev: 0x%02x\n", bcm->chip_id, bcm->chip_rev);
if ((bcm->core_80211[0].rev >= 3) && (bcm43xx_read32(bcm, 0x0158) & (1 << 16)))
fappend("Radio disabled by hardware!\n");
fappend("\n");
out:
- spin_unlock_irqrestore(&bcm->irq_lock, flags);
- mutex_unlock(&bcm->mutex);
+ bcm43xx_unlock_mmio(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem);
return res;
unsigned long flags;
down(&big_buffer_sem);
- mutex_lock(&bcm->mutex);
- spin_lock_irqsave(&bcm->irq_lock, flags);
- if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
+ bcm43xx_lock_mmio(bcm, flags);
+ if (!bcm->initialized) {
fappend("Board not initialized.\n");
goto out;
}
fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags);
out:
- spin_unlock_irqrestore(&bcm->irq_lock, flags);
- mutex_unlock(&bcm->mutex);
+ bcm43xx_unlock_mmio(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem);
return res;
u64 tsf;
down(&big_buffer_sem);
- mutex_lock(&bcm->mutex);
- spin_lock_irqsave(&bcm->irq_lock, flags);
- if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
+ bcm43xx_lock_mmio(bcm, flags);
+ if (!bcm->initialized) {
fappend("Board not initialized.\n");
goto out;
}
(unsigned int)(tsf & 0xFFFFFFFFULL));
out:
- spin_unlock_irqrestore(&bcm->irq_lock, flags);
- mutex_unlock(&bcm->mutex);
+ bcm43xx_unlock_mmio(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem);
return res;
res = -EFAULT;
goto out_up;
}
- mutex_lock(&bcm->mutex);
- spin_lock_irqsave(&bcm->irq_lock, flags);
- if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
+ bcm43xx_lock_mmio(bcm, flags);
+ if (!bcm->initialized) {
printk(KERN_INFO PFX "debugfs: Board not initialized.\n");
res = -EFAULT;
goto out_unlock;
goto out_unlock;
}
bcm43xx_tsf_write(bcm, tsf);
- mmiowb();
res = buf_size;
out_unlock:
- spin_unlock_irqrestore(&bcm->irq_lock, flags);
- mutex_unlock(&bcm->mutex);
+ bcm43xx_unlock_mmio(bcm, flags);
out_up:
up(&big_buffer_sem);
return res;
int i, cnt, j = 0;
down(&big_buffer_sem);
- mutex_lock(&bcm->mutex);
- spin_lock_irqsave(&bcm->irq_lock, flags);
+ bcm43xx_lock(bcm, flags);
fappend("Last %d logged xmitstatus blobs (Latest first):\n\n",
BCM43xx_NR_LOGGED_XMITSTATUS);
i = BCM43xx_NR_LOGGED_XMITSTATUS - 1;
}
- spin_unlock_irqrestore(&bcm->irq_lock, flags);
+ bcm43xx_unlock(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
- spin_lock_irqsave(&bcm->irq_lock, flags);
+ bcm43xx_lock(bcm, flags);
if (*ppos == pos) {
/* Done. Drop the copied data. */
e->xmitstatus_printing = 0;
}
- spin_unlock_irqrestore(&bcm->irq_lock, flags);
- mutex_unlock(&bcm->mutex);
- up(&big_buffer_sem);
- return res;
-}
-
-static ssize_t restart_write_file(struct file *file, const char __user *user_buf,
- size_t count, loff_t *ppos)
-{
- struct bcm43xx_private *bcm = file->private_data;
- char *buf = really_big_buffer;
- ssize_t buf_size;
- ssize_t res;
- unsigned long flags;
-
- buf_size = min(count, sizeof (really_big_buffer) - 1);
- down(&big_buffer_sem);
- if (copy_from_user(buf, user_buf, buf_size)) {
- res = -EFAULT;
- goto out_up;
- }
- mutex_lock(&(bcm)->mutex);
- spin_lock_irqsave(&(bcm)->irq_lock, flags);
- if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
- printk(KERN_INFO PFX "debugfs: Board not initialized.\n");
- res = -EFAULT;
- goto out_unlock;
- }
- if (count > 0 && buf[0] == '1') {
- bcm43xx_controller_restart(bcm, "manually restarted");
- res = count;
- } else
- res = -EINVAL;
-
-out_unlock:
- spin_unlock_irqrestore(&(bcm)->irq_lock, flags);
- mutex_unlock(&(bcm)->mutex);
-out_up:
+ bcm43xx_unlock(bcm, flags);
up(&big_buffer_sem);
return res;
}
.open = open_file_generic,
};
-static struct file_operations restart_fops = {
- .write = restart_write_file,
- .open = open_file_generic,
-};
-
void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm)
{
bcm, &txstat_fops);
if (!e->dentry_txstat)
printk(KERN_ERR PFX "debugfs: creating \"tx_status\" for \"%s\" failed!\n", devdir);
- e->dentry_restart = debugfs_create_file("restart", 0222, e->subdir,
- bcm, &restart_fops);
- if (!e->dentry_restart)
- printk(KERN_ERR PFX "debugfs: creating \"restart\" for \"%s\" failed!\n", devdir);
}
void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm)
debugfs_remove(e->dentry_devinfo);
debugfs_remove(e->dentry_tsf);
debugfs_remove(e->dentry_txstat);
- debugfs_remove(e->dentry_restart);
debugfs_remove(e->subdir);
kfree(e->xmitstatus_buffer);
kfree(e->xmitstatus_print_buffer);