diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-09-20 11:06:11 +0200 |
---|---|---|
committer | Patrick Boettcher <pb@linuxtv.org> | 2006-09-20 11:06:11 +0200 |
commit | c96cfe756cb607fecb05a1715c87c7aab294b0b4 (patch) | |
tree | 7f55069c0bea4984ebcd65841214221161356f7e /linux/drivers | |
parent | 80b43927247d2513ba4f8e221893d4566f361cae (diff) | |
download | mediapointer-dvb-s2-c96cfe756cb607fecb05a1715c87c7aab294b0b4.tar.gz mediapointer-dvb-s2-c96cfe756cb607fecb05a1715c87c7aab294b0b4.tar.bz2 |
Power control of the device for dual board
From: Patrick Boettcher <pb@linuxtv.org>
Corrected power control of the device for dual boards
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c | 11 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 0dd90d1fe..ffdde83d1 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c @@ -136,7 +136,7 @@ static int dvb_usb_init(struct dvb_usb_device *d) if (d->priv == NULL) { err("no memory for priv in 'struct dvb_usb_device'"); return -ENOMEM; - } + } } /* check the capabilities and set appropriate variables */ @@ -197,8 +197,13 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) { - if (d->powered == !onoff) { - d->powered = onoff; + if (onoff) + d->powered++; + else + d->powered--; + + if (d->powered == 0 || (onoff && d->powered == 1)) { // when switching from 1 to 0 or from 0 to 1 + deb_info("power control: %d\n", onoff); if (d->props.power_ctrl) return d->props.power_ctrl(d, onoff); } diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h index a26a91d50..883496c00 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -328,6 +328,8 @@ struct dvb_usb_adapter { * @desc: pointer to the device's struct dvb_usb_device_description. * @state: initialization and runtime state of the device. * + * @powered: indicated whether the device is power or not. + * Powered is in/decremented for each call to modify the state. * @udev: pointer to the device's struct usb_device. * * @usb_mutex: semaphore of USB control messages (reading needs two messages) |