aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 11:07:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 11:07:38 -0500
commit18821b0408efc92ec2804128ba9382a3bcebf132 (patch)
treef98fbf75e8e8f33965e489879505fb621e2f11bb /drivers/macintosh
parent3b8ecd22447c4266500c0bcf97f035310543e494 (diff)
parent55e858c8483af427144f33b42b818b30612b82b0 (diff)
Merge branch 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: agp: Remove the BKL from agp_open inifiband: Remove BKL from ipath_open() mips: Remove BKL from tb0219 drivers: Remove BKL from scx200_gpio drivers: Remove BKL from pc8736x_gpio parisc: Remove BKL from eisa_eeprom rtc: Remove BKL from efirtc input: Remove BKL from hp_sdc_rtc hw_random: Remove BKL from core macintosh: Remove BKL from ans-lcd nvram: Drop the bkl from non-generic nvram_llseek() nvram: Drop the bkl from nvram_llseek() mem_class: Drop the bkl from memory_open() spi: Remove BKL from spidev_open drivers: Remove BKL from cs5535_gpio drivers: Remove BKL from misc_open
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/ans-lcd.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
index 6a8221893256..a3d25da2f275 100644
--- a/drivers/macintosh/ans-lcd.c
+++ b/drivers/macintosh/ans-lcd.c
@@ -3,7 +3,6 @@
3 */ 3 */
4 4
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/smp_lock.h>
7#include <linux/errno.h> 6#include <linux/errno.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9#include <linux/miscdevice.h> 8#include <linux/miscdevice.h>
@@ -26,6 +25,7 @@
26static unsigned long anslcd_short_delay = 80; 25static unsigned long anslcd_short_delay = 80;
27static unsigned long anslcd_long_delay = 3280; 26static unsigned long anslcd_long_delay = 3280;
28static volatile unsigned char __iomem *anslcd_ptr; 27static volatile unsigned char __iomem *anslcd_ptr;
28static DEFINE_MUTEX(anslcd_mutex);
29 29
30#undef DEBUG 30#undef DEBUG
31 31
@@ -65,26 +65,31 @@ anslcd_write( struct file * file, const char __user * buf,
65 65
66 if (!access_ok(VERIFY_READ, buf, count)) 66 if (!access_ok(VERIFY_READ, buf, count))
67 return -EFAULT; 67 return -EFAULT;
68
69 mutex_lock(&anslcd_mutex);
68 for ( i = *ppos; count > 0; ++i, ++p, --count ) 70 for ( i = *ppos; count > 0; ++i, ++p, --count )
69 { 71 {
70 char c; 72 char c;
71 __get_user(c, p); 73 __get_user(c, p);
72 anslcd_write_byte_data( c ); 74 anslcd_write_byte_data( c );
73 } 75 }
76 mutex_unlock(&anslcd_mutex);
74 *ppos = i; 77 *ppos = i;
75 return p - buf; 78 return p - buf;
76} 79}
77 80
78static int 81static long
79anslcd_ioctl( struct inode * inode, struct file * file, 82anslcd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
80 unsigned int cmd, unsigned long arg )
81{ 83{
82 char ch, __user *temp; 84 char ch, __user *temp;
85 long ret = 0;
83 86
84#ifdef DEBUG 87#ifdef DEBUG
85 printk(KERN_DEBUG "LCD: ioctl(%d,%d)\n",cmd,arg); 88 printk(KERN_DEBUG "LCD: ioctl(%d,%d)\n",cmd,arg);
86#endif 89#endif
87 90
91 mutex_lock(&anslcd_mutex);
92
88 switch ( cmd ) 93 switch ( cmd )
89 { 94 {
90 case ANSLCD_CLEAR: 95 case ANSLCD_CLEAR:
@@ -93,7 +98,7 @@ anslcd_ioctl( struct inode * inode, struct file * file,
93 anslcd_write_byte_ctrl ( 0x06 ); 98 anslcd_write_byte_ctrl ( 0x06 );
94 anslcd_write_byte_ctrl ( 0x01 ); 99 anslcd_write_byte_ctrl ( 0x01 );
95 anslcd_write_byte_ctrl ( 0x02 ); 100 anslcd_write_byte_ctrl ( 0x02 );
96 return 0; 101 break;
97 case ANSLCD_SENDCTRL: 102 case ANSLCD_SENDCTRL:
98 temp = (char __user *) arg; 103 temp = (char __user *) arg;
99 __get_user(ch, temp); 104 __get_user(ch, temp);
@@ -101,33 +106,37 @@ anslcd_ioctl( struct inode * inode, struct file * file,
101 anslcd_write_byte_ctrl ( ch ); 106 anslcd_write_byte_ctrl ( ch );
102 __get_user(ch, temp); 107 __get_user(ch, temp);
103 } 108 }
104 return 0; 109 break;
105 case ANSLCD_SETSHORTDELAY: 110 case ANSLCD_SETSHORTDELAY:
106 if (!capable(CAP_SYS_ADMIN)) 111 if (!capable(CAP_SYS_ADMIN))
107 return -EACCES; 112 ret =-EACCES;
108 anslcd_short_delay=arg; 113 else
109 return 0; 114 anslcd_short_delay=arg;
115 break;
110 case ANSLCD_SETLONGDELAY: 116 case ANSLCD_SETLONGDELAY:
111 if (!capable(CAP_SYS_ADMIN)) 117 if (!capable(CAP_SYS_ADMIN))
112 return -EACCES; 118 ret = -EACCES;
113 anslcd_long_delay=arg; 119 else
114 return 0; 120 anslcd_long_delay=arg;
121 break;
115 default: 122 default:
116 return -EINVAL; 123 ret = -EINVAL;
117 } 124 }
125
126 mutex_unlock(&anslcd_mutex);
127 return ret;
118} 128}
119 129
120static int 130static int
121anslcd_open( struct inode * inode, struct file * file ) 131anslcd_open( struct inode * inode, struct file * file )
122{ 132{
123 cycle_kernel_lock();
124 return 0; 133 return 0;
125} 134}
126 135
127const struct file_operations anslcd_fops = { 136const struct file_operations anslcd_fops = {
128 .write = anslcd_write, 137 .write = anslcd_write,
129 .ioctl = anslcd_ioctl, 138 .unlocked_ioctl = anslcd_ioctl,
130 .open = anslcd_open, 139 .open = anslcd_open,
131}; 140};
132 141
133static struct miscdevice anslcd_dev = { 142static struct miscdevice anslcd_dev = {
@@ -168,6 +177,7 @@ anslcd_init(void)
168 printk(KERN_DEBUG "LCD: init\n"); 177 printk(KERN_DEBUG "LCD: init\n");
169#endif 178#endif
170 179
180 mutex_lock(&anslcd_mutex);
171 anslcd_write_byte_ctrl ( 0x38 ); 181 anslcd_write_byte_ctrl ( 0x38 );
172 anslcd_write_byte_ctrl ( 0x0c ); 182 anslcd_write_byte_ctrl ( 0x0c );
173 anslcd_write_byte_ctrl ( 0x06 ); 183 anslcd_write_byte_ctrl ( 0x06 );
@@ -176,6 +186,7 @@ anslcd_init(void)
176 for(a=0;a<80;a++) { 186 for(a=0;a<80;a++) {
177 anslcd_write_byte_data(anslcd_logo[a]); 187 anslcd_write_byte_data(anslcd_logo[a]);
178 } 188 }
189 mutex_unlock(&anslcd_mutex);
179 return 0; 190 return 0;
180} 191}
181 192