[PATCH radeontool 3/5] Only print current status in usage() if we are root

Jonathan Nieder jrnieder at gmail.com
Fri Dec 2 14:51:01 PST 2011


Tormod Volden wrote:

> [Subject: Only print current status in usage() if we are root]
[...]
> --- a/radeontool.c
> +++ b/radeontool.c
[...]
> @@ -141,13 +143,24 @@ static void radeon_set_mcind(unsigned long offset, const char *name,
>  
>  static void usage(void)
>  {
> +    const char *dac_status = "unknown";
> +    const char *light_status = "unknown";
> +
> +    if (geteuid() == 0) {
> +	if (radeon_cntl_mem == NULL)
> +		map_radeon_cntl_mem();
> +	dac_status = (radeon_get(RADEON_DAC_CNTL, "RADEON_DAC_CNTL")
> +		      & RADEON_DAC_PDWN) ? "off" : "on";
> +	light_status = (radeon_get(RADEON_LVDS_GEN_CNTL, "RADEON_LVDS_GEN_CNTL")
> +		        & RADEON_LVDS_ON) ? "on" : "off";
> +    }

Whitespace damaged.

Maybe it would make sense to tweak the map_radeon_cntl_mem() API to
allow callers to decide whether to ignore errors, and use that.  But
that can come later --- this patch makes a nice improvement already in
avoiding confusion when a person first runs "radeontool -h".

So for what it's worth, once the whitespace is fixed,
Reviewed-by: Jonathan Nieder <jrnieder at gmail.com>


More information about the xorg-driver-ati mailing list