diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-init.c | 11 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 0dd90d1fe67c..ffdde83d1e77 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -136,7 +136,7 @@ static int dvb_usb_init(struct dvb_usb_device *d) | |||
136 | if (d->priv == NULL) { | 136 | if (d->priv == NULL) { |
137 | err("no memory for priv in 'struct dvb_usb_device'"); | 137 | err("no memory for priv in 'struct dvb_usb_device'"); |
138 | return -ENOMEM; | 138 | return -ENOMEM; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | /* check the capabilities and set appropriate variables */ | 142 | /* check the capabilities and set appropriate variables */ |
@@ -197,8 +197,13 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device | |||
197 | 197 | ||
198 | int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) | 198 | int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) |
199 | { | 199 | { |
200 | if (d->powered == !onoff) { | 200 | if (onoff) |
201 | d->powered = onoff; | 201 | d->powered++; |
202 | else | ||
203 | d->powered--; | ||
204 | |||
205 | if (d->powered == 0 || (onoff && d->powered == 1)) { // when switching from 1 to 0 or from 0 to 1 | ||
206 | deb_info("power control: %d\n", onoff); | ||
202 | if (d->props.power_ctrl) | 207 | if (d->props.power_ctrl) |
203 | return d->props.power_ctrl(d, onoff); | 208 | return d->props.power_ctrl(d, onoff); |
204 | } | 209 | } |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 2ec7c777fcef..376c45a8e779 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -325,6 +325,8 @@ struct dvb_usb_adapter { | |||
325 | * @desc: pointer to the device's struct dvb_usb_device_description. | 325 | * @desc: pointer to the device's struct dvb_usb_device_description. |
326 | * @state: initialization and runtime state of the device. | 326 | * @state: initialization and runtime state of the device. |
327 | * | 327 | * |
328 | * @powered: indicated whether the device is power or not. | ||
329 | * Powered is in/decremented for each call to modify the state. | ||
328 | * @udev: pointer to the device's struct usb_device. | 330 | * @udev: pointer to the device's struct usb_device. |
329 | * | 331 | * |
330 | * @usb_mutex: semaphore of USB control messages (reading needs two messages) | 332 | * @usb_mutex: semaphore of USB control messages (reading needs two messages) |