[U-Boot] [PATCH 03/14] pci: Use a separate variable for the bus number

Bin Meng bmeng.cn at gmail.com
Fri Nov 13 05:26:26 CET 2015


On Fri, Nov 13, 2015 at 5:45 AM, Simon Glass <sjg at chromium.org> wrote:
> 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 at chromium.org>
> ---
>
>  common/cmd_pci.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/common/cmd_pci.c b/common/cmd_pci.c
> index 5762769..6e28b70 100644
> --- a/common/cmd_pci.c
> +++ b/common/cmd_pci.c
> @@ -407,6 +407,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[])
>  {
>         ulong addr = 0, value = 0, size = 0;
> +       int busnum = 0;
>         pci_dev_t bdf = 0;
>         char cmd = 's';
>         int ret = 0;
> @@ -437,14 +438,13 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  #endif
>         default:                /* scan bus */
>                 value = 1; /* short listing */
> -               bdf = 0;   /* bus number  */
>                 if (argc > 1) {
>                         if (argv[argc-1][0] == 'l') {
>                                 value = 0;
>                                 argc--;
>                         }
>                         if (argc > 1)
> -                               bdf = simple_strtoul(argv[1], NULL, 16);
> +                               busnum = simple_strtoul(argv[1], NULL, 16);
>                 }
>                 cmd = 's';
>                 break;
> @@ -476,7 +476,7 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>                 ret = pci_cfg_modify(bdf, addr, size, value, 1);
>                 break;
>         case 's':
> -               pciinfo(bdf, value);
> +               pciinfo(busnum, value);
>                 break;
>         case 'w':               /* write */
>                 if (argc < 5)
> --

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list