SLOF/SOURCES/slof-usb-storage-Invert-the-logic-of-the-IF-statements.patch

89 lines
2.9 KiB
Diff
Raw Normal View History

From 74c062d40d0dcc68816b8bfef6940b8876ca635f Mon Sep 17 00:00:00 2001
From: Laurent Vivier <lvivier@redhat.com>
Date: Thu, 20 Dec 2018 11:33:00 +0000
Subject: [PATCH 2/3] usb/storage: Invert the logic of the IF-statements
RH-Author: Laurent Vivier <lvivier@redhat.com>
Message-id: <20181220113301.29914-2-lvivier@redhat.com>
Patchwork-id: 83707
O-Subject: [RHEL-8.0 SLOF PATCH 1/2] usb/storage: Invert the logic of the IF-statements
Bugzilla: 1654196
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: David Gibson <dgibson@redhat.com>
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
to prepare write implementation
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
(cherry picked from commit 7d72d327e231d8ae9f1e8bce9f20faeaa2278b24)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
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
--
1.8.3.1