diff options
Diffstat (limited to 'drivers/char/scx200_gpio.c')
| -rw-r--r-- | drivers/char/scx200_gpio.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 664a6e97eb1a..dd051ea6755e 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* linux/drivers/char/scx200_gpio.c | 1 | /* linux/drivers/char/scx200_gpio.c |
| 2 | 2 | ||
| 3 | National Semiconductor SCx200 GPIO driver. Allows a user space | 3 | National Semiconductor SCx200 GPIO driver. Allows a user space |
| 4 | process to play with the GPIO pins. | 4 | process to play with the GPIO pins. |
| @@ -26,7 +26,7 @@ static int major = 0; /* default to dynamic major */ | |||
| 26 | module_param(major, int, 0); | 26 | module_param(major, int, 0); |
| 27 | MODULE_PARM_DESC(major, "Major device number"); | 27 | MODULE_PARM_DESC(major, "Major device number"); |
| 28 | 28 | ||
| 29 | static ssize_t scx200_gpio_write(struct file *file, const char __user *data, | 29 | static ssize_t scx200_gpio_write(struct file *file, const char __user *data, |
| 30 | size_t len, loff_t *ppos) | 30 | size_t len, loff_t *ppos) |
| 31 | { | 31 | { |
| 32 | unsigned m = iminor(file->f_dentry->d_inode); | 32 | unsigned m = iminor(file->f_dentry->d_inode); |
| @@ -34,15 +34,14 @@ static ssize_t scx200_gpio_write(struct file *file, const char __user *data, | |||
| 34 | 34 | ||
| 35 | for (i = 0; i < len; ++i) { | 35 | for (i = 0; i < len; ++i) { |
| 36 | char c; | 36 | char c; |
| 37 | if (get_user(c, data+i)) | 37 | if (get_user(c, data + i)) |
| 38 | return -EFAULT; | 38 | return -EFAULT; |
| 39 | switch (c) | 39 | switch (c) { |
| 40 | { | 40 | case '0': |
| 41 | case '0': | 41 | scx200_gpio_set(m, 0); |
| 42 | scx200_gpio_set(m, 0); | ||
| 43 | break; | 42 | break; |
| 44 | case '1': | 43 | case '1': |
| 45 | scx200_gpio_set(m, 1); | 44 | scx200_gpio_set(m, 1); |
| 46 | break; | 45 | break; |
| 47 | case 'O': | 46 | case 'O': |
| 48 | printk(KERN_INFO NAME ": GPIO%d output enabled\n", m); | 47 | printk(KERN_INFO NAME ": GPIO%d output enabled\n", m); |
| @@ -83,7 +82,7 @@ static ssize_t scx200_gpio_read(struct file *file, char __user *buf, | |||
| 83 | value = scx200_gpio_get(m); | 82 | value = scx200_gpio_get(m); |
| 84 | if (put_user(value ? '1' : '0', buf)) | 83 | if (put_user(value ? '1' : '0', buf)) |
| 85 | return -EFAULT; | 84 | return -EFAULT; |
| 86 | 85 | ||
| 87 | return 1; | 86 | return 1; |
| 88 | } | 87 | } |
| 89 | 88 | ||
| @@ -140,10 +139,3 @@ static void __exit scx200_gpio_cleanup(void) | |||
| 140 | 139 | ||
| 141 | module_init(scx200_gpio_init); | 140 | module_init(scx200_gpio_init); |
| 142 | module_exit(scx200_gpio_cleanup); | 141 | module_exit(scx200_gpio_cleanup); |
| 143 | |||
| 144 | /* | ||
| 145 | Local variables: | ||
| 146 | compile-command: "make -k -C ../.. SUBDIRS=drivers/char modules" | ||
| 147 | c-basic-offset: 8 | ||
| 148 | End: | ||
| 149 | */ | ||
