Skip to content

Commit ac61145

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fix from Jiri Kosina: "A regression fix for EPOLLOUT handling in hidraw and uhid" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: hidraw, uhid: Always report EPOLLOUT
2 parents 213356f + 9e635c2 commit ac61145

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drivers/hid/hidraw.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,14 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
249249
static __poll_t hidraw_poll(struct file *file, poll_table *wait)
250250
{
251251
struct hidraw_list *list = file->private_data;
252+
__poll_t mask = EPOLLOUT | EPOLLWRNORM; /* hidraw is always writable */
252253

253254
poll_wait(file, &list->hidraw->wait, wait);
254255
if (list->head != list->tail)
255-
return EPOLLIN | EPOLLRDNORM;
256+
mask |= EPOLLIN | EPOLLRDNORM;
256257
if (!list->hidraw->exist)
257-
return EPOLLERR | EPOLLHUP;
258-
return EPOLLOUT | EPOLLWRNORM;
258+
mask |= EPOLLERR | EPOLLHUP;
259+
return mask;
259260
}
260261

261262
static int hidraw_open(struct inode *inode, struct file *file)

drivers/hid/uhid.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,13 +766,14 @@ static ssize_t uhid_char_write(struct file *file, const char __user *buffer,
766766
static __poll_t uhid_char_poll(struct file *file, poll_table *wait)
767767
{
768768
struct uhid_device *uhid = file->private_data;
769+
__poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uhid is always writable */
769770

770771
poll_wait(file, &uhid->waitq, wait);
771772

772773
if (uhid->head != uhid->tail)
773-
return EPOLLIN | EPOLLRDNORM;
774+
mask |= EPOLLIN | EPOLLRDNORM;
774775

775-
return EPOLLOUT | EPOLLWRNORM;
776+
return mask;
776777
}
777778

778779
static const struct file_operations uhid_fops = {

0 commit comments

Comments
 (0)