aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
commit53bcef60633086ad73683d01a4ef9ca678484d2d (patch)
tree8b14cc031124d0aa0da6cd3b60115bc7eaa80061 /arch/cris/arch-v32/drivers
parent4fd6c6bf83cb16321e9902b00e2af79054f4e0d6 (diff)
parent85d9865721c62a551547984e6cc8bd3ba732e294 (diff)
Merge branch 'for-linus' of git://www.jni.nu/cris
* 'for-linus' of git://www.jni.nu/cris: (51 commits) CRIS: Fix alignment problem for older ld CRIS: Always dump registers for segfaulting process. CRIS: Add config for pausing a seg-faulting process CRIS: Don't take faults while in_atomic CRIS: Fixup lookup for delay slot faults CRIS: Discard exit.text and .data at runtime CRIS: Add cache aligned and read mostly data sections CRIS: Return something from profile write CRIS: Add ARTPEC-3 and timestamps for sync-serial CRIS: Better ARTPEC-3 support for gpio CRIS: Add include guard CRIS: Better handling of pinmux settings CRIS: New DMA defines for ARTPEC-3 CRIS: __do_strncpy_from_user: Don't read the byte beyond the nil CRIS: Pagetable for ARTPEC-3 CRIS: Machine dependent memmap.h CRIS: Check if pointer is set before using it CRIS: Machine dependent dma.h CRIS: Define __read_mostly for CRISv32 CRIS: Discard .note.gnu.build-id section ...
Diffstat (limited to 'arch/cris/arch-v32/drivers')
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c28
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c12
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c28
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c42
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c30
5 files changed, 91 insertions, 49 deletions
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index b70fb34939d9..b07646a30509 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -11,7 +11,6 @@
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/smp_lock.h>
15#include <linux/spinlock.h> 14#include <linux/spinlock.h>
16#include <linux/stddef.h> 15#include <linux/stddef.h>
17 16
@@ -217,7 +216,7 @@ static int cryptocop_open(struct inode *, struct file *);
217 216
218static int cryptocop_release(struct inode *, struct file *); 217static int cryptocop_release(struct inode *, struct file *);
219 218
220static int cryptocop_ioctl(struct inode *inode, struct file *file, 219static long cryptocop_ioctl(struct file *file,
221 unsigned int cmd, unsigned long arg); 220 unsigned int cmd, unsigned long arg);
222 221
223static void cryptocop_start_job(void); 222static void cryptocop_start_job(void);
@@ -279,10 +278,10 @@ static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op);
279 278
280 279
281const struct file_operations cryptocop_fops = { 280const struct file_operations cryptocop_fops = {
282 .owner = THIS_MODULE, 281 .owner = THIS_MODULE,
283 .open = cryptocop_open, 282 .open = cryptocop_open,
284 .release = cryptocop_release, 283 .release = cryptocop_release,
285 .ioctl = cryptocop_ioctl 284 .unlocked_ioctl = cryptocop_ioctl
286}; 285};
287 286
288 287
@@ -2307,7 +2306,6 @@ static int cryptocop_open(struct inode *inode, struct file *filp)
2307{ 2306{
2308 int p = iminor(inode); 2307 int p = iminor(inode);
2309 2308
2310 cycle_kernel_lock();
2311 if (p != CRYPTOCOP_MINOR) return -EINVAL; 2309 if (p != CRYPTOCOP_MINOR) return -EINVAL;
2312 2310
2313 filp->private_data = NULL; 2311 filp->private_data = NULL;
@@ -3102,7 +3100,8 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
3102 return 0; 3100 return 0;
3103} 3101}
3104 3102
3105static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) 3103static long cryptocop_ioctl_unlocked(struct inode *inode,
3104 struct file *filp, unsigned int cmd, unsigned long arg)
3106{ 3105{
3107 int err = 0; 3106 int err = 0;
3108 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) { 3107 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) {
@@ -3134,6 +3133,19 @@ static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int
3134 return 0; 3133 return 0;
3135} 3134}
3136 3135
3136static long
3137cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3138{
3139 struct inode *inode = file->f_path.dentry->d_inode;
3140 long ret;
3141
3142 lock_kernel();
3143 ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
3144 unlock_kernel();
3145
3146 return ret;
3147}
3148
3137 3149
3138#ifdef LDEBUG 3150#ifdef LDEBUG
3139static void print_dma_descriptors(struct cryptocop_int_operation *iop) 3151static void print_dma_descriptors(struct cryptocop_int_operation *iop)
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index 2fd6a740d895..5a3e900c9a78 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -32,7 +32,7 @@
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/smp_lock.h> 35#include <linux/mutex.h>
36 36
37#include <asm/etraxi2c.h> 37#include <asm/etraxi2c.h>
38 38
@@ -47,6 +47,7 @@
47#define D(x) 47#define D(x)
48 48
49#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */ 49#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */
50static DEFINE_MUTEX(i2c_mutex);
50static const char i2c_name[] = "i2c"; 51static const char i2c_name[] = "i2c";
51 52
52#define CLOCK_LOW_TIME 8 53#define CLOCK_LOW_TIME 8
@@ -636,7 +637,6 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
636static int 637static int
637i2c_open(struct inode *inode, struct file *filp) 638i2c_open(struct inode *inode, struct file *filp)
638{ 639{
639 cycle_kernel_lock();
640 return 0; 640 return 0;
641} 641}
642 642
@@ -665,11 +665,11 @@ i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
665 I2C_ARGREG(arg), 665 I2C_ARGREG(arg),
666 I2C_ARGVALUE(arg))); 666 I2C_ARGVALUE(arg)));
667 667
668 lock_kernel(); 668 mutex_lock(&i2c_mutex);
669 ret = i2c_writereg(I2C_ARGSLAVE(arg), 669 ret = i2c_writereg(I2C_ARGSLAVE(arg),
670 I2C_ARGREG(arg), 670 I2C_ARGREG(arg),
671 I2C_ARGVALUE(arg)); 671 I2C_ARGVALUE(arg));
672 unlock_kernel(); 672 mutex_unlock(&i2c_mutex);
673 return ret; 673 return ret;
674 674
675 case I2C_READREG: 675 case I2C_READREG:
@@ -679,9 +679,9 @@ i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
679 D(printk("i2cr %d %d ", 679 D(printk("i2cr %d %d ",
680 I2C_ARGSLAVE(arg), 680 I2C_ARGSLAVE(arg),
681 I2C_ARGREG(arg))); 681 I2C_ARGREG(arg)));
682 lock_kernel(); 682 mutex_lock(&i2c_mutex);
683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); 683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
684 unlock_kernel(); 684 mutex_unlock(&i2c_mutex);
685 D(printk("= %d\n", val)); 685 D(printk("= %d\n", val));
686 return val; 686 return val;
687 } 687 }
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 97357cfd17bb..2dcd27adbad4 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -72,8 +72,7 @@ static char gpio_name[] = "etrax gpio";
72static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 72static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
73 unsigned long arg); 73 unsigned long arg);
74#endif 74#endif
75static int gpio_ioctl(struct inode *inode, struct file *file, 75static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
76 unsigned int cmd, unsigned long arg);
77static ssize_t gpio_write(struct file *file, const char __user *buf, 76static ssize_t gpio_write(struct file *file, const char __user *buf,
78 size_t count, loff_t *off); 77 size_t count, loff_t *off);
79static int gpio_open(struct inode *inode, struct file *filp); 78static int gpio_open(struct inode *inode, struct file *filp);
@@ -521,7 +520,7 @@ static inline unsigned long setget_output(struct gpio_private *priv,
521 return dir_shadow; 520 return dir_shadow;
522} /* setget_output */ 521} /* setget_output */
523 522
524static int gpio_ioctl(struct inode *inode, struct file *file, 523static long gpio_ioctl_unlocked(struct file *file,
525 unsigned int cmd, unsigned long arg) 524 unsigned int cmd, unsigned long arg)
526{ 525{
527 unsigned long flags; 526 unsigned long flags;
@@ -664,6 +663,17 @@ static int gpio_ioctl(struct inode *inode, struct file *file,
664 return 0; 663 return 0;
665} 664}
666 665
666static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
667{
668 long ret;
669
670 lock_kernel();
671 ret = gpio_ioctl_unlocked(file, cmd, arg);
672 unlock_kernel();
673
674 return ret;
675}
676
667#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 677#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
668static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 678static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
669 unsigned long arg) 679 unsigned long arg)
@@ -877,12 +887,12 @@ static int gpio_pwm_ioctl(struct gpio_private *priv, unsigned int cmd,
877} 887}
878 888
879static const struct file_operations gpio_fops = { 889static const struct file_operations gpio_fops = {
880 .owner = THIS_MODULE, 890 .owner = THIS_MODULE,
881 .poll = gpio_poll, 891 .poll = gpio_poll,
882 .ioctl = gpio_ioctl, 892 .unlocked_ioctl = gpio_ioctl,
883 .write = gpio_write, 893 .write = gpio_write,
884 .open = gpio_open, 894 .open = gpio_open,
885 .release = gpio_release, 895 .release = gpio_release,
886}; 896};
887 897
888#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 898#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index d89ab80498ed..5ec8a7d4e7d7 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -74,8 +74,7 @@ static wait_queue_head_t *gpio_wq;
74static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 74static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
75 unsigned long arg); 75 unsigned long arg);
76#endif 76#endif
77static int gpio_ioctl(struct inode *inode, struct file *file, 77static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
78 unsigned int cmd, unsigned long arg);
79static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 78static ssize_t gpio_write(struct file *file, const char *buf, size_t count,
80 loff_t *off); 79 loff_t *off);
81static int gpio_open(struct inode *inode, struct file *filp); 80static int gpio_open(struct inode *inode, struct file *filp);
@@ -185,7 +184,7 @@ static volatile unsigned long *dir_oe[NUM_PORTS] = {
185static unsigned int gpio_poll(struct file *file, struct poll_table_struct *wait) 184static unsigned int gpio_poll(struct file *file, struct poll_table_struct *wait)
186{ 185{
187 unsigned int mask = 0; 186 unsigned int mask = 0;
188 struct gpio_private *priv = (struct gpio_private *)file->private_data; 187 struct gpio_private *priv = file->private_data;
189 unsigned long data; 188 unsigned long data;
190 poll_wait(file, &priv->alarm_wq, wait); 189 poll_wait(file, &priv->alarm_wq, wait);
191 if (priv->minor == GPIO_MINOR_A) { 190 if (priv->minor == GPIO_MINOR_A) {
@@ -353,7 +352,7 @@ gpio_pa_interrupt(int irq, void *dev_id)
353static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 352static ssize_t gpio_write(struct file *file, const char *buf, size_t count,
354 loff_t *off) 353 loff_t *off)
355{ 354{
356 struct gpio_private *priv = (struct gpio_private *)file->private_data; 355 struct gpio_private *priv = file->private_data;
357 unsigned char data, clk_mask, data_mask, write_msb; 356 unsigned char data, clk_mask, data_mask, write_msb;
358 unsigned long flags; 357 unsigned long flags;
359 unsigned long shadow; 358 unsigned long shadow;
@@ -468,7 +467,7 @@ gpio_release(struct inode *inode, struct file *filp)
468 467
469 spin_lock_irq(&alarm_lock); 468 spin_lock_irq(&alarm_lock);
470 p = alarmlist; 469 p = alarmlist;
471 todel = (struct gpio_private *)filp->private_data; 470 todel = filp->private_data;
472 471
473 if (p == todel) { 472 if (p == todel) {
474 alarmlist = todel->next; 473 alarmlist = todel->next;
@@ -557,17 +556,15 @@ inline unsigned long setget_output(struct gpio_private *priv, unsigned long arg)
557 return dir_shadow; 556 return dir_shadow;
558} /* setget_output */ 557} /* setget_output */
559 558
560static int 559static int gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
561gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
562 560
563static int 561static int
564gpio_ioctl(struct inode *inode, struct file *file, 562gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
565 unsigned int cmd, unsigned long arg)
566{ 563{
567 unsigned long flags; 564 unsigned long flags;
568 unsigned long val; 565 unsigned long val;
569 unsigned long shadow; 566 unsigned long shadow;
570 struct gpio_private *priv = (struct gpio_private *)file->private_data; 567 struct gpio_private *priv = file->private_data;
571 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) 568 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE)
572 return -EINVAL; 569 return -EINVAL;
573 570
@@ -707,6 +704,17 @@ gpio_ioctl(struct inode *inode, struct file *file,
707 return 0; 704 return 0;
708} 705}
709 706
707static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
708{
709 long ret;
710
711 lock_kernel();
712 ret = gpio_ioctl_unlocked(file, cmd, arg);
713 unlock_kernel();
714
715 return ret;
716}
717
710#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 718#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
711static int 719static int
712virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 720virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -714,7 +722,7 @@ virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
714 unsigned long flags; 722 unsigned long flags;
715 unsigned short val; 723 unsigned short val;
716 unsigned short shadow; 724 unsigned short shadow;
717 struct gpio_private *priv = (struct gpio_private *)file->private_data; 725 struct gpio_private *priv = file->private_data;
718 726
719 switch (_IOC_NR(cmd)) { 727 switch (_IOC_NR(cmd)) {
720 case IO_SETBITS: 728 case IO_SETBITS:
@@ -856,12 +864,12 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
856} 864}
857 865
858static const struct file_operations gpio_fops = { 866static const struct file_operations gpio_fops = {
859 .owner = THIS_MODULE, 867 .owner = THIS_MODULE,
860 .poll = gpio_poll, 868 .poll = gpio_poll,
861 .ioctl = gpio_ioctl, 869 .unlocked_ioctl = gpio_ioctl,
862 .write = gpio_write, 870 .write = gpio_write,
863 .open = gpio_open, 871 .open = gpio_open,
864 .release = gpio_release, 872 .release = gpio_release,
865}; 873};
866 874
867#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 875#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 4889f196ecd6..ca248f3adb80 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -153,7 +153,7 @@ static int sync_serial_open(struct inode *, struct file*);
153static int sync_serial_release(struct inode*, struct file*); 153static int sync_serial_release(struct inode*, struct file*);
154static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); 154static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
155 155
156static int sync_serial_ioctl(struct inode*, struct file*, 156static int sync_serial_ioctl(struct file *,
157 unsigned int cmd, unsigned long arg); 157 unsigned int cmd, unsigned long arg);
158static ssize_t sync_serial_write(struct file * file, const char * buf, 158static ssize_t sync_serial_write(struct file * file, const char * buf,
159 size_t count, loff_t *ppos); 159 size_t count, loff_t *ppos);
@@ -241,13 +241,13 @@ static struct sync_port ports[]=
241#define NBR_PORTS ARRAY_SIZE(ports) 241#define NBR_PORTS ARRAY_SIZE(ports)
242 242
243static const struct file_operations sync_serial_fops = { 243static const struct file_operations sync_serial_fops = {
244 .owner = THIS_MODULE, 244 .owner = THIS_MODULE,
245 .write = sync_serial_write, 245 .write = sync_serial_write,
246 .read = sync_serial_read, 246 .read = sync_serial_read,
247 .poll = sync_serial_poll, 247 .poll = sync_serial_poll,
248 .ioctl = sync_serial_ioctl, 248 .unlocked_ioctl = sync_serial_ioctl,
249 .open = sync_serial_open, 249 .open = sync_serial_open,
250 .release = sync_serial_release 250 .release = sync_serial_release
251}; 251};
252 252
253static int __init etrax_sync_serial_init(void) 253static int __init etrax_sync_serial_init(void)
@@ -650,7 +650,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
650 return mask; 650 return mask;
651} 651}
652 652
653static int sync_serial_ioctl(struct inode *inode, struct file *file, 653static int sync_serial_ioctl(struct file *file,
654 unsigned int cmd, unsigned long arg) 654 unsigned int cmd, unsigned long arg)
655{ 655{
656 int return_val = 0; 656 int return_val = 0;
@@ -961,6 +961,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file,
961 return return_val; 961 return return_val;
962} 962}
963 963
964static long sync_serial_ioctl(struct file *file,
965 unsigned int cmd, unsigned long arg)
966{
967 long ret;
968
969 lock_kernel();
970 ret = sync_serial_ioctl_unlocked(file, cmd, arg);
971 unlock_kernel();
972
973 return ret;
974}
975
964/* NOTE: sync_serial_write does not support concurrency */ 976/* NOTE: sync_serial_write does not support concurrency */
965static ssize_t sync_serial_write(struct file *file, const char *buf, 977static ssize_t sync_serial_write(struct file *file, const char *buf,
966 size_t count, loff_t *ppos) 978 size_t count, loff_t *ppos)