1
0
Fork 0

[media] drx-j: make checkpatch.pl happy

Fix the remaining checkpatch.pl compliants at drxj.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
hifive-unleashed-5.1
Mauro Carvalho Chehab 2014-01-17 11:51:52 -03:00
parent c361fda0e5
commit 2f1f733386
7 changed files with 325 additions and 428 deletions

View File

@ -26,28 +26,17 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*******************************************************************************
* FILENAME: $Id: drx_dap_fasi.c,v 1.7 2009/12/28 14:36:21 carlo Exp $
*
* DESCRIPTION:
* Part of DRX driver.
* Data access protocol: Fast Access Sequential Interface (fasi)
* Fast access, because of short addressing format (16 instead of 32 bits addr)
* Sequential, because of I2C.
* These functions know how the chip's memory and registers are to be accessed,
* but nothing more.
*
* These functions should not need adapting to a new platform.
*
* USAGE:
* -
*
* NOTES:
*
*
*******************************************************************************/
DESCRIPTION:
Part of DRX driver.
Data access protocol: Fast Access Sequential Interface (fasi)
Fast access, because of short addressing format (16 instead of 32 bits addr)
Sequential, because of I2C.
These functions know how the chip's memory and registers are to be accessed,
but nothing more.
These functions should not need adapting to a new platform.
*/
#include "drx_dap_fasi.h"
#include "drx_driver.h" /* for drxbsp_hst_memcpy() */
@ -221,9 +210,8 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
u16 overhead_size = 0;
/* Check parameters ******************************************************* */
if (dev_addr == NULL) {
if (dev_addr == NULL)
return -EINVAL;
}
overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) +
(DRXDAP_FASI_LONG_FORMAT(addr) ? 4 : 2);
@ -252,8 +240,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
addr &= ~DRXDAP_FASI_FLAGS;
addr |= flags;
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && \
(DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
/* short format address preferred but long format otherwise */
if (DRXDAP_FASI_LONG_FORMAT(addr)) {
#endif
@ -263,8 +250,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
buf[bufx++] = (u8) ((addr >> 24) & 0xFF);
buf[bufx++] = (u8) ((addr >> 7) & 0xFF);
#endif
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && \
(DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
} else {
#endif
#if (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)
@ -273,8 +259,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
(u8) (((addr >> 16) & 0x0F) |
((addr >> 18) & 0xF0));
#endif
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && \
(DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
}
#endif
@ -332,9 +317,8 @@ static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr,
int rc = -EIO;
#if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1)
if (rdata == NULL) {
if (rdata == NULL)
return -EINVAL;
}
rc = drxdap_fasi_write_reg16(dev_addr, waddr, wdata, DRXDAP_FASI_RMW);
if (rc == 0)
@ -369,9 +353,9 @@ static int drxdap_fasi_read_reg16(struct i2c_device_addr *dev_addr,
u8 buf[sizeof(*data)];
int rc;
if (!data) {
if (!data)
return -EINVAL;
}
rc = drxdap_fasi_read_block(dev_addr, addr, sizeof(*data), buf, flags);
*data = buf[0] + (((u16) buf[1]) << 8);
return rc;
@ -402,9 +386,9 @@ static int drxdap_fasi_read_reg32(struct i2c_device_addr *dev_addr,
u8 buf[sizeof(*data)];
int rc;
if (!data) {
if (!data)
return -EINVAL;
}
rc = drxdap_fasi_read_block(dev_addr, addr, sizeof(*data), buf, flags);
*data = (((u32) buf[0]) << 0) +
(((u32) buf[1]) << 8) +
@ -446,9 +430,8 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
u16 block_size = 0;
/* Check parameters ******************************************************* */
if (dev_addr == NULL) {
if (dev_addr == NULL)
return -EINVAL;
}
overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) +
(DRXDAP_FASI_LONG_FORMAT(addr) ? 4 : 2);
@ -457,9 +440,8 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
((!(DRXDAPFASI_LONG_ADDR_ALLOWED)) &&
DRXDAP_FASI_LONG_FORMAT(addr)) ||
(overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) ||
((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1)) {
((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1))
return -EINVAL;
}
flags &= DRXDAP_FASI_FLAGS;
flags &= ~DRXDAP_FASI_MODEFLAGS;
@ -476,8 +458,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
/* Buffer device address */
addr &= ~DRXDAP_FASI_FLAGS;
addr |= flags;
#if (((DRXDAPFASI_LONG_ADDR_ALLOWED) == 1) && \
((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1))
#if (((DRXDAPFASI_LONG_ADDR_ALLOWED) == 1) && ((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1))
/* short format address preferred but long format otherwise */
if (DRXDAP_FASI_LONG_FORMAT(addr)) {
#endif
@ -487,8 +468,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
buf[bufx++] = (u8) ((addr >> 24) & 0xFF);
buf[bufx++] = (u8) ((addr >> 7) & 0xFF);
#endif
#if (((DRXDAPFASI_LONG_ADDR_ALLOWED) == 1) && \
((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1))
#if (((DRXDAPFASI_LONG_ADDR_ALLOWED) == 1) && ((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1))
} else {
#endif
#if ((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1)
@ -497,8 +477,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
(u8) (((addr >> 16) & 0x0F) |
((addr >> 18) & 0xF0));
#endif
#if (((DRXDAPFASI_LONG_ADDR_ALLOWED) == 1) && \
((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1))
#if (((DRXDAPFASI_LONG_ADDR_ALLOWED) == 1) && ((DRXDAPFASI_SHORT_ADDR_ALLOWED) == 1))
}
#endif

View File

@ -234,10 +234,6 @@
/*-------- Public API functions ----------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
extern struct drx_access_func drx_dap_fasi_funct_g;
#define DRXDAP_FASI_RMW 0x10000000
@ -257,7 +253,4 @@ extern "C" {
#define DRXDAP_FASI_LONG_FORMAT(addr) (((addr) & 0xFC30FF80) != 0)
#define DRXDAP_FASI_OFFSET_TOO_LARGE(addr) (((addr) & 0x00008000) != 0)
#ifdef __cplusplus
}
#endif
#endif /* __DRX_DAP_FASI_H__ */

View File

@ -226,31 +226,25 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked)
/* Start polling loop, checking for lock & timeout */
while (!done_waiting) {
if (drx_ctrl(demod, DRX_CTRL_LOCK_STATUS, &lock_state) !=
0) {
if (drx_ctrl(demod, DRX_CTRL_LOCK_STATUS, &lock_state))
return -EIO;
}
current_time = drxbsp_hst_clock();
timer_value = current_time - start_time_lock_stage;
if (lock_state >= desired_lock_state) {
*is_locked = true;
done_waiting = true;
} /* if ( lock_state >= desired_lock_state ) .. */
else if (lock_state == DRX_NEVER_LOCK) {
} else if (lock_state == DRX_NEVER_LOCK) {
done_waiting = true;
} /* if ( lock_state == DRX_NEVER_LOCK ) .. */
else if (timer_value > timeout_value) {
} else if (timer_value > timeout_value) {
/* lock_state == DRX_NOT_LOCKED and timeout */
done_waiting = true;
} else {
if (drxbsp_hst_sleep(10) != 0) {
if (drxbsp_hst_sleep(10) != 0)
return -EIO;
}
} /* if ( timer_value > timeout_value ) .. */
} /* while */
}
return 0;
}
@ -356,36 +350,30 @@ scan_function_default(void *scan_context,
enum drx_scan_command scan_command,
struct drx_channel *scan_channel, bool *get_next_channel)
{
struct drx_demod_instance *demod = NULL;
int status = -EIO;
struct drx_demod_instance *demod = scan_context;
int status;
bool is_locked = false;
demod = (struct drx_demod_instance *) scan_context;
if (scan_command != DRX_SCAN_COMMAND_NEXT) {
/* just return OK if not doing "scan next" */
if (scan_command != DRX_SCAN_COMMAND_NEXT)
return 0;
}
*get_next_channel = false;
status = drx_ctrl(demod, DRX_CTRL_SET_CHANNEL, scan_channel);
if (status != 0) {
if (status)
return status;
}
status = scan_wait_for_lock(demod, &is_locked);
if (status != 0) {
if (status)
return status;
}
/* done with this channel, move to next one */
*get_next_channel = true;
if (!is_locked) {
/* no channel found */
return -EBUSY;
}
if (!is_locked)
return -EBUSY; /* no channel found */
/* channel found */
return 0;
}
@ -733,23 +721,20 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
bool tuner_slow_mode = false;
/* can't tune without a tuner */
if (demod->my_tuner == NULL) {
if (demod->my_tuner == NULL)
return -EINVAL;
}
common_attr = (struct drx_common_attr *) demod->my_common_attr;
common_attr = demod->my_common_attr;
/* select analog or digital tuner mode based on current standard */
if (drx_ctrl(demod, DRX_CTRL_GET_STANDARD, &standard) != 0) {
if (drx_ctrl(demod, DRX_CTRL_GET_STANDARD, &standard))
return -EIO;
}
if (DRX_ISATVSTD(standard)) {
if (DRX_ISATVSTD(standard))
tuner_mode |= TUNER_MODE_ANALOG;
} else { /* note: also for unknown standard */
else
tuner_mode |= TUNER_MODE_DIGITAL;
}
tuner_mode |= TUNER_MODE_DIGITAL; /* also for unknown standard */
/* select tuner bandwidth */
switch (channel->bandwidth) {
@ -769,22 +754,20 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
tuner_slow_mode = DRX_ATTR_TUNERSLOWMODE(demod);
/* select fast (switch) or slow (lock) tuner mode */
if (tuner_slow_mode) {
if (tuner_slow_mode)
tuner_mode |= TUNER_MODE_LOCK;
} else {
else
tuner_mode |= TUNER_MODE_SWITCH;
}
if (common_attr->tuner_port_nr == 1) {
bool bridge_closed = true;
int status_bridge = -EIO;
status_bridge =
drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &bridge_closed);
if (status_bridge != 0) {
status_bridge = drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE,
&bridge_closed);
if (status_bridge)
return status_bridge;
}
}
status = drxbsp_tuner_set_frequency(demod->my_tuner,
tuner_mode, channel->frequency);
@ -796,24 +779,21 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
status_bridge =
drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &bridge_closed);
if (status_bridge != 0) {
if (status_bridge)
return status_bridge;
}
}
/* now check status of drxbsp_tuner_set_frequency */
if (status != 0) {
if (status)
return status;
}
/* get actual RF and IF frequencies from tuner */
status = drxbsp_tuner_get_frequency(demod->my_tuner,
tuner_mode,
&(channel->frequency),
&(if_frequency));
if (status != 0) {
if (status)
return status;
}
/* update common attributes with information available from this function;
TODO: check if this is required and safe */
@ -839,29 +819,27 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod,
{
u16 i = 0;
if (registers == NULL) {
/* registers not supplied */
return -EINVAL;
}
if (registers == NULL)
return -EINVAL; /* registers not supplied */
/* start dumping registers */
while (registers[i].address != 0) {
while (registers[i].address) {
int status = -EIO;
u16 value = 0;
u32 data = 0;
status =
demod->my_access_funct->read_reg16func(demod->my_i2c_dev_addr,
status = demod->my_access_funct->read_reg16func(demod->my_i2c_dev_addr,
registers[i].address,
&value, 0);
data = (u32) value;
if (status != 0) {
/* no breakouts;
depending on device ID, some HW blocks might not be available */
/*
* On error: no breakouts;
* depending on device ID, some HW blocks might not be available
*/
if (status)
data |= ((u32) status) << 16;
}
registers[i].data = data;
i++;
}
@ -989,9 +967,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
dev_addr = demod->my_i2c_dev_addr;
/* Check arguments */
if ((mc_info == NULL) || (mc_info->mc_data == NULL)) {
if ((mc_info == NULL) || (mc_info->mc_data == NULL))
return -EINVAL;
}
mc_data = mc_info->mc_data;
@ -1001,10 +978,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
mc_nr_of_blks = u_code_read16(mc_data);
mc_data += sizeof(u16);
if ((mc_magic_word != DRX_UCODE_MAGIC_WORD) || (mc_nr_of_blks == 0)) {
/* wrong endianess or wrong data ? */
return -EINVAL;
}
if ((mc_magic_word != DRX_UCODE_MAGIC_WORD) || (mc_nr_of_blks == 0))
return -EINVAL; /* wrong endianess or wrong data ? */
/* Scan microcode blocks first for version info if uploading */
if (action == UCODE_UPLOAD) {
@ -1049,9 +1024,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
It is also valid if no validation control exists.
*/
rc = drx_ctrl(demod, DRX_CTRL_VALIDATE_UCODE, NULL);
if (rc != 0 && rc != -ENOTSUPP) {
if (rc != 0 && rc != -ENOTSUPP)
return rc;
}
/* Restore data pointer */
mc_data = mc_info->mc_data + 2 * sizeof(u16);
@ -1149,9 +1123,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
mc_data_buffer,
bytes_to_compare);
if (result != 0) {
if (result != 0)
return -EIO;
}
curr_addr +=
((dr_xaddr_t)
@ -1205,9 +1178,8 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
int return_status = -EIO;
/* Check arguments */
if (version_list == NULL) {
if (version_list == NULL)
return -EINVAL;
}
/* Get version info list from demod */
return_status = (*(demod->my_demod_funct->ctrl_func)) (demod,
@ -1231,9 +1203,8 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
/* Return version info in "bottom-up" order. This way, multiple
devices can be handled without using malloc. */
struct drx_version_list *current_list_element = demod_version_list;
while (current_list_element->next != NULL) {
while (current_list_element->next != NULL)
current_list_element = current_list_element->next;
}
current_list_element->next = &drx_driver_core_version_list;
*version_list = demod_version_list;

View File

@ -47,10 +47,6 @@
#ifndef __DRX_DRIVER_VERSION__H__
#define __DRX_DRIVER_VERSION__H__ INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _REGISTERTABLE_
#include <registertable.h>
extern register_table_t drx_driver_version[];
@ -69,9 +65,6 @@ extern "C" {
#define VERSION_MINOR 0
#define VERSION_PATCH 56
#ifdef __cplusplus
}
#endif
#endif /* __DRX_DRIVER_VERSION__H__ */
/*
* End of file (drx_driver_version.h)

View File

@ -27,14 +27,10 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file $Id: drxj.h,v 1.132 2009/12/22 12:13:48 danielg Exp $
*
* \brief DRXJ specific header file
*
* \author Dragan Savic, Milos Nikolic, Mihajlo Katona, Tao Ding, Paul Janssen
DRXJ specific header file
Authors: Dragan Savic, Milos Nikolic, Mihajlo Katona, Tao Ding, Paul Janssen
*/
#ifndef __DRXJ_H__
@ -46,10 +42,6 @@ INCLUDES
#include "drx_driver.h"
#include "drx_dap_fasi.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Check DRX-J specific dap condition */
/* Multi master mode and short addr format only will not work.
RMW, CRC reset, broadcast and switching back to single master mode
@ -558,27 +550,6 @@ Access MACROS
#define DRXJ_ATTR_BTSC_DETECT(d) \
(((struct drxj_data *)(d)->my_ext_attr)->aud_data.btsc_detect)
/**
* \brief Actual access macros
* \param d pointer to demod instance
* \param x value to set or to get
*
* SET macros must be used to set the value of an attribute.
* GET macros must be used to retrieve the value of an attribute.
* Depending on the value of DRX_USE_ACCESS_FUNCTIONS the macro's will be
* substituted by "direct-access-inline-code" or a function call.
*
*/
#define DRXJ_GET_BTSC_DETECT(d, x) \
do { \
(x) = DRXJ_ATTR_BTSC_DETECT((d); \
} while (0)
#define DRXJ_SET_BTSC_DETECT(d, x) \
do { \
DRXJ_ATTR_BTSC_DETECT(d) = (x); \
} while (0)
/*-------------------------------------------------------------------------
DEFINES
-------------------------------------------------------------------------*/
@ -706,7 +677,4 @@ Exported GLOBAL VARIABLES
/*-------------------------------------------------------------------------
THE END
-------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* __DRXJ_H__ */

View File

@ -47,10 +47,6 @@
#ifndef __DRXJ_MAP__H__
#define __DRXJ_MAP__H__ INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _REGISTERTABLE_
#include <registertable.h>
extern register_table_t drxj_map[];
@ -15056,7 +15052,4 @@ extern "C" {
#define VSB_EQTAP_RAM_EQTAP_RAM__M 0xFFF
#define VSB_EQTAP_RAM_EQTAP_RAM__PRE 0x0
#ifdef __cplusplus
}
#endif
#endif