[commit] r2423 - trunk/linux-2.6.x/arch/arm/mach-nds/arm7

Stefan Sperling stsp at stsp.name
Wed Jul 1 13:32:55 CEST 2009


On Wed, Jul 01, 2009 at 11:28:51AM +0200, dslinux_sonny_jim at dslinux.in-berlin.de wrote:
> Author: dslinux_sonny_jim
> Date: Wed Jul  1 11:28:51 2009
> New Revision: 2423
> 
> Log:
> Unstupify DSLite detection

More nitpicking :)

> Modified:
>    trunk/linux-2.6.x/arch/arm/mach-nds/arm7/main.c
> 
> Modified: trunk/linux-2.6.x/arch/arm/mach-nds/arm7/main.c
> ==============================================================================
> --- trunk/linux-2.6.x/arch/arm/mach-nds/arm7/main.c	(original)
> +++ trunk/linux-2.6.x/arch/arm/mach-nds/arm7/main.c	Wed Jul  1 11:28:51 2009
> @@ -18,14 +18,9 @@
>  
>  static struct nds_firmware_block *firmware_block;
>  
> -int DSLiteDetect(void)
> +int isDSLite(void)

This function should return 1 if we're on DSlite, and 0 otherwise.
Else the name is confusing because it's got its boolean meaning
reversed.

>  {
> -	//u32 data;
> -	//data = power_read(POWER_BACKLIGHT);
> -	//data &=  (1<<6);
> -	if (power_read(POWER_BACKLIGHT) & (1<<6)) return 0;//DSLite
> -	else
> -		return 1;
> +	return ((power_read(POWER_BACKLIGHT)) & (1<<6));

So this should read (as Luo said on IRC):

	return !((power_read(POWER_BACKLIGHT)) & (1<<6));
>  }
>  	
>  /* recieve outstanding FIFO commands from ARM9 */
> @@ -64,7 +59,7 @@
>  			cmddata = FIFO_POWER_GET_DATA(data);
>  			switch (cmd) {
>  			case FIFO_POWER_CMD_BACKLIGHT_BRIGHTNESS:
> -					if (DSLiteDetect() == 1) break;
> +					if (isDSLite() == 0) break;

And then this can just say:
					if (isDSLite())
					        break;

Note also the indentation fix, the break should go on its own line.

Stefan

>  					switch (cmddata) {
>  					case 0:
>  						data = power_read(POWER_BACKLIGHT);
> -- 
> dslinux-commit mailing list
> dslinux-commit at dslinux.in-berlin.de
> http://mailman.dslinux.in-berlin.de/mailman/listinfo/dslinux-commit-dslinux.in-berlin.de


More information about the dslinux-devel mailing list