Re: [[PATCH flasher] 2/6] Separate out validation of config name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 12, 2013 at 05:30:03PM -0600, Stephen Warren wrote:
[...]
> diff --git a/tegra-uboot-flasher b/tegra-uboot-flasher
> index 447ff37..ef73e2f 100755
> --- a/tegra-uboot-flasher
> +++ b/tegra-uboot-flasher
> @@ -75,6 +75,17 @@ gen_flashcmds = {
>      'spi': gen_flashcmd_spi,
>  }
>  
> +def find_config_dir():
> +    if not configs.has_key(args.configname):
> +        print 'Unknown config "%s"' % args.configname
> +        sys.exit(1)
> +
> +    global boardname, socname, out_board_dir

Python supports returning touples, so maybe globals can be avoided here?

> +
> +    boardname = configs[args.configname]['board']
> +    socname = boards[boardname]['soc']
> +    out_board_dir = os.path.join(args.data_dir, boardname)
> +
>  parser = argparse.ArgumentParser(description='Write an image to a Tegra board\'s flash')
>  parser.add_argument('--debug', action='store_true',
>                     help='Turn on debugging prints')
> @@ -122,14 +133,7 @@ if args.list_confignames:
>          print configname
>      sys.exit(0)
>  
> -if not configs.has_key(args.configname):
> -    print 'Unknown config "%s"' % args.configname
> -    sys.exit(1)
> -
> -boardname = configs[args.configname]['board']
> -socname = boards[boardname]['soc']
> -
> -out_board_dir = os.path.join(args.data_dir, boardname)
> +find_config_dir()

So this'll turn into something like:

	boardname, socname, out_board_dir = find_config_dir()

Thierry

Attachment: pgpTtkiO_ad3g.pgp
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux