git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
drivers
/
sbus
/
char
/
display7seg.c
diff --git
a/drivers/sbus/char/display7seg.c
b/drivers/sbus/char/display7seg.c
index
e8ac0b4
..
c3a51d1
100644
(file)
--- a/
drivers/sbus/char/display7seg.c
+++ b/
drivers/sbus/char/display7seg.c
@@
-14,7
+14,8
@@
#include <linux/major.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/major.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
-#include <linux/ioport.h> /* request_region, check_region */
+#include <linux/ioport.h> /* request_region */
+#include <linux/smp_lock.h>
#include <asm/atomic.h>
#include <asm/ebus.h> /* EBus device */
#include <asm/oplib.h> /* OpenProm Library */
#include <asm/atomic.h>
#include <asm/ebus.h> /* EBus device */
#include <asm/oplib.h> /* OpenProm Library */
@@
-44,8
+45,8
@@
static int sol_compat = 0; /* Solaris compatibility mode */
* If you wish the device to operate as under Solaris,
* omitting above features, set this parameter to non-zero.
*/
* If you wish the device to operate as under Solaris,
* omitting above features, set this parameter to non-zero.
*/
-MODULE_PARM
- (sol_compat,
"1i"
);
+module_param
+ (sol_compat,
int, 0
);
MODULE_PARM_DESC
(sol_compat,
"Disables documented functionality omitted from Solaris driver");
MODULE_PARM_DESC
(sol_compat,
"Disables documented functionality omitted from Solaris driver");
@@
-70,7
+71,7
@@
MODULE_SUPPORTED_DEVICE
* FLIP - Inverts display for upside-down mounted board
* bits 0-4 - 7-segment display contents
*/
* FLIP - Inverts display for upside-down mounted board
* bits 0-4 - 7-segment display contents
*/
-
volatile u8* d7s_regs = NULL
;
+
static void __iomem* d7s_regs
;
static inline void d7s_free(void)
{
static inline void d7s_free(void)
{
@@
-114,22
+115,25
@@
static int d7s_release(struct inode *inode, struct file *f)
return 0;
}
return 0;
}
-static int d7s_ioctl(struct inode *inode, struct file *f,
- unsigned int cmd, unsigned long arg)
+static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
__u8 regs = readb(d7s_regs);
__u8 ireg = 0;
{
__u8 regs = readb(d7s_regs);
__u8 ireg = 0;
+ int error = 0;
- if (D7S_MINOR != iminor(inode))
+ if (D7S_MINOR != iminor(
file->f_dentry->d_
inode))
return -ENODEV;
return -ENODEV;
+ lock_kernel();
switch (cmd) {
case D7SIOCWR:
/* assign device register values
* we mask-out D7S_FLIP if in sol_compat mode
*/
switch (cmd) {
case D7SIOCWR:
/* assign device register values
* we mask-out D7S_FLIP if in sol_compat mode
*/
- if (get_user(ireg, (int __user *) arg))
- return -EFAULT;
+ if (get_user(ireg, (int __user *) arg)) {
+ error = -EFAULT;
+ break;
+ }
if (0 != sol_compat) {
(regs & D7S_FLIP) ?
(ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP);
if (0 != sol_compat) {
(regs & D7S_FLIP) ?
(ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP);
@@
-144,8
+148,10
@@
static int d7s_ioctl(struct inode *inode, struct file *f,
* This driver will not misinform you about the state
* of your hardware while in sol_compat mode
*/
* This driver will not misinform you about the state
* of your hardware while in sol_compat mode
*/
- if (put_user(regs, (int __user *) arg))
- return -EFAULT;
+ if (put_user(regs, (int __user *) arg)) {
+ error = -EFAULT;
+ break;
+ }
break;
case D7SIOCTM:
break;
case D7SIOCTM:
@@
-155,15
+161,17
@@
static int d7s_ioctl(struct inode *inode, struct file *f,
writeb(regs, d7s_regs);
break;
};
writeb(regs, d7s_regs);
break;
};
+ unlock_kernel();
- return
0
;
+ return
error
;
}
static struct file_operations d7s_fops = {
}
static struct file_operations d7s_fops = {
- .owner = THIS_MODULE,
- .ioctl = d7s_ioctl,
- .open = d7s_open,
- .release = d7s_release,
+ .owner = THIS_MODULE,
+ .unlocked_ioctl = d7s_ioctl,
+ .compat_ioctl = d7s_ioctl,
+ .open = d7s_open,
+ .release = d7s_release,
};
static struct miscdevice d7s_miscdev = { D7S_MINOR, D7S_DEVNAME, &d7s_fops };
};
static struct miscdevice d7s_miscdev = { D7S_MINOR, D7S_DEVNAME, &d7s_fops };