From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547AbbC0PNa (ORCPT ); Fri, 27 Mar 2015 11:13:30 -0400 Received: from smtp73.iad3a.emailsrvr.com ([173.203.187.73]:47565 "EHLO smtp73.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753380AbbC0PNX (ORCPT ); Fri, 27 Mar 2015 11:13:23 -0400 X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , Subject: [PATCH 6/7] staging: comedi: comedi_fops: send SIGIO according to command direction Date: Fri, 27 Mar 2015 15:13:05 +0000 Message-Id: <1427469186-11222-7-git-send-email-abbotti@mev.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427469186-11222-1-git-send-email-abbotti@mev.co.uk> References: <1427469186-11222-1-git-send-email-abbotti@mev.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org `comedi_event()` is called from low-level drivers to handle comedi asynchronous command event flags. Some events cause waiting tasks to be woken up, and a `SIGIO` signal to be sent via `kill_fasync()`. The signal code is `POLL_OUT` if the subdevice supports commands in the "write" direction, or `POLL_IN` for the "read" direction. If the subdevice supports commands in either direction, it sends two `SIGIO` signals, one with each code. Change that latter case to only send one `SIGIO` signal, using the direction of the current command to determine the signal code. If the `CMDF_WRITE` flag is set in the current command, it's in the "write" direction, otherwise it's in the "read" direction. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 68ced20..7ae605f 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2674,11 +2674,11 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) } if (async->cb_mask & events) { + int si_code; + wake_up_interruptible(&async->wait_head); - if (s->subdev_flags & SDF_CMD_READ) - kill_fasync(&dev->async_queue, SIGIO, POLL_IN); - if (s->subdev_flags & SDF_CMD_WRITE) - kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); + si_code = async->cmd.flags & CMDF_WRITE ? POLL_OUT : POLL_IN; + kill_fasync(&dev->async_queue, SIGIO, si_code); } } EXPORT_SYMBOL_GPL(comedi_event); -- 2.1.4