mirror of https://gitee.com/openkylin/linux.git
[media] drx-j: get rid of the remaining drx generic functions
Get rid of drx_open and drx_close, as those are just wrapper functions to drxj_open/drxj_close. Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
dc5a91d49d
commit
b78359a689
|
@ -413,7 +413,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
|
||||||
demod->my_tuner = NULL;
|
demod->my_tuner = NULL;
|
||||||
demod->i2c = i2c;
|
demod->i2c = i2c;
|
||||||
|
|
||||||
result = drx_open(demod);
|
result = drxj_open(demod);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
pr_err("DRX open failed! Aborting\n");
|
pr_err("DRX open failed! Aborting\n");
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -2013,28 +2013,11 @@ struct drx_reg_dump {
|
||||||
|
|
||||||
struct drx_demod_instance;
|
struct drx_demod_instance;
|
||||||
|
|
||||||
typedef int(*drx_open_func_t) (struct drx_demod_instance *demod);
|
|
||||||
typedef int(*drx_close_func_t) (struct drx_demod_instance *demod);
|
|
||||||
typedef int(*drx_ctrl_func_t) (struct drx_demod_instance *demod,
|
|
||||||
u32 ctrl,
|
|
||||||
void *ctrl_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct struct drx_demod_func * \brief A stucture containing all functions of a demodulator.
|
|
||||||
*/
|
|
||||||
struct drx_demod_func {
|
|
||||||
u32 type_id; /**< Device type identifier. */
|
|
||||||
drx_open_func_t open_func; /**< Pointer to Open() function. */
|
|
||||||
drx_close_func_t close_func;/**< Pointer to Close() function. */
|
|
||||||
drx_ctrl_func_t ctrl_func; /**< Pointer to Ctrl() function. */};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct struct drx_demod_instance * \brief Top structure of demodulator instance.
|
* \struct struct drx_demod_instance * \brief Top structure of demodulator instance.
|
||||||
*/
|
*/
|
||||||
struct drx_demod_instance {
|
struct drx_demod_instance {
|
||||||
/* type specific demodulator data */
|
/* type specific demodulator data */
|
||||||
struct drx_demod_func *my_demod_funct;
|
|
||||||
/**< demodulator functions */
|
|
||||||
struct drx_access_func *my_access_funct;
|
struct drx_access_func *my_access_funct;
|
||||||
/**< data access protocol functions */
|
/**< data access protocol functions */
|
||||||
struct tuner_instance *my_tuner;
|
struct tuner_instance *my_tuner;
|
||||||
|
@ -2460,14 +2443,6 @@ Access macros
|
||||||
*/
|
*/
|
||||||
#define DRX_ISDVBTSTD(std) ((std) == DRX_STANDARD_DVBT)
|
#define DRX_ISDVBTSTD(std) ((std) == DRX_STANDARD_DVBT)
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
|
||||||
Exported FUNCTIONS
|
|
||||||
-------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
int drx_open(struct drx_demod_instance *demod);
|
|
||||||
|
|
||||||
int drx_close(struct drx_demod_instance *demod);
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
THE END
|
THE END
|
||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -586,17 +586,6 @@ struct drx_access_func drx_dap_drxj_funct_g = {
|
||||||
drxj_dap_read_modify_write_reg32, /* Not supported */
|
drxj_dap_read_modify_write_reg32, /* Not supported */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* /var DRXJ_Func_g
|
|
||||||
* /brief The driver functions of the drxj
|
|
||||||
*/
|
|
||||||
struct drx_demod_func drxj_functions_g = {
|
|
||||||
DRXJ_TYPE_ID,
|
|
||||||
drxj_open,
|
|
||||||
drxj_close,
|
|
||||||
drxj_ctrl
|
|
||||||
};
|
|
||||||
|
|
||||||
struct drxj_data drxj_data_g = {
|
struct drxj_data drxj_data_g = {
|
||||||
false, /* has_lna : true if LNA (aka PGA) present */
|
false, /* has_lna : true if LNA (aka PGA) present */
|
||||||
false, /* has_oob : true if OOB supported */
|
false, /* has_oob : true if OOB supported */
|
||||||
|
@ -927,7 +916,6 @@ struct drx_common_attr drxj_default_comm_attr_g = {
|
||||||
* \brief Default drxj demodulator instance.
|
* \brief Default drxj demodulator instance.
|
||||||
*/
|
*/
|
||||||
struct drx_demod_instance drxj_default_demod_g = {
|
struct drx_demod_instance drxj_default_demod_g = {
|
||||||
&drxj_functions_g, /* demod functions */
|
|
||||||
&DRXJ_DAP, /* data access protocol functions */
|
&DRXJ_DAP, /* data access protocol functions */
|
||||||
NULL, /* tuner instance */
|
NULL, /* tuner instance */
|
||||||
&drxj_default_addr_g, /* i2c address & device id */
|
&drxj_default_addr_g, /* i2c address & device id */
|
||||||
|
@ -19822,6 +19810,15 @@ int drxj_open(struct drx_demod_instance *demod)
|
||||||
struct drx_cfg_mpeg_output cfg_mpeg_output;
|
struct drx_cfg_mpeg_output cfg_mpeg_output;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
|
if ((demod == NULL) ||
|
||||||
|
(demod->my_common_attr == NULL) ||
|
||||||
|
(demod->my_ext_attr == NULL) ||
|
||||||
|
(demod->my_i2c_dev_addr == NULL) ||
|
||||||
|
(demod->my_common_attr->is_opened)) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check arguments */
|
/* Check arguments */
|
||||||
if (demod->my_ext_attr == NULL)
|
if (demod->my_ext_attr == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -20020,6 +20017,7 @@ int drxj_open(struct drx_demod_instance *demod)
|
||||||
/* refresh the audio data structure with default */
|
/* refresh the audio data structure with default */
|
||||||
ext_attr->aud_data = drxj_default_aud_data_g;
|
ext_attr->aud_data = drxj_default_aud_data_g;
|
||||||
|
|
||||||
|
demod->my_common_attr->is_opened = true;
|
||||||
return 0;
|
return 0;
|
||||||
rw_error:
|
rw_error:
|
||||||
common_attr->is_opened = false;
|
common_attr->is_opened = false;
|
||||||
|
@ -20040,6 +20038,14 @@ int drxj_close(struct drx_demod_instance *demod)
|
||||||
int rc;
|
int rc;
|
||||||
enum drx_power_mode power_mode = DRX_POWER_UP;
|
enum drx_power_mode power_mode = DRX_POWER_UP;
|
||||||
|
|
||||||
|
if ((demod == NULL) ||
|
||||||
|
(demod->my_common_attr == NULL) ||
|
||||||
|
(demod->my_ext_attr == NULL) ||
|
||||||
|
(demod->my_i2c_dev_addr == NULL) ||
|
||||||
|
(!demod->my_common_attr->is_opened)) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* power up */
|
/* power up */
|
||||||
rc = ctrl_power_mode(demod, &power_mode);
|
rc = ctrl_power_mode(demod, &power_mode);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
@ -20084,8 +20090,12 @@ int drxj_close(struct drx_demod_instance *demod)
|
||||||
goto rw_error;
|
goto rw_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DRX_ATTR_ISOPENED(demod) = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
rw_error:
|
rw_error:
|
||||||
|
DRX_ATTR_ISOPENED(demod) = false;
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20578,77 +20588,3 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod,
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*============================================================================*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Exported functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* drx_open - Open a demodulator instance.
|
|
||||||
* @demod: A pointer to a demodulator instance.
|
|
||||||
*
|
|
||||||
* This function returns:
|
|
||||||
* 0: Opened demod instance with succes.
|
|
||||||
* -EIO: Driver not initialized or unable to initialize
|
|
||||||
* demod.
|
|
||||||
* -EINVAL: Demod instance has invalid content.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
int drx_open(struct drx_demod_instance *demod)
|
|
||||||
{
|
|
||||||
int status = 0;
|
|
||||||
|
|
||||||
if ((demod == NULL) ||
|
|
||||||
(demod->my_demod_funct == NULL) ||
|
|
||||||
(demod->my_common_attr == NULL) ||
|
|
||||||
(demod->my_ext_attr == NULL) ||
|
|
||||||
(demod->my_i2c_dev_addr == NULL) ||
|
|
||||||
(demod->my_common_attr->is_opened)) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = (*(demod->my_demod_funct->open_func)) (demod);
|
|
||||||
|
|
||||||
if (status == 0)
|
|
||||||
demod->my_common_attr->is_opened = true;
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*============================================================================*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* drx_close - Close device
|
|
||||||
* @demod: A pointer to a demodulator instance.
|
|
||||||
*
|
|
||||||
* Free resources occupied by device instance.
|
|
||||||
* Put device into sleep mode.
|
|
||||||
*
|
|
||||||
* This function returns:
|
|
||||||
* 0: Closed demod instance with succes.
|
|
||||||
* -EIO: Driver not initialized or error during close
|
|
||||||
* demod.
|
|
||||||
* -EINVAL: Demod instance has invalid content.
|
|
||||||
*/
|
|
||||||
int drx_close(struct drx_demod_instance *demod)
|
|
||||||
{
|
|
||||||
int status = 0;
|
|
||||||
|
|
||||||
if ((demod == NULL) ||
|
|
||||||
(demod->my_demod_funct == NULL) ||
|
|
||||||
(demod->my_common_attr == NULL) ||
|
|
||||||
(demod->my_ext_attr == NULL) ||
|
|
||||||
(demod->my_i2c_dev_addr == NULL) ||
|
|
||||||
(!demod->my_common_attr->is_opened)) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = (*(demod->my_demod_funct->close_func)) (demod);
|
|
||||||
|
|
||||||
DRX_ATTR_ISOPENED(demod) = false;
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue