Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934516AbbKSRDM (ORCPT ); Thu, 19 Nov 2015 12:03:12 -0500 Received: from mail-by2on0148.outbound.protection.outlook.com ([207.46.100.148]:39456 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934060AbbKSRDK convert rfc822-to-8bit (ORCPT ); Thu, 19 Nov 2015 12:03:10 -0500 From: Hartley Sweeten To: Ian Abbott , "driverdev-devel@linuxdriverproject.org" CC: Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/8] staging: comedi: rearrange comedi_write() code Thread-Topic: [PATCH 1/8] staging: comedi: rearrange comedi_write() code Thread-Index: AQHRIipMqxemfcxLk0WhZvtpDpPtW56jk2mg Date: Thu, 19 Nov 2015 17:03:05 +0000 Message-ID: References: <1447869311-21955-1-git-send-email-abbotti@mev.co.uk> <1447869311-21955-2-git-send-email-abbotti@mev.co.uk> In-Reply-To: <1447869311-21955-2-git-send-email-abbotti@mev.co.uk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=HartleyS@visionengravers.com; x-originating-ip: [184.183.19.121] x-microsoft-exchange-diagnostics: 1;BN3PR0101MB1058;5:jZt655/fYDpbSS4TDkXjtIUp1usxZSIGghwpFgQ2AmRT5nwhBFBu9iKE02XDmfEpBHamvsMpPAf3xCVaEWVMedrP21ZWBQ7RIWX4pOhQDMmA1bbdLTdOUWiXcUfkOSjbxU4geI2fGqXn/OOUcLbiZQ==;24:3eJbrLpMpkgUnNcUPMlDI87OBnMJP7OpvKoraREZ9SxAf2UpSujoLLln/XhWIgVk0tF1gSiOFUgvdlciOdtgk9L0qyEGfjdHGCutA/HNqls=;20:jfNpttOQ6mTDWmFqoQyEBRTTOuHRGGMSOxeA/hba+uEv2LIgJRNBAZYrV7HerQiNKxJOJe0w5PRwjl1dZ6dRNw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0101MB1058; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001);SRVR:BN3PR0101MB1058;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0101MB1058; x-forefront-prvs: 07658B8EA3 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(377454003)(189002)(199003)(24454002)(10400500002)(50986999)(105586002)(54356999)(5008740100001)(74316001)(87936001)(19580405001)(19580395003)(106356001)(586003)(77096005)(66066001)(92566002)(2950100001)(86362001)(81156007)(80792005)(11100500001)(2900100001)(5004730100002)(5002640100001)(97736004)(122556002)(106116001)(3846002)(40100003)(76176999)(33656002)(102836003)(5001960100002)(189998001)(5001920100001)(2501003)(5003600100002)(101416001)(5001770100001)(6116002)(5007970100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0101MB1058;H:BN3PR0101MB1057.prod.exchangelabs.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: visionengravers.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2015 17:03:05.1463 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d698601f-af92-4269-8099-fd6f11636477 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0101MB1058 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1494 Lines: 40 On Wednesday, November 18, 2015 10:55 AM, Ian Abbott wrote: > Rearrange the code in `comedi_write()` to reduce the amount of > indentation. The code never reiterates the `while` loop once `count` > has become non-zero, so we can check that in the `while` condition to > save an indentation level. (Note that `nbytes` has been checked to be > non-zero before entering the loop, so we can remove that check.) Move > the code that makes the subdevice "become non-busy" outside the `while` > loop, using a new flag variable `become_nonbusy` to decide whether it > needs to be done. This simplifies the wait queue handling so there is a > single place where the task is removed from the wait queue, and we can > remove the `on_wait_queue` flag variable. > > Signed-off-by: Ian Abbott > --- > drivers/staging/comedi/comedi_fops.c | 71 +++++++++++++++--------------------- > 1 file changed, 30 insertions(+), 41 deletions(-) Ian, Minor nit-pick... [snip] > -out: > - if (on_wait_queue) > - remove_wait_queue(&async->wait_head, &wait); > + remove_wait_queue(&async->wait_head, &wait); > set_current_state(TASK_RUNNING); > + if (become_nonbusy && count == 0) { It looks like 'count' will always be 0 here. Regards Hartley -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/