6M, 7M or 8M */
int need_load_generic; /* The generic firmware
were loaded? */
-
- int max_len; /* Max firmware chunk */
-
enum tuner_mode mode;
struct i2c_client *i2c_client;
{
struct xc2028_data *priv = fe->tuner_priv;
int pos, rc;
- unsigned char *p, *endp, buf[priv->max_len];
+ unsigned char *p, *endp, buf[priv->ctrl.max_len];
tuner_dbg("%s called\n", __FUNCTION__);
/* Sends message chunks */
while (size > 0) {
- int len = (size < priv->max_len - 1) ?
- size : priv->max_len - 1;
+ int len = (size < priv->ctrl.max_len - 1) ?
+ size : priv->ctrl.max_len - 1;
memcpy(buf + 1, p, len);
{
struct xc2028_data *priv = fe->tuner_priv;
struct xc2028_ctrl *p = priv_cfg;
+ int rc = 0;
tuner_dbg("%s called\n", __FUNCTION__);
mutex_lock(&priv->lock);
- priv->ctrl.type = p->type;
-
- if (p->fname) {
- kfree(priv->ctrl.fname);
+ kfree(priv->ctrl.fname);
+ free_firmware(priv);
- priv->ctrl.fname = kmalloc(strlen(p->fname) + 1, GFP_KERNEL);
- if (priv->ctrl.fname == NULL) {
- mutex_unlock(&priv->lock);
- return -ENOMEM;
- }
+ memcpy(&priv->ctrl, p, sizeof(priv->ctrl));
+ priv->ctrl.fname = NULL;
- free_firmware(priv);
- strcpy(priv->ctrl.fname, p->fname);
+ if (p->fname) {
+ priv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);
+ if (priv->ctrl.fname == NULL)
+ rc = -ENOMEM;
}
- if (p->max_len > 0)
- priv->max_len = p->max_len;
+ if (priv->ctrl.max_len < 9)
+ priv->ctrl.max_len = 13;
mutex_unlock(&priv->lock);
- return 0;
+ return rc;
}
static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
priv->i2c_props.adap = cfg->i2c_adap;
priv->video_dev = video_dev;
priv->tuner_callback = cfg->callback;
- priv->max_len = 13;
+ priv->ctrl.max_len = 13;
mutex_init(&priv->lock);