diff mbox

[i-g-t,2/2] tools/intel_reg: Print the potential port names in the help text

Message ID 87pp1qlgi6.fsf@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Sept. 10, 2015, 10:23 a.m. UTC
On Wed, 09 Sep 2015, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Both LGTM, though I'd apply this paint on the 2nd patch:




BR,
Jani.


> ---
>  tools/intel_reg.c      | 2 ++
>  tools/intel_reg_spec.c | 9 +++++++++
>  tools/intel_reg_spec.h | 1 +
>  3 files changed, 12 insertions(+)
>
> diff --git a/tools/intel_reg.c b/tools/intel_reg.c
> index fb3461f..26f908f 100644
> --- a/tools/intel_reg.c
> +++ b/tools/intel_reg.c
> @@ -629,6 +629,8 @@ static int intel_reg_help(struct config *config, int argc, char *argv[])
>  	printf("\n");
>  	printf("REGISTER is defined as:\n");
>          printf("  [(PORTNAME|PORTNUM|MMIO-OFFSET):](REGNAME|REGADDR)\n");
> +	printf("PORTNAME is one of: ");
> +	intel_reg_spec_print_ports();
>  
>  	printf("\n");
>  	printf("OPTIONS common to most COMMANDS:\n");
> diff --git a/tools/intel_reg_spec.c b/tools/intel_reg_spec.c
> index b49e0dc..babc13c 100644
> --- a/tools/intel_reg_spec.c
> +++ b/tools/intel_reg_spec.c
> @@ -343,3 +343,12 @@ void intel_reg_spec_free(struct reg *regs, size_t n)
>  	}
>  	free(regs);
>  }
> +
> +void intel_reg_spec_print_ports(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(port_descs); i++)
> +		printf(" %s%c", port_descs[i].name,
> +		       i == ARRAY_SIZE(port_descs) - 1 ? '\n' : ',');
> +}
> diff --git a/tools/intel_reg_spec.h b/tools/intel_reg_spec.h
> index 26e8252..dcb3143 100644
> --- a/tools/intel_reg_spec.h
> +++ b/tools/intel_reg_spec.h
> @@ -73,5 +73,6 @@ ssize_t intel_reg_spec_file(struct reg **regs, const char *filename);
>  void intel_reg_spec_free(struct reg *regs, size_t n);
>  int intel_reg_spec_decode(char *buf, size_t bufsize, const struct reg *reg,
>  			  uint32_t val, uint32_t devid);
> +void intel_reg_spec_print_ports(void);
>  
>  #endif /* __INTEL_REG_SPEC_H__ */
> -- 
> 2.4.6
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index 26f908fa5c01..e4c0fcdc109f 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -629,8 +629,11 @@  static int intel_reg_help(struct config *config, int argc, char *argv[])
 	printf("\n");
 	printf("REGISTER is defined as:\n");
         printf("  [(PORTNAME|PORTNUM|MMIO-OFFSET):](REGNAME|REGADDR)\n");
-	printf("PORTNAME is one of: ");
+
+	printf("\n");
+	printf("PORTNAME is one of:\n  ");
 	intel_reg_spec_print_ports();
+	printf("\n");
 
 	printf("\n");
 	printf("OPTIONS common to most COMMANDS:\n");
diff --git a/tools/intel_reg_spec.c b/tools/intel_reg_spec.c
index b1eddbd1fd90..e46f4bea19b5 100644
--- a/tools/intel_reg_spec.c
+++ b/tools/intel_reg_spec.c
@@ -349,6 +349,5 @@  void intel_reg_spec_print_ports(void)
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(port_descs); i++)
-		printf(" %s%c", port_descs[i].name,
-		       i == ARRAY_SIZE(port_descs) - 1 ? '\n' : ',');
+		printf("%s%s", i == 0 ? "" : ", ", port_descs[i].name);
 }