1 |
robbat2 08/10/08 21:04:16 |
2 |
|
3 |
Modified: init.d-pciparm |
4 |
Log: |
5 |
Simplify pciparm init code based partially on old suggestions from Uberlord and also from SteveL, causes no changes in end result. |
6 |
(Portage version: 2.2_rc11/cvs/Linux 2.6.27-rc1-10246-gca5de40 x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.2 sys-apps/pciutils/files/init.d-pciparm |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm?rev=1.2&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm?rev=1.2&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm?r1=1.1&r2=1.2 |
14 |
|
15 |
Index: init.d-pciparm |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v |
18 |
retrieving revision 1.1 |
19 |
retrieving revision 1.2 |
20 |
diff -p -w -b -B -u -u -r1.1 -r1.2 |
21 |
--- init.d-pciparm 7 Oct 2008 11:07:09 -0000 1.1 |
22 |
+++ init.d-pciparm 8 Oct 2008 21:04:16 -0000 1.2 |
23 |
@@ -1,7 +1,7 @@ |
24 |
#!/sbin/runscript |
25 |
# Copyright 1999-2004 Gentoo Foundation |
26 |
# Distributed under the terms of the GNU General Public License v2 |
27 |
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v 1.1 2008/10/07 11:07:09 robbat2 Exp $ |
28 |
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/files/init.d-pciparm,v 1.2 2008/10/08 21:04:16 robbat2 Exp $ |
29 |
|
30 |
depend() { |
31 |
before bootmisc hdparm |
32 |
@@ -46,6 +46,18 @@ do_setpci() { |
33 |
SPEC_ID="" |
34 |
} |
35 |
|
36 |
+do_setpci_array() { |
37 |
+ name=$1 |
38 |
+ shift |
39 |
+ i=0 |
40 |
+ while true; do |
41 |
+ eval opt="\$${name}_$i" |
42 |
+ [[ -z "$opt" ]] && break |
43 |
+ do_setpci "$*" $opt |
44 |
+ i=$(($i+1)) |
45 |
+ done |
46 |
+} |
47 |
+ |
48 |
start() { |
49 |
if get_bootparam "nopciparm" ; then |
50 |
ewarn "Skipping pciparm init as requested in kernel cmdline" |
51 |
@@ -54,23 +66,9 @@ start() { |
52 |
|
53 |
checkconfig || return 1 |
54 |
|
55 |
- if [ -n "$PCIPARM_ALL" ]; then |
56 |
+ [[ -n "$PCIPARM_ALL" ]] && \ |
57 |
do_setpci -d '*:*' $PCIPARM_ALL |
58 |
- fi |
59 |
|
60 |
- SEQ_BUS=0 |
61 |
- while true; do |
62 |
- BUS_OPT=`eval echo '$'PCIPARM_BUS_${SEQ_BUS}` |
63 |
- [[ -z "$BUS_OPT" ]] && break |
64 |
- do_setpci -s $BUS_OPT |
65 |
- SEQ_BUS=$(($SEQ_BUS+1)) |
66 |
- done |
67 |
- |
68 |
- SEQ_VENDOR=0 |
69 |
- while true; do |
70 |
- VENDOR_OPT=`eval echo '$'PCIPARM_VENDOR_${SEQ_VENDOR}` |
71 |
- [[ -z "$VENDOR_OPT" ]] && break |
72 |
- do_setpci -d $VENDOR_OPT |
73 |
- SEQ_VENDOR=$(($SEQ_VENDOR+1)) |
74 |
- done |
75 |
+ do_setpci_array PCIPARM_BUS -s |
76 |
+ do_setpci_array PCIPARM_VENDOR -d |
77 |
} |