提交 61834535 编写于 作者: J Jiri Kosina

HID: hidraw: make comment more accurate and nicer

Reformat and reword some of the comments to make them more understandable.
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 bbe31754
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* to work on raw hid events as they want to, and avoids a need to * to work on raw hid events as they want to, and avoids a need to
* use a transport-specific userspace libhid/libusb libraries. * use a transport-specific userspace libhid/libusb libraries.
* *
* Copyright (c) 2007 Jiri Kosina * Copyright (c) 2007-2014 Jiri Kosina
*/ */
/* /*
...@@ -104,8 +104,11 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, ...@@ -104,8 +104,11 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count,
return ret; return ret;
} }
/* The first byte is expected to be a report number. /*
* This function is to be called with the minors_lock mutex held */ * The first byte of the report buffer is expected to be a report number.
*
* This function is to be called with the minors_lock mutex held.
*/
static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type)
{ {
unsigned int minor = iminor(file_inode(file)); unsigned int minor = iminor(file_inode(file));
...@@ -157,7 +160,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, ...@@ -157,7 +160,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
return ret; return ret;
} }
/* the first byte is expected to be a report number */
static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{ {
ssize_t ret; ssize_t ret;
...@@ -168,12 +170,15 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t ...@@ -168,12 +170,15 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
} }
/* This function performs a Get_Report transfer over the control endpoint /*
* This function performs a Get_Report transfer over the control endpoint
* per section 7.2.1 of the HID specification, version 1.1. The first byte * per section 7.2.1 of the HID specification, version 1.1. The first byte
* of buffer is the report number to request, or 0x0 if the defice does not * of buffer is the report number to request, or 0x0 if the defice does not
* use numbered reports. The report_type parameter can be HID_FEATURE_REPORT * use numbered reports. The report_type parameter can be HID_FEATURE_REPORT
* or HID_INPUT_REPORT. This function is to be called with the minors_lock * or HID_INPUT_REPORT.
* mutex held. */ *
* This function is to be called with the minors_lock mutex held.
*/
static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type)
{ {
unsigned int minor = iminor(file_inode(file)); 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,8 +214,10 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
goto out; goto out;
} }
/* Read the first byte from the user. This is the report number, /*
* which is passed to dev->hid_get_raw_report(). */ * Read the first byte from the user. This is the report number,
* which is passed to dev->hid_get_raw_report().
*/
if (copy_from_user(&report_number, buffer, 1)) { if (copy_from_user(&report_number, buffer, 1)) {
ret = -EFAULT; ret = -EFAULT;
goto out_free; goto out_free;
...@@ -498,7 +505,7 @@ int hidraw_connect(struct hid_device *hid) ...@@ -498,7 +505,7 @@ int hidraw_connect(struct hid_device *hid)
int minor, result; int minor, result;
struct hidraw *dev; struct hidraw *dev;
/* we accept any HID device, no matter the applications */ /* we accept any HID device, all applications */
dev = kzalloc(sizeof(struct hidraw), GFP_KERNEL); dev = kzalloc(sizeof(struct hidraw), GFP_KERNEL);
if (!dev) if (!dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册