From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932372AbcHIMXG (ORCPT ); Tue, 9 Aug 2016 08:23:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:54787 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932273AbcHIMXB (ORCPT ); Tue, 9 Aug 2016 08:23:01 -0400 Message-ID: <1470745099.2195.9.camel@suse.com> Subject: Re: [PACTH v2] cdc-wdm: Clear read pipeline in case of error From: Oliver Neukum To: robert.foss@collabora.com Cc: Ben Chan , Prathmesh Prabhu , Guenter Roeck , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Date: Tue, 09 Aug 2016 14:18:19 +0200 In-Reply-To: <1470671332-32070-1-git-send-email-robert.foss@collabora.com> References: <1470671332-32070-1-git-send-email-robert.foss@collabora.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-08-08 at 11:48 -0400, robert.foss@collabora.com wrote: > From: Robert Foss > > Implemented queued response handling. This queue is processed every time the > WDM_READ flag is cleared. > > In case of a read error, userspace may not actually read the data, since the > driver returns an error through wdm_poll. After this, the underlying device may > attempt to send us more data, but the queue is not processed. While userspace is > also blocked, because the read error is never cleared. > > After this patch, we proactively process the queue on a read error. If there was > an outstanding response to handle, that will clear the error (or go through the > same logic again, if another read error occurs). If there was no outstanding > response, this will bring the queue size back to 0, unblocking a future response > from the underlying device. > > Tested-by: Robert Foss > Signed-off-by: Robert Foss Acked-by: Oliver Neukum