Commit 749d3f9c8179a26f87a1427e95229fc94ef40cc1
Committed by
Martin Schwidefsky
1 parent
48f6b00c6e
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
s390/sclp: remove duplicated include from sclp_ctl.c
Remove duplicated include. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Showing 1 changed file with 0 additions and 1 deletions Inline Diff
drivers/s390/char/sclp_ctl.c
1 | /* | 1 | /* |
2 | * IOCTL interface for SCLP | 2 | * IOCTL interface for SCLP |
3 | * | 3 | * |
4 | * Copyright IBM Corp. 2012 | 4 | * Copyright IBM Corp. 2012 |
5 | * | 5 | * |
6 | * Author: Michael Holzheu <holzheu@linux.vnet.ibm.com> | 6 | * Author: Michael Holzheu <holzheu@linux.vnet.ibm.com> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/compat.h> | 9 | #include <linux/compat.h> |
10 | #include <linux/uaccess.h> | 10 | #include <linux/uaccess.h> |
11 | #include <linux/miscdevice.h> | 11 | #include <linux/miscdevice.h> |
12 | #include <linux/gfp.h> | 12 | #include <linux/gfp.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/ioctl.h> | 14 | #include <linux/ioctl.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/compat.h> | ||
17 | #include <asm/compat.h> | 16 | #include <asm/compat.h> |
18 | #include <asm/sclp_ctl.h> | 17 | #include <asm/sclp_ctl.h> |
19 | #include <asm/sclp.h> | 18 | #include <asm/sclp.h> |
20 | 19 | ||
21 | #include "sclp.h" | 20 | #include "sclp.h" |
22 | 21 | ||
23 | /* | 22 | /* |
24 | * Supported command words | 23 | * Supported command words |
25 | */ | 24 | */ |
26 | static unsigned int sclp_ctl_sccb_wlist[] = { | 25 | static unsigned int sclp_ctl_sccb_wlist[] = { |
27 | 0x00400002, | 26 | 0x00400002, |
28 | 0x00410002, | 27 | 0x00410002, |
29 | }; | 28 | }; |
30 | 29 | ||
31 | /* | 30 | /* |
32 | * Check if command word is supported | 31 | * Check if command word is supported |
33 | */ | 32 | */ |
34 | static int sclp_ctl_cmdw_supported(unsigned int cmdw) | 33 | static int sclp_ctl_cmdw_supported(unsigned int cmdw) |
35 | { | 34 | { |
36 | int i; | 35 | int i; |
37 | 36 | ||
38 | for (i = 0; i < ARRAY_SIZE(sclp_ctl_sccb_wlist); i++) { | 37 | for (i = 0; i < ARRAY_SIZE(sclp_ctl_sccb_wlist); i++) { |
39 | if (cmdw == sclp_ctl_sccb_wlist[i]) | 38 | if (cmdw == sclp_ctl_sccb_wlist[i]) |
40 | return 1; | 39 | return 1; |
41 | } | 40 | } |
42 | return 0; | 41 | return 0; |
43 | } | 42 | } |
44 | 43 | ||
45 | static void __user *u64_to_uptr(u64 value) | 44 | static void __user *u64_to_uptr(u64 value) |
46 | { | 45 | { |
47 | if (is_compat_task()) | 46 | if (is_compat_task()) |
48 | return compat_ptr(value); | 47 | return compat_ptr(value); |
49 | else | 48 | else |
50 | return (void __user *)(unsigned long)value; | 49 | return (void __user *)(unsigned long)value; |
51 | } | 50 | } |
52 | 51 | ||
53 | /* | 52 | /* |
54 | * Start SCLP request | 53 | * Start SCLP request |
55 | */ | 54 | */ |
56 | static int sclp_ctl_ioctl_sccb(void __user *user_area) | 55 | static int sclp_ctl_ioctl_sccb(void __user *user_area) |
57 | { | 56 | { |
58 | struct sclp_ctl_sccb ctl_sccb; | 57 | struct sclp_ctl_sccb ctl_sccb; |
59 | struct sccb_header *sccb; | 58 | struct sccb_header *sccb; |
60 | int rc; | 59 | int rc; |
61 | 60 | ||
62 | if (copy_from_user(&ctl_sccb, user_area, sizeof(ctl_sccb))) | 61 | if (copy_from_user(&ctl_sccb, user_area, sizeof(ctl_sccb))) |
63 | return -EFAULT; | 62 | return -EFAULT; |
64 | if (!sclp_ctl_cmdw_supported(ctl_sccb.cmdw)) | 63 | if (!sclp_ctl_cmdw_supported(ctl_sccb.cmdw)) |
65 | return -EOPNOTSUPP; | 64 | return -EOPNOTSUPP; |
66 | sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); | 65 | sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); |
67 | if (!sccb) | 66 | if (!sccb) |
68 | return -ENOMEM; | 67 | return -ENOMEM; |
69 | if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sizeof(*sccb))) { | 68 | if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sizeof(*sccb))) { |
70 | rc = -EFAULT; | 69 | rc = -EFAULT; |
71 | goto out_free; | 70 | goto out_free; |
72 | } | 71 | } |
73 | if (sccb->length > PAGE_SIZE || sccb->length < 8) | 72 | if (sccb->length > PAGE_SIZE || sccb->length < 8) |
74 | return -EINVAL; | 73 | return -EINVAL; |
75 | if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sccb->length)) { | 74 | if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sccb->length)) { |
76 | rc = -EFAULT; | 75 | rc = -EFAULT; |
77 | goto out_free; | 76 | goto out_free; |
78 | } | 77 | } |
79 | rc = sclp_sync_request(ctl_sccb.cmdw, sccb); | 78 | rc = sclp_sync_request(ctl_sccb.cmdw, sccb); |
80 | if (rc) | 79 | if (rc) |
81 | goto out_free; | 80 | goto out_free; |
82 | if (copy_to_user(u64_to_uptr(ctl_sccb.sccb), sccb, sccb->length)) | 81 | if (copy_to_user(u64_to_uptr(ctl_sccb.sccb), sccb, sccb->length)) |
83 | rc = -EFAULT; | 82 | rc = -EFAULT; |
84 | out_free: | 83 | out_free: |
85 | free_page((unsigned long) sccb); | 84 | free_page((unsigned long) sccb); |
86 | return rc; | 85 | return rc; |
87 | } | 86 | } |
88 | 87 | ||
89 | /* | 88 | /* |
90 | * SCLP SCCB ioctl function | 89 | * SCLP SCCB ioctl function |
91 | */ | 90 | */ |
92 | static long sclp_ctl_ioctl(struct file *filp, unsigned int cmd, | 91 | static long sclp_ctl_ioctl(struct file *filp, unsigned int cmd, |
93 | unsigned long arg) | 92 | unsigned long arg) |
94 | { | 93 | { |
95 | void __user *argp; | 94 | void __user *argp; |
96 | 95 | ||
97 | if (is_compat_task()) | 96 | if (is_compat_task()) |
98 | argp = compat_ptr(arg); | 97 | argp = compat_ptr(arg); |
99 | else | 98 | else |
100 | argp = (void __user *) arg; | 99 | argp = (void __user *) arg; |
101 | switch (cmd) { | 100 | switch (cmd) { |
102 | case SCLP_CTL_SCCB: | 101 | case SCLP_CTL_SCCB: |
103 | return sclp_ctl_ioctl_sccb(argp); | 102 | return sclp_ctl_ioctl_sccb(argp); |
104 | default: /* unknown ioctl number */ | 103 | default: /* unknown ioctl number */ |
105 | return -ENOTTY; | 104 | return -ENOTTY; |
106 | } | 105 | } |
107 | } | 106 | } |
108 | 107 | ||
109 | /* | 108 | /* |
110 | * File operations | 109 | * File operations |
111 | */ | 110 | */ |
112 | static const struct file_operations sclp_ctl_fops = { | 111 | static const struct file_operations sclp_ctl_fops = { |
113 | .owner = THIS_MODULE, | 112 | .owner = THIS_MODULE, |
114 | .open = nonseekable_open, | 113 | .open = nonseekable_open, |
115 | .unlocked_ioctl = sclp_ctl_ioctl, | 114 | .unlocked_ioctl = sclp_ctl_ioctl, |
116 | .compat_ioctl = sclp_ctl_ioctl, | 115 | .compat_ioctl = sclp_ctl_ioctl, |
117 | .llseek = no_llseek, | 116 | .llseek = no_llseek, |
118 | }; | 117 | }; |
119 | 118 | ||
120 | /* | 119 | /* |
121 | * Misc device definition | 120 | * Misc device definition |
122 | */ | 121 | */ |
123 | static struct miscdevice sclp_ctl_device = { | 122 | static struct miscdevice sclp_ctl_device = { |
124 | .minor = MISC_DYNAMIC_MINOR, | 123 | .minor = MISC_DYNAMIC_MINOR, |
125 | .name = "sclp", | 124 | .name = "sclp", |
126 | .fops = &sclp_ctl_fops, | 125 | .fops = &sclp_ctl_fops, |
127 | }; | 126 | }; |
128 | 127 | ||
129 | /* | 128 | /* |
130 | * Register sclp_ctl misc device | 129 | * Register sclp_ctl misc device |
131 | */ | 130 | */ |
132 | static int __init sclp_ctl_init(void) | 131 | static int __init sclp_ctl_init(void) |
133 | { | 132 | { |
134 | return misc_register(&sclp_ctl_device); | 133 | return misc_register(&sclp_ctl_device); |
135 | } | 134 | } |
136 | module_init(sclp_ctl_init); | 135 | module_init(sclp_ctl_init); |
137 | 136 | ||
138 | /* | 137 | /* |
139 | * Deregister sclp_ctl misc device | 138 | * Deregister sclp_ctl misc device |
140 | */ | 139 | */ |
141 | static void __exit sclp_ctl_exit(void) | 140 | static void __exit sclp_ctl_exit(void) |
142 | { | 141 | { |
143 | misc_deregister(&sclp_ctl_device); | 142 | misc_deregister(&sclp_ctl_device); |
144 | } | 143 | } |
145 | module_exit(sclp_ctl_exit); | 144 | module_exit(sclp_ctl_exit); |
146 | 145 |