diff options
author | Jiri Kosina <jkosina@suse.cz> | 2014-01-06 10:43:27 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-01-06 10:43:27 -0500 |
commit | 618345359ed99a78e63f5cef8a09a8494589ee11 (patch) | |
tree | 2f801d6862136d390ee1d6bf83849af13a08c66a /drivers/hid | |
parent | bbe3175408cde792fbaa5bd1e41e430ea9e4fb4f (diff) |
HID: hidraw: make comment more accurate and nicer
Reformat and reword some of the comments to make them more understandable.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hidraw.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 6a6dd5cd7833..cb0137b3718d 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * to work on raw hid events as they want to, and avoids a need to | 6 | * to work on raw hid events as they want to, and avoids a need to |
7 | * use a transport-specific userspace libhid/libusb libraries. | 7 | * use a transport-specific userspace libhid/libusb libraries. |
8 | * | 8 | * |
9 | * Copyright (c) 2007 Jiri Kosina | 9 | * Copyright (c) 2007-2014 Jiri Kosina |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
@@ -104,8 +104,11 @@ out: | |||
104 | return ret; | 104 | return ret; |
105 | } | 105 | } |
106 | 106 | ||
107 | /* The first byte is expected to be a report number. | 107 | /* |
108 | * This function is to be called with the minors_lock mutex held */ | 108 | * The first byte of the report buffer is expected to be a report number. |
109 | * | ||
110 | * This function is to be called with the minors_lock mutex held. | ||
111 | */ | ||
109 | static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) | 112 | static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) |
110 | { | 113 | { |
111 | unsigned int minor = iminor(file_inode(file)); | 114 | unsigned int minor = iminor(file_inode(file)); |
@@ -157,7 +160,6 @@ out: | |||
157 | return ret; | 160 | return ret; |
158 | } | 161 | } |
159 | 162 | ||
160 | /* the first byte is expected to be a report number */ | ||
161 | static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 163 | static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
162 | { | 164 | { |
163 | ssize_t ret; | 165 | ssize_t ret; |
@@ -168,12 +170,15 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
168 | } | 170 | } |
169 | 171 | ||
170 | 172 | ||
171 | /* This function performs a Get_Report transfer over the control endpoint | 173 | /* |
174 | * This function performs a Get_Report transfer over the control endpoint | ||
172 | * per section 7.2.1 of the HID specification, version 1.1. The first byte | 175 | * per section 7.2.1 of the HID specification, version 1.1. The first byte |
173 | * of buffer is the report number to request, or 0x0 if the defice does not | 176 | * of buffer is the report number to request, or 0x0 if the defice does not |
174 | * use numbered reports. The report_type parameter can be HID_FEATURE_REPORT | 177 | * use numbered reports. The report_type parameter can be HID_FEATURE_REPORT |
175 | * or HID_INPUT_REPORT. This function is to be called with the minors_lock | 178 | * or HID_INPUT_REPORT. |
176 | * mutex held. */ | 179 | * |
180 | * This function is to be called with the minors_lock mutex held. | ||
181 | */ | ||
177 | static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) | 182 | static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) |
178 | { | 183 | { |
179 | unsigned int minor = iminor(file_inode(file)); | 184 | unsigned int minor = iminor(file_inode(file)); |
@@ -209,8 +214,10 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t | |||
209 | goto out; | 214 | goto out; |
210 | } | 215 | } |
211 | 216 | ||
212 | /* Read the first byte from the user. This is the report number, | 217 | /* |
213 | * which is passed to dev->hid_get_raw_report(). */ | 218 | * Read the first byte from the user. This is the report number, |
219 | * which is passed to dev->hid_get_raw_report(). | ||
220 | */ | ||
214 | if (copy_from_user(&report_number, buffer, 1)) { | 221 | if (copy_from_user(&report_number, buffer, 1)) { |
215 | ret = -EFAULT; | 222 | ret = -EFAULT; |
216 | goto out_free; | 223 | goto out_free; |
@@ -498,7 +505,7 @@ int hidraw_connect(struct hid_device *hid) | |||
498 | int minor, result; | 505 | int minor, result; |
499 | struct hidraw *dev; | 506 | struct hidraw *dev; |
500 | 507 | ||
501 | /* we accept any HID device, no matter the applications */ | 508 | /* we accept any HID device, all applications */ |
502 | 509 | ||
503 | dev = kzalloc(sizeof(struct hidraw), GFP_KERNEL); | 510 | dev = kzalloc(sizeof(struct hidraw), GFP_KERNEL); |
504 | if (!dev) | 511 | if (!dev) |