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

« back to all changes in this revision

Viewing changes to drivers/char/dtlk.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:
57
57
#include <linux/ioport.h>       /* for request_region */
58
58
#include <linux/delay.h>        /* for loops_per_jiffy */
59
59
#include <linux/sched.h>
60
 
#include <linux/smp_lock.h>     /* cycle_kernel_lock() */
 
60
#include <linux/mutex.h>
61
61
#include <asm/io.h>             /* for inb_p, outb_p, inb, outb, etc. */
62
62
#include <asm/uaccess.h>        /* for get_user, etc. */
63
63
#include <linux/wait.h>         /* for wait_queue */
73
73
#define TRACE_RET ((void) 0)
74
74
#endif                          /* TRACING */
75
75
 
 
76
static DEFINE_MUTEX(dtlk_mutex);
76
77
static void dtlk_timer_tick(unsigned long data);
77
78
 
78
79
static int dtlk_major;
93
94
static unsigned int dtlk_poll(struct file *, poll_table *);
94
95
static int dtlk_open(struct inode *, struct file *);
95
96
static int dtlk_release(struct inode *, struct file *);
96
 
static int dtlk_ioctl(struct inode *inode, struct file *file,
97
 
                      unsigned int cmd, unsigned long arg);
 
97
static long dtlk_ioctl(struct file *file,
 
98
                       unsigned int cmd, unsigned long arg);
98
99
 
99
100
static const struct file_operations dtlk_fops =
100
101
{
102
103
        .read           = dtlk_read,
103
104
        .write          = dtlk_write,
104
105
        .poll           = dtlk_poll,
105
 
        .ioctl          = dtlk_ioctl,
 
106
        .unlocked_ioctl = dtlk_ioctl,
106
107
        .open           = dtlk_open,
107
108
        .release        = dtlk_release,
 
109
        .llseek         = no_llseek,
108
110
};
109
111
 
110
112
/* local prototypes */
263
265
        wake_up_interruptible(&dtlk_process_list);
264
266
}
265
267
 
266
 
static int dtlk_ioctl(struct inode *inode,
267
 
                      struct file *file,
268
 
                      unsigned int cmd,
269
 
                      unsigned long arg)
 
268
static long dtlk_ioctl(struct file *file,
 
269
                       unsigned int cmd,
 
270
                       unsigned long arg)
270
271
{
271
272
        char __user *argp = (char __user *)arg;
272
273
        struct dtlk_settings *sp;
276
277
        switch (cmd) {
277
278
 
278
279
        case DTLK_INTERROGATE:
 
280
                mutex_lock(&dtlk_mutex);
279
281
                sp = dtlk_interrogate();
 
282
                mutex_unlock(&dtlk_mutex);
280
283
                if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
281
284
                        return -EINVAL;
282
285
                return 0;
295
298
{
296
299
        TRACE_TEXT("(dtlk_open");
297
300
 
298
 
        cycle_kernel_lock();
299
301
        nonseekable_open(inode, file);
300
302
        switch (iminor(inode)) {
301
303
        case DTLK_MINOR: