Author: glen
Date: Wed Mar 28 10:44:51 2012
New Revision: 12521

Modified:
   geninitrd/trunk/functions
Log:
no need for subshells, formatting

Modified: geninitrd/trunk/functions
==============================================================================
--- geninitrd/trunk/functions   (original)
+++ geninitrd/trunk/functions   Wed Mar 28 10:44:51 2012
@@ -6,7 +6,7 @@
 #
 # @param       string  $fstab location of /etc/fstab
 # @return      false on failure
-# 
+#
 # Sets global variables:
 # - $rootdev
 # - $rootdev_add
@@ -171,7 +171,7 @@
 # find_modules_by_class 0106 - finds modules for SATA devices in the system
 # find_modules_by_class 0c03 - finds modules for USB controllers
 find_modules_by_class() {
-       if (modprobe --version | grep -q "^kmod"); then
+       if modprobe --version | grep -q "^kmod"; then
                find_modules_by_class_kmod $@
        else
                find_modules_by_class_mit $@
@@ -233,7 +233,7 @@
 
        # no pcimap, nothing to lookup from
        if [ ! -f "$pcimap" ]; then
-                       warn "No $pcimap file. Cannot find modules for desired 
class!"
+               warn "No $pcimap file. Cannot find modules for desired class!"
                return
        fi
 
@@ -242,31 +242,31 @@
        fi
 
        LC_ALL=C lspci -p "$pcimap" -kvmmn | awk -vreq_class="${req_class}" '
-                                       BEGIN      { 
skip_modules[notexisting_module]=""; modules[1]=""; xhci=""; ehci=""; ohci=""; 
uhci="" }
-                                       /^Slot:/   { found=0 }
-                                       /^Class:/  { if (req_class == $2) { 
found=1 } }
-                                       /^Driver:/ { if (found) {
-                                                               module=$2;
-                                                               if (module == 
"xhci_hcd") {
-                                                                       
xhci="xhci_hcd"
-                                                               } else if 
(module == "ehci_hcd") {
-                                                                       
ehci="ehci_hcd"
-                                                               } else if 
(module == "ohci_hcd") {
-                                                                       
ohci="ohci_hcd"
-                                                               } else if 
(module == "uhci_hcd") {
-                                                                       
uhci="uhci_hcd"
-                                                               } else if 
(!(module in skip_modules)) {
-                                                                       
modules[cnt]=module
-                                                               }
-                                                               
skip_modules[module]=1;
-                                                  };
-                                                  found=0
-                                       }
-                                       END { 
-                                                  # xhci/ehci/ohci/uhci hack 
to preserve such order
-                                                  printf "%s %s %s %s ", xhci, 
ehci, ohci, uhci;
-                                                  for (i in modules) { printf 
"%s ", modules[i]; };
-                                       }
+               BEGIN      { skip_modules[notexisting_module]=""; 
modules[1]=""; xhci=""; ehci=""; ohci=""; uhci="" }
+               /^Slot:/   { found=0 }
+               /^Class:/  { if (req_class == $2) { found = 1 } }
+               /^Driver:/ { if (found) {
+                               module = $2;
+                               if (module == "xhci_hcd") {
+                                       xhci = "xhci_hcd"
+                               } else if (module == "ehci_hcd") {
+                                       ehci = "ehci_hcd"
+                               } else if (module == "ohci_hcd") {
+                                       ohci = "ohci_hcd"
+                               } else if (module == "uhci_hcd") {
+                                       uhci = "uhci_hcd"
+                               } else if (!(module in skip_modules)) {
+                                       modules[cnt] = module
+                               }
+                               skip_modules[module] = 1;
+                  }
+                  found=0
+               }
+               END {
+                  # xhci/ehci/ohci/uhci hack to preserve such order
+                  printf "%s %s %s %s ", xhci, ehci, ohci, uhci;
+                  for (i in modules) { printf "%s ", modules[i]; }
+               }
        '
 }
 
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to