Hi Simon,

On Fri, Nov 13, 2015 at 5:45 AM, Simon Glass <s...@chromium.org> wrote:
> In the 'pci' command, add a separate variable to hold the PCI device. When
> this code is converted to driver model, this variable will be used to hold a
> struct udevice instead.
>
> Signed-off-by: Simon Glass <s...@chromium.org>
> ---
>
>  common/cmd_pci.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/common/cmd_pci.c b/common/cmd_pci.c
> index 747d6b9..3d09beb 100644
> --- a/common/cmd_pci.c
> +++ b/common/cmd_pci.c
> @@ -442,6 +442,7 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>  {
>         ulong addr = 0, value = 0, cmd_size = 0;
>         enum pci_size_t size;
> +       pci_dev_t dev;
>         int busnum = 0;
>         pci_dev_t bdf = 0;
>         char cmd = 's';
> @@ -482,16 +483,18 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>                         if (argc > 1)
>                                 busnum = simple_strtoul(argv[1], NULL, 16);
>                 }
> -               cmd = 's';
> +               pciinfo(busnum, value);

This looks wrong to me, as patch#1 in this series did the changes to
move "pciinfo" call to the switch..case below.

>                 break;
>         }
>
> +       dev = bdf;
> +
>         switch (cmd) {
>         case 'h':               /* header */
> -               pci_header_show(bdf);
> +               pci_header_show(dev);
>                 break;
>         case 'd':               /* display */
> -               return pci_cfg_display(bdf, addr, size, value);
> +               return pci_cfg_display(dev, addr, size, value);
>  #ifdef CONFIG_CMD_PCI_ENUM
>         case 'e':
>  # ifdef CONFIG_DM_PCI
> @@ -504,20 +507,17 @@ static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>         case 'n':               /* next */
>                 if (argc < 4)
>                         goto usage;
> -               ret = pci_cfg_modify(bdf, addr, size, value, 0);
> +               ret = pci_cfg_modify(dev, addr, size, value, 0);
>                 break;
>         case 'm':               /* modify */
>                 if (argc < 4)
>                         goto usage;
> -               ret = pci_cfg_modify(bdf, addr, size, value, 1);
> -               break;
> -       case 's':
> -               pciinfo(busnum, value);
> +               ret = pci_cfg_modify(dev, addr, size, value, 1);

Ditto.

>                 break;
>         case 'w':               /* write */
>                 if (argc < 5)
>                         goto usage;
> -               ret = pci_cfg_write(bdf, addr, size, value);
> +               ret = pci_cfg_write(dev, addr, size, value);
>                 break;
>         default:
>                 ret = CMD_RET_USAGE;
> --

Regards,
Bin
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to