diff mbox

backlight: s6e63m0: report ->gamma_table_count correctly

Message ID 20130124070524.GD5611@elgon.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Jan. 24, 2013, 7:05 a.m. UTC
gamma_table has 3 arrays which each hold MAX_GAMMA_LEVEL pointers to
int.

The current code sets ->gamma_table_count to 6 on 64bit arches and to 3
on 32 bit arches.  It should be 3 on everything.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is from reading the code.  We use ->gamma_table_count in sysfs file
but other than that I'm not sure what it's for.  I am not very familiar
with this code.

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jingoo Han Jan. 25, 2013, 2:22 a.m. UTC | #1
On Thursday, January 24, 2013 10:45 PM, Dan Carpenter wrote

CC'ed Andrew Morton, Inki Dae.

> 
> gamma_table has 3 arrays which each hold MAX_GAMMA_LEVEL pointers to
> int.
> 
> The current code sets ->gamma_table_count to 6 on 64bit arches and to 3
> on 32 bit arches.  It should be 3 on everything.

Actually, I don't know it is right.
However, it is certain that this panel is currently used on 32 bit arches
such as ARM SoCs.

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is from reading the code.  We use ->gamma_table_count in sysfs file
> but other than that I'm not sure what it's for.  I am not very familiar
> with this code.
> 
> diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
> index 2126b96..9c2677f 100644
> --- a/drivers/video/backlight/s6e63m0.c
> +++ b/drivers/video/backlight/s6e63m0.c
> @@ -766,7 +766,7 @@ static int s6e63m0_probe(struct spi_device *spi)
>  	 * know that.
>  	 */
>  	lcd->gamma_table_count =
> -	    sizeof(gamma_table) / (MAX_GAMMA_LEVEL * sizeof(int));
> +	    sizeof(gamma_table) / (MAX_GAMMA_LEVEL * sizeof(int *));
> 
>  	ret = device_create_file(&(spi->dev), &dev_attr_gamma_mode);
>  	if (ret < 0)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Morton Jan. 30, 2013, 1:01 a.m. UTC | #2
On Fri, 25 Jan 2013 11:22:06 +0900
Jingoo Han <jg1.han@samsung.com> wrote:

> On Thursday, January 24, 2013 10:45 PM, Dan Carpenter wrote
> 
> CC'ed Andrew Morton, Inki Dae.
> 
> > 
> > gamma_table has 3 arrays which each hold MAX_GAMMA_LEVEL pointers to
> > int.
> > 
> > The current code sets ->gamma_table_count to 6 on 64bit arches and to 3
> > on 32 bit arches.  It should be 3 on everything.
> 
> Actually, I don't know it is right.
> However, it is certain that this panel is currently used on 32 bit arches
> such as ARM SoCs.

I don't know what gamma_table_count is supposed to do.  The only place
it is used is in s6e63m0_sysfs_show_gamma_table().  That function
doesn't actually show the table - it just prints out gamme_table_count.
Why is that useful?

Ho hum, the patch is clearly correct - the array stores int*'s and the
sysfs file should display "3" for all architectures.  However I suspect
we could just remove the whole sysfs file and nobody would care...

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
index 2126b96..9c2677f 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -766,7 +766,7 @@  static int s6e63m0_probe(struct spi_device *spi)
 	 * know that.
 	 */
 	lcd->gamma_table_count =
-	    sizeof(gamma_table) / (MAX_GAMMA_LEVEL * sizeof(int));
+	    sizeof(gamma_table) / (MAX_GAMMA_LEVEL * sizeof(int *));
 
 	ret = device_create_file(&(spi->dev), &dev_attr_gamma_mode);
 	if (ret < 0)