~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/char/nwflash.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <linux/spinlock.h>
26
26
#include <linux/rwsem.h>
27
27
#include <linux/init.h>
28
 
#include <linux/smp_lock.h>
29
28
#include <linux/mutex.h>
 
29
#include <linux/jiffies.h>
30
30
 
31
31
#include <asm/hardware/dec21285.h>
32
32
#include <asm/io.h>
40
40
 
41
41
#define NWFLASH_VERSION "6.4"
42
42
 
 
43
static DEFINE_MUTEX(flash_mutex);
43
44
static void kick_open(void);
44
45
static int get_flash_id(void);
45
46
static int erase_block(int nBlock);
93
94
        return c2;
94
95
}
95
96
 
96
 
static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg)
 
97
static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
97
98
{
 
99
        mutex_lock(&flash_mutex);
98
100
        switch (cmd) {
99
101
        case CMD_WRITE_DISABLE:
100
102
                gbWriteBase64Enable = 0;
112
114
        default:
113
115
                gbWriteBase64Enable = 0;
114
116
                gbWriteEnable = 0;
 
117
                mutex_unlock(&flash_mutex);
115
118
                return -EINVAL;
116
119
        }
 
120
        mutex_unlock(&flash_mutex);
117
121
        return 0;
118
122
}
119
123
 
278
282
{
279
283
        loff_t ret;
280
284
 
281
 
        lock_kernel();
 
285
        mutex_lock(&flash_mutex);
282
286
        if (flashdebug)
283
287
                printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
284
288
                       (unsigned int) offset, orig);
313
317
        default:
314
318
                ret = -EINVAL;
315
319
        }
316
 
        unlock_kernel();
 
320
        mutex_unlock(&flash_mutex);
317
321
        return ret;
318
322
}
319
323
 
630
634
        .llseek         = flash_llseek,
631
635
        .read           = flash_read,
632
636
        .write          = flash_write,
633
 
        .ioctl          = flash_ioctl,
 
637
        .unlocked_ioctl = flash_ioctl,
634
638
};
635
639
 
636
640
static struct miscdevice flash_miscdev =