backlight: s6e63m0: use lowercase names of structs
Subsystems (2)
PATCH 1/6 backlight: s6e63m0: use lowercase names of structs
Lowercase names of structs should be used, because they are not preprocessor macros.
--- drivers/video/backlight/s6e63m0.c | 40 ++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 20 deletions(-)
drivers/video/backlight/s6e63m0.c +20 -20
@@ -57,7 +57,7 @@ struct s6e63m0 {struct lcd_platform_data *lcd_pd; }; -static const unsigned short SEQ_PANEL_CONDITION_SET [] = { +static const unsigned short seq_panel_condition_set[] = {0xF8 ,0x01 ,DATA_ONLY ,0x27 ,DATA_ONLY ,0x27 ,
@@ -76,7 +76,7 @@ static const unsigned short SEQ_PANEL_CONDITION_SET[] = {ENDDEF ,0x0000 }; -static const unsigned short SEQ_DISPLAY_CONDITION_SET [] = { +static const unsigned short seq_display_condition_set[] = {0xf2 ,0x02 ,DATA_ONLY ,0x03 , DATA_ONLY, 0x1c,
@@ -90,7 +90,7 @@ static const unsigned short SEQ_DISPLAY_CONDITION_SET[] = {ENDDEF ,0x0000 }; -static const unsigned short SEQ_GAMMA_SETTING [] = { +static const unsigned short seq_gamma_setting[] = {0xfa ,0x00 ,DATA_ONLY ,0x18 , DATA_ONLY, 0x08,
@@ -119,7 +119,7 @@ static const unsigned short SEQ_GAMMA_SETTING[] = {ENDDEF ,0x0000 }; -static const unsigned short SEQ_ETC_CONDITION_SET [] = { +static const unsigned short seq_etc_condition_set[] = {0xf6 ,0x00 ,DATA_ONLY ,0x8c , DATA_ONLY, 0x07,
@@ -318,47 +318,47 @@ static const unsigned short SEQ_ETC_CONDITION_SET[] = {ENDDEF ,0x0000 }; -static const unsigned short SEQ_ACL_ON [] = { +static const unsigned short seq_acl_on[] = {/* ACL on */ 0xc0 ,0x01 ,ENDDEF ,0x0000 }; -static const unsigned short SEQ_ACL_OFF [] = { +static const unsigned short seq_acl_off[] = {/* ACL off */ 0xc0 ,0x00 ,ENDDEF ,0x0000 }; -static const unsigned short SEQ_ELVSS_ON [] = { +static const unsigned short seq_elvss_on[] = {/* ELVSS on */ 0xb1 ,0x0b ,ENDDEF ,0x0000 }; -static const unsigned short SEQ_ELVSS_OFF [] = { +static const unsigned short seq_elvss_off[] = {/* ELVSS off */ 0xb1 ,0x0a ,ENDDEF ,0x0000 }; -static const unsigned short SEQ_STAND_BY_OFF [] = { +static const unsigned short seq_stand_by_off[] = {0x11 ,COMMAND_ONLY ,ENDDEF ,0x0000 }; -static const unsigned short SEQ_STAND_BY_ON [] = { +static const unsigned short seq_stand_by_on[] = {0x10 ,COMMAND_ONLY ,ENDDEF ,0x0000 }; -static const unsigned short SEQ_DISPLAY_ON [] = { +static const unsigned short seq_display_on[] = {0x29 ,COMMAND_ONLY , ENDDEF, 0x0000
@@ -457,12 +457,12 @@ static int s6e63m0_ldi_init(struct s6e63m0 *lcd) {int ret, i;const unsigned short *init_seq[] = { -SEQ_PANEL_CONDITION_SET , -SEQ_DISPLAY_CONDITION_SET , -SEQ_GAMMA_SETTING , -SEQ_ETC_CONDITION_SET , -SEQ_ACL_ON , -SEQ_ELVSS_ON , + seq_panel_condition_set, + seq_display_condition_set, + seq_gamma_setting, + seq_etc_condition_set, + seq_acl_on, + seq_elvss_on, };for (i =0 ; i <ARRAY_SIZE (init_seq); i++) {
@@ -478,8 +478,8 @@ static int s6e63m0_ldi_enable(struct s6e63m0 *lcd) {int ret =0 , i;const unsigned short *enable_seq[] = { -SEQ_STAND_BY_OFF , -SEQ_DISPLAY_ON , + seq_stand_by_off, + seq_display_on, };for (i =0 ; i <ARRAY_SIZE (enable_seq); i++) {
@@ -495,7 +495,7 @@ static int s6e63m0_ldi_disable(struct s6e63m0 *lcd) {int ret; - ret =s6e63m0_panel_send_sequence (lcd,SEQ_STAND_BY_ON ); + ret =s6e63m0_panel_send_sequence (lcd, seq_stand_by_on);return ret; }
Signature · 1 line
1.7.2.5
PATCH 2/6 backlight: s6e63m0: use sleep instead of delay
This patch replaces mdelay with msleep to remove the busy loop waiting.
--- drivers/video/backlight/s6e63m0.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
drivers/video/backlight/s6e63m0.c +6 -5
@@ -406,8 +406,9 @@ static int s6e63m0_panel_send_sequence(struct s6e63m0 *lcd, ret =s6e63m0_spi_write (lcd, wbuf[i], wbuf[i+1 ]);if (ret)break ; - }else -udelay (wbuf[i+1 ]*1000 ); + }else { +msleep (wbuf[i+1 ]); + } i +=2 ; }
@@ -523,7 +524,7 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)return -EFAULT ; }else { pd->power_on (lcd->ld,1 ); -mdelay (pd->power_on_delay); +msleep (pd->power_on_delay); }if (!pd->reset) {
@@ -531,7 +532,7 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)return -EFAULT ; }else { pd->reset (lcd->ld); -mdelay (pd->reset_delay); +msleep (pd->reset_delay); } ret =s6e63m0_ldi_init (lcd);
@@ -573,7 +574,7 @@ static int s6e63m0_power_off(struct s6e63m0 *lcd)return -EIO ; } -mdelay (pd->power_off_delay); +msleep (pd->power_off_delay);if (!pd->power_on) {dev_err (lcd->dev,"power_on is NULL.\n" );
Signature · 1 line
1.7.2.5
PATCH 3/6 backlight: s6e63m0: remove unnecessary NULL deference check
In reply to Jingoo HanThis patch removes unnecessary NULL deference check, because it was already checked in s6e63m0_probe(). Also, POWER_IS_ON is replaced with s6e63m0_power_is_on().
--- drivers/video/backlight/s6e63m0.c | 41 ++++++++++++------------------------ 1 files changed, 14 insertions(+), 27 deletions(-)
drivers/video/backlight/s6e63m0.c +14 -27
@@ -43,8 +43,6 @@#define MIN_BRIGHTNESS 0#define MAX_BRIGHTNESS 10 -#define POWER_IS_ON (pwr) ((pwr) <= FB_BLANK_NORMAL) -struct s6e63m0 {struct device *dev;struct spi_device *spi;
@@ -501,23 +499,19 @@ static int s6e63m0_ldi_disable(struct s6e63m0 *lcd)return ret; } +static int s6e63m0_power_is_on (int power) +{ +return power <=FB_BLANK_NORMAL ; +} +static int s6e63m0_power_on (struct s6e63m0 *lcd) {int ret =0 ; -struct lcd_platform_data *pd =NULL ; -struct backlight_device *bd =NULL ; +struct lcd_platform_data *pd; +struct backlight_device *bd; pd = lcd->lcd_pd; -if (!pd) { -dev_err (lcd->dev,"platform data is NULL.\n" ); -return -EFAULT ; - } - bd = lcd->bd; -if (!bd) { -dev_err (lcd->dev,"backlight device is NULL.\n" ); -return -EFAULT ; - }if (!pd->power_on) {dev_err (lcd->dev,"power_on is NULL.\n" );
@@ -559,14 +553,10 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)static int s6e63m0_power_off (struct s6e63m0 *lcd) { -int ret =0 ; -struct lcd_platform_data *pd =NULL ; +int ret; +struct lcd_platform_data *pd; pd = lcd->lcd_pd; -if (!pd) { -dev_err (lcd->dev,"platform data is NULL.\n" ); -return -EFAULT ; - } ret =s6e63m0_ldi_disable (lcd);if (ret) {
@@ -576,11 +566,7 @@ static int s6e63m0_power_off(struct s6e63m0 *lcd)msleep (pd->power_off_delay); -if (!pd->power_on) { -dev_err (lcd->dev,"power_on is NULL.\n" ); -return -EFAULT ; - }else - pd->power_on (lcd->ld,0 ); + pd->power_on (lcd->ld,0 );return 0 ; }
@@ -589,9 +575,9 @@ static int s6e63m0_power(struct s6e63m0 *lcd, int power) {int ret =0 ; -if (POWER_IS_ON (power) && !POWER_IS_ON (lcd->power)) +if (s6e63m0_power_is_on (power) && !s6e63m0_power_is_on (lcd->power)) ret =s6e63m0_power_on (lcd); -else if (!POWER_IS_ON (power) &&POWER_IS_ON (lcd->power)) +else if (!s6e63m0_power_is_on (power) &&s6e63m0_power_is_on (lcd->power)) ret =s6e63m0_power_off (lcd);if (!ret)
@@ -812,8 +798,9 @@ static int s6e63m0_probe(struct spi_device *spi) lcd->power =FB_BLANK_POWERDOWN ;s6e63m0_power (lcd,FB_BLANK_UNBLANK ); - }else + }else { lcd->power =FB_BLANK_UNBLANK ; + }dev_set_drvdata (&spi->dev, lcd);
Signature · 1 line
1.7.2.5
PATCH 4/6 backlight: s6e63m0: replace EFAULT with EINVAL
In reply to Jingoo HanThis patch replaces EFAULT with EINVAL, because EFAULT tends to be for the invalid memory addresses.
--- drivers/video/backlight/s6e63m0.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/video/backlight/s6e63m0.c +3 -3
@@ -515,7 +515,7 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)if (!pd->power_on) {dev_err (lcd->dev,"power_on is NULL.\n" ); -return -EFAULT ; +return -EINVAL ; }else { pd->power_on (lcd->ld,1 );msleep (pd->power_on_delay);
@@ -523,7 +523,7 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)if (!pd->reset) {dev_err (lcd->dev,"reset is NULL.\n" ); -return -EFAULT ; +return -EINVAL ; }else { pd->reset (lcd->ld);msleep (pd->reset_delay);
@@ -747,7 +747,7 @@ static int s6e63m0_probe(struct spi_device *spi) lcd->lcd_pd = spi->dev.platform_data;if (!lcd->lcd_pd) {dev_err (&spi->dev,"platform data is NULL.\n" ); -return -EFAULT ; +return -EINVAL ; } ld =lcd_device_register ("s6e63m0" , &spi->dev, lcd, &s6e63m0_lcd_ops);
Signature · 1 line
1.7.2.5
PATCH 5/6 backlight: s6e63m0: remove redundant variable 'before_power'
In reply to Jingoo Han'before_power' was used to check the previous status when resume() is called. However, FB_BLANK_POWERDOWN was used in suspend() all the time, so there is no need to check the previous status. Also, redundant return variables are removed to reduce the code.
--- drivers/video/backlight/s6e63m0.c | 24 +++--------------------- 1 files changed, 3 insertions(+), 21 deletions(-)
drivers/video/backlight/s6e63m0.c +3 -21
@@ -827,44 +827,26 @@ static int s6e63m0_remove(struct spi_device *spi) }#if defined(CONFIG_PM ) -static unsigned int before_power; -static int s6e63m0_suspend (struct spi_device *spi,pm_message_t mesg) { -int ret =0 ;struct s6e63m0 *lcd =dev_get_drvdata (&spi->dev);dev_dbg (&spi->dev,"lcd->power = %d\n" , lcd->power); - before_power = lcd->power; -/* * when lcd panel is suspend, lcd panel becomes off * regardless of status. */ - ret =s6e63m0_power (lcd,FB_BLANK_POWERDOWN ); - -return ret; +return s6e63m0_power (lcd,FB_BLANK_POWERDOWN ); }static int s6e63m0_resume (struct spi_device *spi) { -int ret =0 ;struct s6e63m0 *lcd =dev_get_drvdata (&spi->dev); -/* -* after suspended, if lcd panel status is FB_BLANK_UNBLANK -* (at that time, before_power is FB_BLANK_UNBLANK) then -* it changes that status to FB_BLANK_POWERDOWN to get lcd on. -*/ -if (before_power ==FB_BLANK_UNBLANK ) - lcd->power =FB_BLANK_POWERDOWN ; + lcd->power =FB_BLANK_POWERDOWN ; -dev_dbg (&spi->dev,"before_power = %d\n" , before_power); - - ret =s6e63m0_power (lcd, before_power); - -return ret; +return s6e63m0_power (lcd,FB_BLANK_UNBLANK ); }#else #define s6e63m0_suspend NULL
Signature · 1 line
1.7.2.5
PATCH 6/6 backlight: s6e63m0: reorder inclusions of <linux/xxx.h>
In reply to Jingoo HanThis patch reorders inclusions of <linux/xxx.h> for redability, according to alphabetical ordering. Also, unnecessary header comments are removed.
--- drivers/video/backlight/s6e63m0.c | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-)
drivers/video/backlight/s6e63m0.c +5 -14
@@ -9,28 +9,19 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <linux/wait.h> -#include <linux/fb.h> +#include <linux/backlight.h> #include <linux/delay.h> +#include <linux/fb.h> #include <linux/gpio.h> -#include <linux/spi/spi.h> -#include <linux/irq.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/kernel.h> #include <linux/lcd.h> -#include <linux/backlight.h> #include <linux/module.h> +#include <linux/spi/spi.h> +#include <linux/wait.h> #include "s6e63m0_gamma.h"
Signature · 1 line
1.7.2.5