From patchwork Wed Dec 12 20:16:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1012254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FSl71ZfMz9s2P for ; Thu, 13 Dec 2018 07:16:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43FSl66NK8zDqVW for ; Thu, 13 Dec 2018 07:16:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lvivier@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43FSkz3StLzDqVT for ; Thu, 13 Dec 2018 07:16:43 +1100 (AEDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9083E308FF30; Wed, 12 Dec 2018 20:16:41 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-204-190.brq.redhat.com [10.40.204.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 558B01001925; Wed, 12 Dec 2018 20:16:39 +0000 (UTC) From: Laurent Vivier To: Alexey Kardashevskiy , slof@lists.ozlabs.org Date: Wed, 12 Dec 2018 21:16:32 +0100 Message-Id: <20181212201633.13641-2-lvivier@redhat.com> In-Reply-To: <20181212201633.13641-1-lvivier@redhat.com> References: <20181212201633.13641-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 12 Dec 2018 20:16:41 +0000 (UTC) Subject: [SLOF] [PATCH v3 1/2] usb/storage: Invert the logic of the IF-statements X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" to prepare write implementation Signed-off-by: Laurent Vivier --- slof/fs/usb/dev-storage.fs | 39 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/slof/fs/usb/dev-storage.fs b/slof/fs/usb/dev-storage.fs index 94f8421..a0a0bac 100644 --- a/slof/fs/usb/dev-storage.fs +++ b/slof/fs/usb/dev-storage.fs @@ -107,23 +107,23 @@ scsi-open TO resp-size TO resp-buffer udev USB_PIPE_OUT td-buf td-buf-phys dma-buf-phys usb>cmd 1F - usb-transfer-bulk IF \ transfer CBW - resp-size IF - d# 125 us - udev USB_PIPE_IN td-buf td-buf-phys resp-buffer resp-size - usb-transfer-bulk 1 = not IF \ transfer data - usb-disk-debug? IF ." Data phase failed " cr THEN - \ FALSE EXIT - \ in case of a stall/halted endpoint we clear the halt - \ Fall through and try reading the CSW - THEN - THEN - d# 125 us - udev USB_PIPE_IN td-buf td-buf-phys dma-buf-phys usb>csw 0D - usb-transfer-bulk \ transfer CSW - ELSE - FALSE EXIT + usb-transfer-bulk 0= IF + FALSE EXIT THEN + \ transfer CBW + resp-size IF + d# 125 us + udev USB_PIPE_IN td-buf td-buf-phys resp-buffer resp-size + usb-transfer-bulk 0= IF \ transfer data + usb-disk-debug? IF ." Data phase failed " cr THEN + \ FALSE EXIT + \ in case of a stall/halted endpoint we clear the halt + \ Fall through and try reading the CSW + THEN + THEN + d# 125 us + udev USB_PIPE_IN td-buf td-buf-phys dma-buf-phys usb>csw 0D + usb-transfer-bulk \ transfer CSW ; STRUCT \ cbw @@ -189,12 +189,11 @@ CONSTANT cbw-length \ Send it dma-buf-phys usb>data usb-buf-len - do-bulk-command IF - dma-buf usb>data usb-buf-addr usb-buf-len move - ELSE - ." USB-DISK: Bulk commad failed!" cr + do-bulk-command 0= IF + ." USB-DISK: Bulk command failed!" cr 0 0 -1 EXIT THEN + dma-buf usb>data usb-buf-addr usb-buf-len move dma-buf usb>csw to csw-addr csw-addr csw>sig l@ 55534253 <> IF