pci: Use a separate variable for the bus number

At present in do_pci(), bdf can either mean a bus number or a PCI bus number.
Use separate variables instead to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2015-11-26 19:51:19 -07:00
parent bfa4191e03
commit ca7de76d8c
1 changed files with 3 additions and 3 deletions

View File

@ -408,6 +408,7 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{ {
ulong addr = 0, value = 0, size = 0; ulong addr = 0, value = 0, size = 0;
int busnum = 0;
pci_dev_t bdf = 0; pci_dev_t bdf = 0;
char cmd = 's'; char cmd = 's';
int ret = 0; int ret = 0;
@ -438,16 +439,15 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif #endif
default: /* scan bus */ default: /* scan bus */
value = 1; /* short listing */ value = 1; /* short listing */
bdf = 0; /* bus number */
if (argc > 1) { if (argc > 1) {
if (argv[argc-1][0] == 'l') { if (argv[argc-1][0] == 'l') {
value = 0; value = 0;
argc--; argc--;
} }
if (argc > 1) if (argc > 1)
bdf = simple_strtoul(argv[1], NULL, 16); busnum = simple_strtoul(argv[1], NULL, 16);
} }
pciinfo(bdf, value); pciinfo(busnum, value);
return 0; return 0;
} }