changeset 250:d1ca95955562

8136522: Tests for exclusive mode are failed on SPIBus devices Summary: Assign valid busID before device status verification Reviewed-by: alkonsta
author snazarki
date Tue, 15 Sep 2015 12:54:17 +0300
parents 2c895d546686
children 4045c31c14f9
files src/share/linux/native/com/oracle/dio/spibus/spi.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/linux/native/com/oracle/dio/spibus/spi.c	Tue Sep 15 12:49:10 2015 +0300
+++ b/src/share/linux/native/com/oracle/dio/spibus/spi.c	Tue Sep 15 12:54:17 2015 +0300
@@ -273,6 +273,8 @@
         return JAVACALL_DIO_UNSUPPORTED_ACCESS_MODE;
     }
 
+    busId = (busId == PERIPHERAL_CONFIG_DEFAULT) ? DEFAULT_BUS_ID : busId;
+
     if( NULL != get_opened_device(busId, address)){
         return JAVACALL_DIO_BUSY;
     }
@@ -288,8 +290,7 @@
     }
 
     cfg->csActive = csActive;
-    cfg->busId        = (busId == PERIPHERAL_CONFIG_DEFAULT) ?
-                        DEFAULT_BUS_ID : busId;
+    cfg->busId        = busId;
     cfg->address      = address;
     cfg->clkFrequency = (clockFrequency == PERIPHERAL_CONFIG_DEFAULT) ?
                         DEFAULT_CLOCK_FREQUENCY : clockFrequency;