Re: [RFC/PATCH] dvb-core: add template code for i2c binding model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> The only thing I noticed is that it is causing some warnings at
> dmesg about trying to create already created sysfs nodes, when the
> driver is removed/reinserted.
> 
> Probably, the remove callback is called too soon or too late.

I don't have any warnings in syslog when reinserting earth-pt3 + tc90522,
but I'll look into it.

> -struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config,
> -				    struct i2c_adapter *i2c)
> +static int mb86a20s_probe(struct i2c_client *i2c,
> +			  const struct i2c_device_id *id)
>  {
> +	struct dvb_frontend *fe;
>  	struct mb86a20s_state *state;
>  	u8	rev;
>  
>  	dev_dbg(&i2c->dev, "%s called.\n", __func__);
>  
> -	/* allocate memory for the internal state */
> -	state = kzalloc(sizeof(struct mb86a20s_state), GFP_KERNEL);
> -	if (state == NULL) {
> -		dev_err(&i2c->dev,
> -			"%s: unable to allocate memory for state\n", __func__);
> -		goto error;
> -	}
> +	fe = i2c_get_clientdata(i2c);
> +	state = fe->demodulator_priv;
>  
>  	/* setup the state */
> -	state->config = config;
> +	memcpy(&state->config, i2c->dev.platform_data, sizeof(state->config));
>  	state->i2c = i2c;
>  
>  	/* create dvb_frontend */
> -	memcpy(&state->frontend.ops, &mb86a20s_ops,
> +	memcpy(&fe->ops, &mb86a20s_ops,
>  		sizeof(struct dvb_frontend_ops));

btw,
we can go with "mb86a20s_param = { .ops.fe_ops = &mb86a20s_ops,}" insead.

--
regards,
akihiro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux