summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-06-15 04:38:28 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-04 10:56:33 (GMT)
commitd70521a396cecb11dc8bd4212d2502dc797d3d67 (patch)
treef9a1169e63c4765483603dcb9cd2e38e2b3409fb
parentad2618393168a72f079265023ddc68f2a89ccc9f (diff)
downloadlinux-fsl-qoriq-d70521a396cecb11dc8bd4212d2502dc797d3d67.tar.xz
[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>
-rw-r--r--drivers/media/dvb/dvb-usb/dvb_usb.h6
-rw-r--r--drivers/media/dvb/dvb-usb/dvb_usb_init.c32
2 files changed, 12 insertions, 26 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb.h b/drivers/media/dvb/dvb-usb/dvb_usb.h
index 62097f3..8ec8dee 100644
--- a/drivers/media/dvb/dvb-usb/dvb_usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb_usb.h
@@ -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 */
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c
index 5da4233..1297b95 100644
--- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c
+++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c
@@ -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 @@ err:
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) {