diff options
Diffstat (limited to 'drivers/sbus/char/display7seg.c')
| -rw-r--r-- | drivers/sbus/char/display7seg.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 4431578d8c4..7c71e7b4feb 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -9,13 +9,13 @@ #include <linux/fs.h> #include <linux/errno.h> #include <linux/major.h> -#include <linux/init.h> #include <linux/miscdevice.h> #include <linux/ioport.h> /* request_region */ -#include <linux/smp_lock.h> +#include <linux/slab.h> +#include <linux/mutex.h> #include <linux/of.h> #include <linux/of_device.h> -#include <asm/atomic.h> +#include <linux/atomic.h> #include <asm/uaccess.h> /* put_/get_user */ #include <asm/io.h> @@ -25,6 +25,7 @@ #define DRIVER_NAME "d7s" #define PFX DRIVER_NAME ": " +static DEFINE_MUTEX(d7s_mutex); static int sol_compat = 0; /* Solaris compatibility mode */ /* Solaris compatibility flag - @@ -73,7 +74,6 @@ static int d7s_open(struct inode *inode, struct file *f) { if (D7S_MINOR != iminor(inode)) return -ENODEV; - cycle_kernel_lock(); atomic_inc(&d7s_users); return 0; } @@ -106,10 +106,10 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) int error = 0; u8 ireg = 0; - if (D7S_MINOR != iminor(file->f_path.dentry->d_inode)) + if (D7S_MINOR != iminor(file_inode(file))) return -ENODEV; - lock_kernel(); + mutex_lock(&d7s_mutex); switch (cmd) { case D7SIOCWR: /* assign device register values we mask-out D7S_FLIP @@ -149,8 +149,8 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) regs |= D7S_FLIP; writeb(regs, p->regs); break; - }; - unlock_kernel(); + } + mutex_unlock(&d7s_mutex); return error; } @@ -161,6 +161,7 @@ static const struct file_operations d7s_fops = { .compat_ioctl = d7s_ioctl, .open = d7s_open, .release = d7s_release, + .llseek = noop_llseek, }; static struct miscdevice d7s_miscdev = { @@ -169,8 +170,7 @@ static struct miscdevice d7s_miscdev = { .fops = &d7s_fops }; -static int __devinit d7s_probe(struct of_device *op, - const struct of_device_id *match) +static int d7s_probe(struct platform_device *op) { struct device_node *opts; int err = -EINVAL; @@ -215,7 +215,7 @@ static int __devinit d7s_probe(struct of_device *op, writeb(regs, p->regs); printk(KERN_INFO PFX "7-Segment Display%s at [%s:0x%llx] %s\n", - op->node->full_name, + op->dev.of_node->full_name, (regs & D7S_FLIP) ? " (FLIPPED)" : "", op->resource[0].start, sol_compat ? "in sol_compat mode" : ""); @@ -235,7 +235,7 @@ out_free: goto out; } -static int __devexit d7s_remove(struct of_device *op) +static int d7s_remove(struct platform_device *op) { struct d7s *p = dev_get_drvdata(&op->dev); u8 regs = readb(p->regs); @@ -264,22 +264,14 @@ static const struct of_device_id d7s_match[] = { }; MODULE_DEVICE_TABLE(of, d7s_match); -static struct of_platform_driver d7s_driver = { - .name = DRIVER_NAME, - .match_table = d7s_match, +static struct platform_driver d7s_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + .of_match_table = d7s_match, + }, .probe = d7s_probe, - .remove = __devexit_p(d7s_remove), + .remove = d7s_remove, }; -static int __init d7s_init(void) -{ - return of_register_driver(&d7s_driver, &of_bus_type); -} - -static void __exit d7s_exit(void) -{ - of_unregister_driver(&d7s_driver); -} - -module_init(d7s_init); -module_exit(d7s_exit); +module_platform_driver(d7s_driver); |
