From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716AbbK1Rlj (ORCPT ); Sat, 28 Nov 2015 12:41:39 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37275 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752540AbbK1Rlg (ORCPT ); Sat, 28 Nov 2015 12:41:36 -0500 Date: Sat, 28 Nov 2015 18:41:18 +0100 From: Dave Penkler To: Andy Shevchenko Cc: Greg Kroah-Hartman , peter.chen@freescale.com, teuniz@gmail.com, USB , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation. Message-ID: <20151128174118.GA9596@slacky> References: <20151118083216.GA1845@slacky> <20151118083750.GA1945@slacky> <20151122091952.GB4581@slacky> <20151125091831.GB1665@slacky> <20151128115512.GA14597@slacky> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 28, 2015 at 04:57:47PM +0200, Andy Shevchenko wrote: > On Sat, Nov 28, 2015 at 1:55 PM, Dave Penkler wrote: > > On Wed, Nov 25, 2015 at 10:38:39PM +0200, Andy Shevchenko wrote: > >> On Wed, Nov 25, 2015 at 11:18 AM, Dave Penkler wrote: > >> > On Sun, Nov 22, 2015 at 12:32:41PM +0200, Andy Shevchenko wrote: > >> >> On Sun, Nov 22, 2015 at 11:19 AM, Dave Penkler wrote: > >> >> > On Wed, Nov 18, 2015 at 11:55:27AM +0200, Andy Shevchenko wrote: > >> >> >> On Wed, Nov 18, 2015 at 10:37 AM, Dave Penkler wrote: > > Thank you for an update! > > >> >> >> > + switch (status) { > >> >> >> > + case 0: /* SUCCESS */ > >> >> >> > + if (data->iin_buffer[0] & 0x80) { > >> >> >> > + /* check for valid STB notification */ > >> >> >> > + if ((data->iin_buffer[0] & 0x7f) > 1) { > > How can I miss that there are two conditionals in a sequence and > moreover for the same data?! Sorry, my fault, it is the combination of patch 1 and 2 > That might explain the optimization done by compiler. > > So, could it be transformed to simple one condition > if (data->iin_buffer[0] > 0x81 /* 129 */) { > ? OK so now for patch 1 and 2 we have: switch (status) { case 0: /* SUCCESS */ /* PATCH 1 check for valid STB notification */ if (data->iin_buffer[0] > 0x81) { data->bNotify1 = data->iin_buffer[0]; data->bNotify2 = data->iin_buffer[1]; atomic_set(&data->iin_data_valid, 1); wake_up_interruptible(&data->waitq); goto exit; } /* PATCH 2 check for SRQ notification */ if (data->iin_buffer[0] == 0x81) { if (data->fasync) kill_fasync(&data->fasync, SIGIO, POLL_IN); atomic_set(&data->srq_asserted, 1); wake_up_interruptible(&data->waitq); goto exit; } I'll push a new set if you are OK with this. cheers, -Dave