[media] dvb_usb_v2: get rid of dvb_usb_device state

Remove state from struct dvb_usb_device as we can live without.
Add some debug logs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Antti Palosaari 2012-06-15 01:38:28 -03:00 committed by Mauro Carvalho Chehab
parent ad26183931
commit d70521a396
2 changed files with 12 additions and 26 deletions

View File

@ -324,12 +324,6 @@ struct dvb_usb_device {
struct work_struct probe_work;
pid_t work_pid;
struct usb_interface *intf;
#define DVB_USB_STATE_INIT 0x000
#define DVB_USB_STATE_I2C 0x001
#define DVB_USB_STATE_DVB 0x002
int state;
int powered;
/* locking */

View File

@ -72,26 +72,24 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
{
int ret;
if (!d->props->i2c_algo) {
ret = 0;
goto err;
}
pr_debug("%s:\n", __func__);
if (!d->props->i2c_algo)
return 0;
strlcpy(d->i2c_adap.name, d->name, sizeof(d->i2c_adap.name));
d->i2c_adap.algo = d->props->i2c_algo;
d->i2c_adap.algo_data = NULL;
d->i2c_adap.dev.parent = &d->udev->dev;
i2c_set_adapdata(&d->i2c_adap, d);
ret = i2c_add_adapter(&d->i2c_adap);
if (ret < 0) {
pr_err("%s: i2c_add_adapter() failed\n", KBUILD_MODNAME);
d->i2c_adap.algo = NULL;
pr_err("%s: i2c_add_adapter() failed=%d\n", KBUILD_MODNAME,
ret);
goto err;
}
d->state |= DVB_USB_STATE_I2C;
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
@ -100,10 +98,10 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
static int dvb_usbv2_i2c_exit(struct dvb_usb_device *d)
{
if (d->state & DVB_USB_STATE_I2C)
i2c_del_adapter(&d->i2c_adap);
pr_debug("%s:\n", __func__);
d->state &= ~DVB_USB_STATE_I2C;
if (d->i2c_adap.algo)
i2c_del_adapter(&d->i2c_adap);
return 0;
}
@ -282,7 +280,6 @@ static int dvb_usbv2_adapter_init(struct dvb_usb_device *d)
adap->dvb_adap.mfe_shared = 1;
d->num_adapters_initialized++;
d->state |= DVB_USB_STATE_DVB;
}
return 0;
@ -304,7 +301,6 @@ static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
}
d->num_adapters_initialized = 0;
d->state &= ~DVB_USB_STATE_DVB;
return 0;
}
@ -312,12 +308,11 @@ static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
/* general initialization functions */
static int dvb_usbv2_exit(struct dvb_usb_device *d)
{
pr_debug("%s: state before exiting everything: %x\n", __func__, d->state);
pr_debug("%s:\n", __func__);
dvb_usbv2_remote_exit(d);
dvb_usbv2_adapter_exit(d);
dvb_usbv2_i2c_exit(d);
pr_debug("%s: state should be zero now: %x\n", __func__, d->state);
d->state = DVB_USB_STATE_INIT;
kfree(d->priv);
kfree(d);
@ -328,9 +323,6 @@ static int dvb_usbv2_init(struct dvb_usb_device *d)
{
int ret = 0;
d->state = DVB_USB_STATE_INIT;
/* check the capabilities and set appropriate variables */
dvb_usbv2_device_power_ctrl(d, 1);
if (d->props->read_config) {