Change names of variables and functions into proper names, according to coding style. Patch upholds compileability by considering dependencies. Co-developed-by: Daniel Bauer <daniel.j.bauer@xxxxxx> Signed-off-by: Daniel Bauer <daniel.j.bauer@xxxxxx> Signed-off-by: Sven Leykauf <sven_leykauf1@xxxxxx> --- drivers/staging/sm750fb/ddk750_dvi.c | 50 +++---- drivers/staging/sm750fb/ddk750_dvi.h | 64 ++++----- drivers/staging/sm750fb/ddk750_sii164.c | 171 ++++++++++++------------ drivers/staging/sm750fb/ddk750_sii164.h | 40 +++--- 4 files changed, 162 insertions(+), 163 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index cd564ea40779..930f56d91474 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -11,41 +11,41 @@ * function API. Please set the function pointer to NULL whenever the function * is not supported. */ -static struct dvi_ctrl_device g_dcftSupportedDviController[] = { +static struct dvi_ctrl_device g_dcft_supported_dvi_controller[] = { #ifdef DVI_CTRL_SII164 { - .pfnInit = sii164InitChip, - .pfnGetVendorId = sii164GetVendorID, - .pfnGetDeviceId = sii164GetDeviceID, + .pfn_init = sii164_init_chip, + .pfn_get_vendor_id = sii164_get_vendor_id, + .pfn_get_device_id = sii164_get_device_id, #ifdef SII164_FULL_FUNCTIONS - .pfnResetChip = sii164ResetChip, - .pfnGetChipString = sii164GetChipString, - .pfnSetPower = sii164SetPower, - .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, - .pfnIsConnected = sii164IsConnected, - .pfnCheckInterrupt = sii164CheckInterrupt, - .pfnClearInterrupt = sii164ClearInterrupt, + .pfn_reset_chip = sii164_reset_chip, + .pfn_get_chip_string = sii164_get_chip_string, + .pfn_set_power = sii164_set_power, + .pfn_enable_hot_plug_detection = sii164_enable_hot_plug_detection, + .pfn_is_connected = sii164_is_connected, + .pfn_check_interrupt = sii164_check_interrupt, + .pfn_clear_interrupt = sii164_clear_interrupt, #endif }, #endif }; -int dviInit(unsigned char edge_select, - unsigned char bus_select, - unsigned char dual_edge_clk_select, - unsigned char hsync_enable, - unsigned char vsync_enable, - unsigned char deskew_enable, - unsigned char deskew_setting, - unsigned char continuous_sync_enable, - unsigned char pll_filter_enable, - unsigned char pll_filter_value) +int dvi_init(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value) { - struct dvi_ctrl_device *pCurrentDviCtrl; + struct dvi_ctrl_device *p_current_dvi_ctrl; - pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl->pfnInit) { - return pCurrentDviCtrl->pfnInit(edge_select, + p_current_dvi_ctrl = g_dcft_supported_dvi_controller; + if (p_current_dvi_ctrl->pfn_init) { + return p_current_dvi_ctrl->pfn_init(edge_select, bus_select, dual_edge_clk_select, hsync_enable, diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h index 1c7a565b617a..d3ea365d1509 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.h +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -4,54 +4,54 @@ /* dvi chip stuffs structros */ -typedef long (*PFN_DVICTRL_INIT)(unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue); +typedef long (*PFN_DVICTRL_INIT)(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value); typedef void (*PFN_DVICTRL_RESETCHIP)(void); typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void); typedef unsigned short (*PFN_DVICTRL_GETVENDORID)(void); typedef unsigned short (*PFN_DVICTRL_GETDEVICEID)(void); -typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char powerUp); -typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enableHotPlug); +typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char power_up); +typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enable_hot_plug); typedef unsigned char (*PFN_DVICTRL_ISCONNECTED)(void); typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); /* Structure to hold all the function pointer to the DVI Controller. */ struct dvi_ctrl_device { - PFN_DVICTRL_INIT pfnInit; - PFN_DVICTRL_RESETCHIP pfnResetChip; - PFN_DVICTRL_GETCHIPSTRING pfnGetChipString; - PFN_DVICTRL_GETVENDORID pfnGetVendorId; - PFN_DVICTRL_GETDEVICEID pfnGetDeviceId; - PFN_DVICTRL_SETPOWER pfnSetPower; - PFN_DVICTRL_HOTPLUGDETECTION pfnEnableHotPlugDetection; - PFN_DVICTRL_ISCONNECTED pfnIsConnected; - PFN_DVICTRL_CHECKINTERRUPT pfnCheckInterrupt; - PFN_DVICTRL_CLEARINTERRUPT pfnClearInterrupt; + PFN_DVICTRL_INIT pfn_init; + PFN_DVICTRL_RESETCHIP pfn_reset_chip; + PFN_DVICTRL_GETCHIPSTRING pfn_get_chip_string; + PFN_DVICTRL_GETVENDORID pfn_get_vendor_id; + PFN_DVICTRL_GETDEVICEID pfn_get_device_id; + PFN_DVICTRL_SETPOWER pfn_set_power; + PFN_DVICTRL_HOTPLUGDETECTION pfn_enable_hot_plug_detection; + PFN_DVICTRL_ISCONNECTED pfn_is_connected; + PFN_DVICTRL_CHECKINTERRUPT pfn_check_interrupt; + PFN_DVICTRL_CLEARINTERRUPT pfn_clear_interrupt; }; #define DVI_CTRL_SII164 /* dvi functions prototype */ -int dviInit(unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue); +int dvi_init(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value); #endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index 73e0e9f41ec5..781eceb2f402 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -12,11 +12,11 @@ #define USE_HW_I2C #ifdef USE_HW_I2C - #define i2cWriteReg sm750_hw_i2c_write_reg - #define i2cReadReg sm750_hw_i2c_read_reg + #define i2c_write_reg sm750_hw_i2c_write_reg + #define i2c_read_reg sm750_hw_i2c_read_reg #else - #define i2cWriteReg sm750_sw_i2c_write_reg - #define i2cReadReg sm750_sw_i2c_read_reg + #define i2c_write_reg sm750_sw_i2c_write_reg + #define i2c_read_reg sm750_sw_i2c_read_reg #endif /* SII164 Vendor and Device ID */ @@ -25,45 +25,45 @@ #ifdef SII164_FULL_FUNCTIONS /* Name of the DVI Controller chip */ -static char *gDviCtrlChipName = "Silicon Image SiI 164"; +static char *g_dvi_ctrl_chip_name = "Silicon Image SiI 164"; #endif /* - * sii164GetVendorID + * sii164_get_vendor_id * This function gets the vendor ID of the DVI controller chip. * * Output: * Vendor ID */ -unsigned short sii164GetVendorID(void) +unsigned short sii164_get_vendor_id(void) { - unsigned short vendorID; + unsigned short vendor_id; - vendorID = ((unsigned short)i2cReadReg(SII164_I2C_ADDRESS, + vendor_id = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | - (unsigned short)i2cReadReg(SII164_I2C_ADDRESS, + (unsigned short)i2c_read_reg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); - return vendorID; + return vendor_id; } /* - * sii164GetDeviceID + * sii164_get_gevice_id * This function gets the device ID of the DVI controller chip. * * Output: * Device ID */ -unsigned short sii164GetDeviceID(void) +unsigned short sii164_get_device_id(void) { - unsigned short deviceID; + unsigned short device_id; - deviceID = ((unsigned short)i2cReadReg(SII164_I2C_ADDRESS, + device_id = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | - (unsigned short)i2cReadReg(SII164_I2C_ADDRESS, + (unsigned short)i2c_read_reg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); - return deviceID; + return device_id; } /* @@ -72,7 +72,7 @@ unsigned short sii164GetDeviceID(void) */ /* - * sii164InitChip + * sii164_init_chip * This function initialize and detect the DVI controller chip. * * Input: @@ -118,16 +118,16 @@ unsigned short sii164GetDeviceID(void) * 0 - Success * -1 - Fail. */ -long sii164InitChip(unsigned char edge_select, - unsigned char bus_select, - unsigned char dual_edge_clk_select, - unsigned char hsync_enable, - unsigned char vsync_enable, - unsigned char deskew_enable, - unsigned char deskew_setting, - unsigned char continuous_sync_enable, - unsigned char pll_filter_enable, - unsigned char pll_filter_value) +long sii164_init_chip(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value) { unsigned char config; @@ -140,8 +140,8 @@ long sii164InitChip(unsigned char edge_select, #endif /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() == SII164_VENDOR_ID) && - (sii164GetDeviceID() == SII164_DEVICE_ID)) { + if ((sii164_get_vendor_id() == SII164_VENDOR_ID) && + (sii164_get_device_id() == SII164_DEVICE_ID)) { /* * Initialize SII164 controller chip. */ @@ -176,7 +176,7 @@ long sii164InitChip(unsigned char edge_select, else config |= SII164_CONFIGURATION_VSYNC_AS_IS; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); /* * De-skew enabled with default 111b value. @@ -214,7 +214,7 @@ long sii164InitChip(unsigned char edge_select, config |= SII164_DESKEW_8_STEP; break; } - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_DESKEW, config); /* Enable/Disable Continuous Sync. */ if (continuous_sync_enable == 0) @@ -231,12 +231,12 @@ long sii164InitChip(unsigned char edge_select, /* Set the PLL Filter value */ config |= ((pll_filter_value & 0x07) << 1); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_PLL, config); /* Recover from Power Down and enable output. */ - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + config = i2c_read_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); return 0; } @@ -250,157 +250,156 @@ long sii164InitChip(unsigned char edge_select, #ifdef SII164_FULL_FUNCTIONS /* - * sii164ResetChip + * sii164_reset_chip * This function resets the DVI Controller Chip. */ -void sii164ResetChip(void) +void sii164_reset_chip(void) { /* Power down */ - sii164SetPower(0); - sii164SetPower(1); + sii164_set_power(0); + sii164_set_power(1); } /* - * sii164GetChipString + * sii164_get_chip_string * This function returns a char string name of the current DVI Controller * chip. * * It's convenient for application need to display the chip name. */ -char *sii164GetChipString(void) +char *sii164_get_chip_string(void) { - return gDviCtrlChipName; + return g_dvi_ctrl_chip_name; } /* - * sii164SetPower + * sii164_set_power * This function sets the power configuration of the DVI Controller Chip. * * Input: - * powerUp - Flag to set the power down or up + * power_up - Flag to set the power down or up */ -void sii164SetPower(unsigned char powerUp) +void sii164_set_power(unsigned char power_up) { unsigned char config; - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp == 1) { + config = i2c_read_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + if (power_up == 1) { /* Power up the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); } else { /* Power down the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_DOWN; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); } } /* - * sii164SelectHotPlugDetectionMode + * sii164_select_hot_plug_detection_mode * This function selects the mode of the hot plug detection. */ -static -void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode) +static void sii164_select_hot_plug_detection_mode(enum sii164_hot_plug_mode hot_plug_mode) { - unsigned char detectReg; + unsigned char detect_reg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & + detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) { + switch (hot_plug_mode) { case SII164_HOTPLUG_DISABLE: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; + detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; break; case SII164_HOTPLUG_USE_MDI: - detectReg &= ~SII164_DETECT_INTERRUPT_MASK; - detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; + detect_reg &= ~SII164_DETECT_INTERRUPT_MASK; + detect_reg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; + detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; break; case SII164_HOTPLUG_USE_RSEN: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; + detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; break; case SII164_HOTPLUG_USE_HTPLG: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; + detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; break; } - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_DETECT, detect_reg); } /* - * sii164EnableHotPlugDetection + * sii164_enable_hot_plug_detection * This function enables the Hot Plug detection. * - * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection + * enable_hot_plug - Enable (=1) / disable (=0) Hot Plug detection */ -void sii164EnableHotPlugDetection(unsigned char enableHotPlug) +void sii164_enable_hot_plug_detection(unsigned char enable_hot_plug) { - unsigned char detectReg; + unsigned char detect_reg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT); /* Depending on each DVI controller, need to enable the hot plug based * on each individual chip design. */ - if (enableHotPlug != 0) - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); + if (enable_hot_plug != 0) + sii164_select_hot_plug_detection_mode(SII164_HOTPLUG_USE_MDI); else - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); + sii164_select_hot_plug_detection_mode(SII164_HOTPLUG_DISABLE); } /* - * sii164IsConnected + * sii164_is_connected * Check if the DVI Monitor is connected. * * Output: * 0 - Not Connected * 1 - Connected */ -unsigned char sii164IsConnected(void) +unsigned char sii164_is_connected(void) { - unsigned char hotPlugValue; + unsigned char hot_plug_value; - hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & + hot_plug_value = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; - if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) + if (hot_plug_value == SII164_DETECT_HOT_PLUG_STATUS_ON) return 1; else return 0; } /* - * sii164CheckInterrupt + * sii164_check_interrupt * Checks if interrupt has occurred. * * Output: * 0 - No interrupt * 1 - Interrupt occurs */ -unsigned char sii164CheckInterrupt(void) +unsigned char sii164_check_interrupt(void) { - unsigned char detectReg; + unsigned char detect_reg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & + detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; - if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) + if (detect_reg == SII164_DETECT_MONITOR_STATE_CHANGE) return 1; else return 0; } /* - * sii164ClearInterrupt + * sii164_clear_interrupt * Clear the hot plug interrupt. */ -void sii164ClearInterrupt(void) +void sii164_clear_interrupt(void) { - unsigned char detectReg; + unsigned char detect_reg; /* Clear the MDI interrupt */ - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, - detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); + detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT); + i2c_write_reg(SII164_I2C_ADDRESS, SII164_DETECT, + detect_reg | SII164_DETECT_MONITOR_STATE_CLEAR); } #endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index d940cb729066..737b0e4869ff 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -16,28 +16,28 @@ enum sii164_hot_plug_mode { }; /* Silicon Image SiI164 chip prototype */ -long sii164InitChip(unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue); - -unsigned short sii164GetVendorID(void); -unsigned short sii164GetDeviceID(void); +long sii164_init_chip(unsigned char edge_select, + unsigned char bus_select, + unsigned char dual_edge_clk_select, + unsigned char hsync_enable, + unsigned char vsync_enable, + unsigned char deskew_enable, + unsigned char deskew_setting, + unsigned char continuous_sync_enable, + unsigned char pll_filter_enable, + unsigned char pll_filter_value); + +unsigned short sii164_get_vendor_id(void); +unsigned short sii164_get_device_id(void); #ifdef SII164_FULL_FUNCTIONS -void sii164ResetChip(void); -char *sii164GetChipString(void); -void sii164SetPower(unsigned char powerUp); -void sii164EnableHotPlugDetection(unsigned char enableHotPlug); -unsigned char sii164IsConnected(void); -unsigned char sii164CheckInterrupt(void); -void sii164ClearInterrupt(void); +void sii164_reset_chip(void); +char *sii164_get_chip_string(void); +void sii164_set_power(unsigned char power_up); +void sii164_enable_hot_plug_detection(unsigned char enable_hot_plug); +unsigned char sii164_is_connected(void); +unsigned char sii164_check_interrupt(void); +void sii164_clear_interrupt(void); #endif /* * below register definition is used for -- 2.20.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel