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

« back to all changes in this revision

Viewing changes to arch/cris/arch-v10/drivers/sync_serial.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:
17
17
#include <linux/errno.h>
18
18
#include <linux/major.h>
19
19
#include <linux/sched.h>
20
 
#include <linux/slab.h>
21
20
#include <linux/interrupt.h>
22
21
#include <linux/poll.h>
23
22
#include <linux/init.h>
24
 
#include <linux/smp_lock.h>
 
23
#include <linux/mutex.h>
25
24
#include <linux/timer.h>
26
25
#include <asm/irq.h>
27
26
#include <asm/dma.h>
150
149
};
151
150
 
152
151
 
 
152
static DEFINE_MUTEX(sync_serial_mutex);
153
153
static int etrax_sync_serial_init(void);
154
154
static void initialize_port(int portnbr);
155
155
static inline int sync_data_avail(struct sync_port *port);
158
158
static int sync_serial_release(struct inode *inode, struct file *file);
159
159
static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
160
160
 
161
 
static int sync_serial_ioctl(struct inode *inode, struct file *file,
 
161
static int sync_serial_ioctl(struct file *file,
162
162
        unsigned int cmd, unsigned long arg);
163
163
static ssize_t sync_serial_write(struct file *file, const char *buf,
164
164
        size_t count, loff_t *ppos);
245
245
#define NUMBER_OF_PORTS 2
246
246
 
247
247
static const struct file_operations sync_serial_fops = {
248
 
        .owner   = THIS_MODULE,
249
 
        .write   = sync_serial_write,
250
 
        .read    = sync_serial_read,
251
 
        .poll    = sync_serial_poll,
252
 
        .ioctl   = sync_serial_ioctl,
253
 
        .open    = sync_serial_open,
254
 
        .release = sync_serial_release
 
248
        .owner          = THIS_MODULE,
 
249
        .write          = sync_serial_write,
 
250
        .read           = sync_serial_read,
 
251
        .poll           = sync_serial_poll,
 
252
        .unlocked_ioctl = sync_serial_ioctl,
 
253
        .open           = sync_serial_open,
 
254
        .release        = sync_serial_release,
 
255
        .llseek         = noop_llseek,
255
256
};
256
257
 
257
258
static int __init etrax_sync_serial_init(void)
446
447
        int mode;
447
448
        int err = -EBUSY;
448
449
 
449
 
        lock_kernel();
 
450
        mutex_lock(&sync_serial_mutex);
450
451
        DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
451
452
 
452
453
        if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
627
628
        ret = 0;
628
629
        
629
630
out:
630
 
        unlock_kernel();
 
631
        mutex_unlock(&sync_serial_mutex);
631
632
        return ret;
632
633
}
633
634
 
679
680
        return mask;
680
681
}
681
682
 
682
 
static int sync_serial_ioctl(struct inode *inode, struct file *file,
 
683
static int sync_serial_ioctl_unlocked(struct file *file,
683
684
                  unsigned int cmd, unsigned long arg)
684
685
{
685
686
        int return_val = 0;
957
958
        return return_val;
958
959
}
959
960
 
 
961
static long sync_serial_ioctl(struct file *file,
 
962
                              unsigned int cmd, unsigned long arg)
 
963
{
 
964
        long ret;
 
965
 
 
966
        mutex_lock(&sync_serial_mutex);
 
967
        ret = sync_serial_ioctl_unlocked(file, cmd, arg);
 
968
        mutex_unlock(&sync_serial_mutex);
 
969
 
 
970
        return ret;
 
971
}
 
972
 
960
973
 
961
974
static ssize_t sync_serial_write(struct file *file, const char *buf,
962
975
        size_t count, loff_t *ppos)