Remove local keywords and uninitialized variables

Remove keywords such as "let", "typeset", and "local" that
are defined in BASH. Also, clean up any unused variables in
the process.

Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Lisa Nguyen <lisa.nguyen@linaro.org>
diff --git a/thermal/thermal_00.sh b/thermal/thermal_00.sh
index 672b0ff..302858f 100755
--- a/thermal/thermal_00.sh
+++ b/thermal/thermal_00.sh
@@ -29,19 +29,19 @@
 . ../include/thermal_functions.sh
 
 check_cooling_device_type() {
-    local all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
+    all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
     echo "Cooling Device list:"
     for i in $all_zones; do
-	local type=$(cat $THERMAL_PATH/$i/type)
+	type=$(cat $THERMAL_PATH/$i/type)
 	echo "-    $type"
     done
 }
 
 check_thermal_zone_type() {
-    local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+    all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
     echo "Thermal Zone list:"
     for i in $all_zones; do
-	local type=$(cat $THERMAL_PATH/$i/type)
+	type=$(cat $THERMAL_PATH/$i/type)
 	echo "-    $type"
     done
 }
diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh
index 57f64a7..e11c884 100755
--- a/thermal/thermal_01.sh
+++ b/thermal/thermal_01.sh
@@ -32,8 +32,8 @@
 
 check_thermal_zone_attributes() {
 
-    local dirpath=$THERMAL_PATH/$1
-    local zone_name=$1
+    dirpath=$THERMAL_PATH/$1
+    zone_name=$1
     shift 1
     for i in $ATTRIBUTES; do
 	check_file $i $dirpath || return 1
@@ -44,16 +44,16 @@
 
 check_thermal_zone_mode() {
 
-    local dirpath=$THERMAL_PATH/$1
-    local zone_name=$1
+    dirpath=$THERMAL_PATH/$1
+    zone_name=$1
     shift 1
-    local prev_mode=$(cat $dirpath/mode)
+    prev_mode=$(cat $dirpath/mode)
     echo -n enabled > $dirpath/mode
-    local cur_mode=$(cat $dirpath/mode)
+    cur_mode=$(cat $dirpath/mode)
     check "$zone_name cur_mode=$cur_mode"\
 			 "test $cur_mode = enabled" || return 1
     echo -n disabled > $dirpath/mode
-    local cur_mode=$(cat $dirpath/mode)
+    cur_mode=$(cat $dirpath/mode)
     check "$zone_name cur_mode=$cur_mode"\
 			"test $cur_mode = disabled" || return 1
 
@@ -62,7 +62,7 @@
 
 check_thermal_zone_trip_level() {
 
-    local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+    all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
     for i in $all_zones; do
 	for_each_trip_point_of_zone $i "validate_trip_level" || return 1
     done
@@ -70,7 +70,7 @@
 
 check_thermal_zone_bindings() {
 
-    local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+    all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
     for i in $all_zones; do
 	for_each_binding_of_zone $i "validate_trip_bindings" || return 1
     done
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh
index 8105d80..0786870 100755
--- a/thermal/thermal_02.sh
+++ b/thermal/thermal_02.sh
@@ -32,8 +32,8 @@
 
 check_cooling_device_attributes() {
 
-    local dirpath=$THERMAL_PATH/$1
-    local cdev_name=$1
+    dirpath=$THERMAL_PATH/$1
+    cdev_name=$1
     shift 1
 
     for i in $CDEV_ATTRIBUTES; do
@@ -43,13 +43,13 @@
 }
 
 check_cooling_device_states() {
-    local dirpath=$THERMAL_PATH/$1
-    local cdev_name=$1
+    dirpath=$THERMAL_PATH/$1
+    cdev_name=$1
     shift 1
-    local max_state=$(cat $dirpath/max_state)
-    local prev_state_val=$(cat $dirpath/cur_state)
-    local count=0
-    local cur_state_val=0
+    max_state=$(cat $dirpath/max_state)
+    prev_state_val=$(cat $dirpath/cur_state)
+    count=0
+    cur_state_val=0
     while (test $count -le $max_state); do
 	echo $count > $dirpath/cur_state
 	cur_state_val=$(cat $dirpath/cur_state)
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index 42082f0..9704b74 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -39,11 +39,11 @@
 }
 
 check_temperature_change() {
-    local dirpath=$THERMAL_PATH/$1
-    local zone_name=$1
+    dirpath=$THERMAL_PATH/$1
+    zone_name=$1
     shift 1
 
-    local init_temp=$(cat $dirpath/temp)
+    init_temp=$(cat $dirpath/temp)
     $CPU_HEAT_BIN &
     cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
     test -z $cpu_pid && cpu_pid=0
@@ -53,7 +53,7 @@
     start_glmark2
 
     sleep 5
-    local final_temp=$(cat $dirpath/temp)
+    final_temp=$(cat $dirpath/temp)
     heater_kill
     check "temperature variation with load" "test $final_temp -gt $init_temp"
 }
diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh
index 932903c..37c65f6 100755
--- a/thermal/thermal_04.sh
+++ b/thermal/thermal_04.sh
@@ -37,23 +37,23 @@
 }
 
 verify_cooling_device_temp_change() {
-    local dirpath=$THERMAL_PATH/$1
-    local cdev_name=$1
+    dirpath=$THERMAL_PATH/$1
+    cdev_name=$1
     shift 1
-    local tzonepath=$THERMAL_PATH/thermal_zone0
+    tzonepath=$THERMAL_PATH/thermal_zone0
     test -d $tzonepath
     if [ $? -ne 0 ] ; then
 	echo "No thermal zone present"
 	return 1;
     fi
-    local max_state=$(cat $dirpath/max_state)
-    local prev_state_val=$(cat $dirpath/cur_state)
+    max_state=$(cat $dirpath/max_state)
+    prev_state_val=$(cat $dirpath/cur_state)
 
-    local count=1
-    local cur_state_val=0
-    local init_temp=0
-    local final_temp=0
-    local cool_temp=0
+    count=1
+    cur_state_val=0
+    init_temp=0
+    final_temp=0
+    cool_temp=0
     ./$HEAT_CPU_MODERATE moderate &
     pid=$!
     test $pid -eq 0 && return
diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh
index 68c44d3..2e7f080 100755
--- a/thermal/thermal_05.sh
+++ b/thermal/thermal_05.sh
@@ -29,25 +29,25 @@
 . ../include/thermal_functions.sh
 
 verify_cpufreq_cooling_device_action() {
-    local dirpath=$THERMAL_PATH/$1
-    local cdev_name=$1
+    dirpath=$THERMAL_PATH/$1
+    cdev_name=$1
     shift 1
 
-    local cpufreq_cdev=$(cat $dirpath/type)
+    cpufreq_cdev=$(cat $dirpath/type)
     cat $dirpath/type | grep cpufreq
     if [ $? -ne 0  ] ; then
         log_skip "Cannot find cpufreq in $cdev_name..."
 	    return 0
     fi
 
-    local max_state=$(cat $dirpath/max_state)
-    local prev_state_val=$(cat $dirpath/cur_state)
+    max_state=$(cat $dirpath/max_state)
+    prev_state_val=$(cat $dirpath/cur_state)
     disable_all_thermal_zones
 
-    local count=1
-    local before_scale_max=0
-    local after_scale_max=0
-    local change=0
+    count=1
+    before_scale_max=0
+    after_scale_max=0
+    change=0
 
     while (test $count -le $max_state); do
 	echo 0 > $dirpath/cur_state
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index 978a526..2929605 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -45,17 +45,15 @@
 }
 
 check_trip_point_change() {
-    local dirpath=$THERMAL_PATH/$1
-    local zone_name=$1
+    dirpath=$THERMAL_PATH/$1
+    zone_name=$1
     shift 1
 
-    local count=0
-    local cur_temp=0
-    local trip_temp=0
-    local trip_cross=
-    local trip_id=
-    local trip_type=0
-    local trip_type_path=0
+    count=0
+    cur_temp=0
+    trip_temp=0
+    trip_type=0
+    trip_type_path=0
     $CPU_HEAT_BIN &
     cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
     test -z $cpu_pid && cpu_pid=0
@@ -64,7 +62,7 @@
 
     start_glmark2
 
-    local index=0
+    index=0
     for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do
 	trip_cross[$index]=0
 	index=$((index + 1))