viafb: replace custom return values

This patch replaces OK/FAIL by true/false which is simpler and saner.
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent 7f980a06
...@@ -30,12 +30,9 @@ static void __devinit dvi_get_panel_size_from_DDCv1( ...@@ -30,12 +30,9 @@ static void __devinit dvi_get_panel_size_from_DDCv1(
struct tmds_setting_information *tmds_setting); struct tmds_setting_information *tmds_setting);
static int viafb_dvi_query_EDID(void); static int viafb_dvi_query_EDID(void);
static int check_tmds_chip(int device_id_subaddr, int device_id) static inline bool check_tmds_chip(int device_id_subaddr, int device_id)
{ {
if (tmds_register_read(device_id_subaddr) == device_id) return tmds_register_read(device_id_subaddr) == device_id;
return OK;
else
return FAIL;
} }
void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip, void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
...@@ -50,7 +47,7 @@ void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip, ...@@ -50,7 +47,7 @@ void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
return; return;
} }
int __devinit viafb_tmds_trasmitter_identify(void) bool __devinit viafb_tmds_trasmitter_identify(void)
{ {
unsigned char sr2a = 0, sr1e = 0, sr3e = 0; unsigned char sr2a = 0, sr1e = 0, sr3e = 0;
...@@ -89,7 +86,7 @@ int __devinit viafb_tmds_trasmitter_identify(void) ...@@ -89,7 +86,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
viaparinfo->chip_info-> viaparinfo->chip_info->
tmds_chip_info.tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR; tmds_chip_info.tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR;
viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_31; viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_31;
if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID) != FAIL) { if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)) {
/* /*
* Currently only support 12bits,dual edge,add 24bits mode later * Currently only support 12bits,dual edge,add 24bits mode later
*/ */
...@@ -100,11 +97,10 @@ int __devinit viafb_tmds_trasmitter_identify(void) ...@@ -100,11 +97,10 @@ int __devinit viafb_tmds_trasmitter_identify(void)
viaparinfo->chip_info->tmds_chip_info.tmds_chip_name); viaparinfo->chip_info->tmds_chip_info.tmds_chip_name);
DEBUG_MSG(KERN_INFO "\n %2d", DEBUG_MSG(KERN_INFO "\n %2d",
viaparinfo->chip_info->tmds_chip_info.i2c_port); viaparinfo->chip_info->tmds_chip_info.i2c_port);
return OK; return true;
} else { } else {
viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_2C; viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_2C;
if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID) if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)) {
!= FAIL) {
tmds_register_write(0x08, 0x3b); tmds_register_write(0x08, 0x3b);
DEBUG_MSG(KERN_INFO "\n VT1632 TMDS ! \n"); DEBUG_MSG(KERN_INFO "\n VT1632 TMDS ! \n");
DEBUG_MSG(KERN_INFO "\n %2d", DEBUG_MSG(KERN_INFO "\n %2d",
...@@ -113,7 +109,7 @@ int __devinit viafb_tmds_trasmitter_identify(void) ...@@ -113,7 +109,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
DEBUG_MSG(KERN_INFO "\n %2d", DEBUG_MSG(KERN_INFO "\n %2d",
viaparinfo->chip_info-> viaparinfo->chip_info->
tmds_chip_info.i2c_port); tmds_chip_info.i2c_port);
return OK; return true;
} }
} }
...@@ -123,7 +119,7 @@ int __devinit viafb_tmds_trasmitter_identify(void) ...@@ -123,7 +119,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
((viafb_display_hardware_layout == HW_LAYOUT_DVI_ONLY) || ((viafb_display_hardware_layout == HW_LAYOUT_DVI_ONLY) ||
(viafb_display_hardware_layout == HW_LAYOUT_LCD_DVI))) { (viafb_display_hardware_layout == HW_LAYOUT_LCD_DVI))) {
DEBUG_MSG(KERN_INFO "\n Integrated TMDS ! \n"); DEBUG_MSG(KERN_INFO "\n Integrated TMDS ! \n");
return OK; return true;
} }
switch (viaparinfo->chip_info->gfx_chip_name) { switch (viaparinfo->chip_info->gfx_chip_name) {
...@@ -147,7 +143,7 @@ int __devinit viafb_tmds_trasmitter_identify(void) ...@@ -147,7 +143,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
tmds_chip_info.tmds_chip_name = NON_TMDS_TRANSMITTER; tmds_chip_info.tmds_chip_name = NON_TMDS_TRANSMITTER;
viaparinfo->chip_info->tmds_chip_info. viaparinfo->chip_info->tmds_chip_info.
tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR; tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR;
return FAIL; return false;
} }
static void tmds_register_write(int index, u8 data) static void tmds_register_write(int index, u8 data)
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
int viafb_dvi_sense(void); int viafb_dvi_sense(void);
void viafb_dvi_disable(void); void viafb_dvi_disable(void);
void viafb_dvi_enable(void); void viafb_dvi_enable(void);
int __devinit viafb_tmds_trasmitter_identify(void); bool __devinit viafb_tmds_trasmitter_identify(void);
void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip, void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting); struct tmds_setting_information *tmds_setting);
void viafb_dvi_set_mode(struct VideoModeTable *videoMode, int mode_bpp, void viafb_dvi_set_mode(struct VideoModeTable *videoMode, int mode_bpp,
......
...@@ -48,7 +48,6 @@ static struct _lcd_scaling_factor lcd_scaling_factor_CLE = { ...@@ -48,7 +48,6 @@ static struct _lcd_scaling_factor lcd_scaling_factor_CLE = {
{LCD_VER_SCALING_FACTOR_REG_NUM_CLE, {{CR78, 0, 7}, {CR79, 6, 7} } } {LCD_VER_SCALING_FACTOR_REG_NUM_CLE, {{CR78, 0, 7}, {CR79, 6, 7} } }
}; };
static int check_lvds_chip(int device_id_subaddr, int device_id);
static bool lvds_identify_integratedlvds(void); static bool lvds_identify_integratedlvds(void);
static void __devinit fp_id_to_vindex(int panel_id); static void __devinit fp_id_to_vindex(int panel_id);
static int lvds_register_read(int index); static int lvds_register_read(int index);
...@@ -84,12 +83,9 @@ static struct display_timing lcd_centering_timging(struct display_timing ...@@ -84,12 +83,9 @@ static struct display_timing lcd_centering_timging(struct display_timing
mode_crt_reg, mode_crt_reg,
struct display_timing panel_crt_reg); struct display_timing panel_crt_reg);
static int check_lvds_chip(int device_id_subaddr, int device_id) static inline bool check_lvds_chip(int device_id_subaddr, int device_id)
{ {
if (lvds_register_read(device_id_subaddr) == device_id) return lvds_register_read(device_id_subaddr) == device_id;
return OK;
else
return FAIL;
} }
void __devinit viafb_init_lcd_size(void) void __devinit viafb_init_lcd_size(void)
...@@ -150,7 +146,7 @@ static bool lvds_identify_integratedlvds(void) ...@@ -150,7 +146,7 @@ static bool lvds_identify_integratedlvds(void)
return true; return true;
} }
int __devinit viafb_lvds_trasmitter_identify(void) bool __devinit viafb_lvds_trasmitter_identify(void)
{ {
if (viafb_lvds_identify_vt1636(VIA_PORT_31)) { if (viafb_lvds_identify_vt1636(VIA_PORT_31)) {
viaparinfo->chip_info->lvds_chip_info.i2c_port = VIA_PORT_31; viaparinfo->chip_info->lvds_chip_info.i2c_port = VIA_PORT_31;
...@@ -175,20 +171,20 @@ int __devinit viafb_lvds_trasmitter_identify(void) ...@@ -175,20 +171,20 @@ int __devinit viafb_lvds_trasmitter_identify(void)
viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr = viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr =
VT1631_LVDS_I2C_ADDR; VT1631_LVDS_I2C_ADDR;
if (check_lvds_chip(VT1631_DEVICE_ID_REG, VT1631_DEVICE_ID) != FAIL) { if (check_lvds_chip(VT1631_DEVICE_ID_REG, VT1631_DEVICE_ID)) {
DEBUG_MSG(KERN_INFO "\n VT1631 LVDS ! \n"); DEBUG_MSG(KERN_INFO "\n VT1631 LVDS ! \n");
DEBUG_MSG(KERN_INFO "\n %2d", DEBUG_MSG(KERN_INFO "\n %2d",
viaparinfo->chip_info->lvds_chip_info.lvds_chip_name); viaparinfo->chip_info->lvds_chip_info.lvds_chip_name);
DEBUG_MSG(KERN_INFO "\n %2d", DEBUG_MSG(KERN_INFO "\n %2d",
viaparinfo->chip_info->lvds_chip_info.lvds_chip_name); viaparinfo->chip_info->lvds_chip_info.lvds_chip_name);
return OK; return true;
} }
viaparinfo->chip_info->lvds_chip_info.lvds_chip_name = viaparinfo->chip_info->lvds_chip_info.lvds_chip_name =
NON_LVDS_TRANSMITTER; NON_LVDS_TRANSMITTER;
viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr = viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr =
VT1631_LVDS_I2C_ADDR; VT1631_LVDS_I2C_ADDR;
return FAIL; return false;
} }
static void __devinit fp_id_to_vindex(int panel_id) static void __devinit fp_id_to_vindex(int panel_id)
......
...@@ -79,7 +79,7 @@ void __devinit viafb_init_lvds_output_interface(struct lvds_chip_information ...@@ -79,7 +79,7 @@ void __devinit viafb_init_lvds_output_interface(struct lvds_chip_information
void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table, void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table,
struct lvds_setting_information *plvds_setting_info, struct lvds_setting_information *plvds_setting_info,
struct lvds_chip_information *plvds_chip_info); struct lvds_chip_information *plvds_chip_info);
int __devinit viafb_lvds_trasmitter_identify(void); bool __devinit viafb_lvds_trasmitter_identify(void);
void viafb_init_lvds_output_interface(struct lvds_chip_information void viafb_init_lvds_output_interface(struct lvds_chip_information
*plvds_chip_info, *plvds_chip_info,
struct lvds_setting_information struct lvds_setting_information
......
...@@ -22,14 +22,6 @@ ...@@ -22,14 +22,6 @@
#ifndef __SHARE_H__ #ifndef __SHARE_H__
#define __SHARE_H__ #define __SHARE_H__
/* Define Return Value */
#define FAIL -1
#define OK 1
#ifndef NULL
#define NULL 0
#endif
/* Define Bit Field */ /* Define Bit Field */
#define BIT0 0x01 #define BIT0 0x01
#define BIT1 0x02 #define BIT1 0x02
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment