From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1949145AbcBSQOK (ORCPT ); Fri, 19 Feb 2016 11:14:10 -0500 Received: from smtp73.iad3a.emailsrvr.com ([173.203.187.73]:34626 "EHLO smtp73.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1948951AbcBSQOH (ORCPT ); Fri, 19 Feb 2016 11:14:07 -0500 X-Auth-ID: abbotti@mev.co.uk X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: devel@driverdev.osuosl.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , linux-kernel@vger.kernel.org Subject: staging: comedi: COMEDI_BUFINFO: some behavioural changes Date: Fri, 19 Feb 2016 16:13:49 +0000 Message-Id: <1455898437-4640-1-git-send-email-abbotti@mev.co.uk> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These patches change the behavior of the `COMEDI_BUFINFO` ioctl, which is used to manage buffer positions for a previously set up asynchronous acquisition command. It is used instead of the read and write file operations when the buffer has been mmapped. Patches 1 to 4 are fairly innocuous. Patches 5 to 8 change the error handling when the asynchronous command is no longer running, allow the subdevice to become "non-busy" automatically in more cases (causing subsequent calls to return `-EINVAL`), and report abnormal command termination with return value `-EPIPE` (which also makes the subdevice become non-busy). 1) staging: comedi: COMEDI_BUFINFO: get amount freed, not amount allocated 2) staging: comedi: COMEDI_BUFINFO: force bytes_read or bytes_written to 0 3) staging: comedi: COMEDI_BUFINFO: update buffer before becoming non-busy 4) staging: comedi: COMEDI_BUFINFO: force bytes_written to 0 if stopped 5) staging: comedi: COMEDI_BUFINFO: return error if no active command 6) staging: comedi: COMEDI_BUFINFO: become non-busy even if bytes_read is 0 7) staging: comedi: COMEDI_BUFINFO: return -EPIPE for abnormal read 8) staging: comedi: COMEDI_BUFINFO: terminate "write" command when stopped drivers/staging/comedi/comedi_fops.c | 84 +++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 40 deletions(-)