| .. | .. |
|---|
| 135 | 135 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
|---|
| 136 | 136 | |
|---|
| 137 | 137 | if (fepriv) |
|---|
| 138 | | - dvb_free_device(fepriv->dvbdev); |
|---|
| 138 | + dvb_device_put(fepriv->dvbdev); |
|---|
| 139 | 139 | |
|---|
| 140 | 140 | dvb_frontend_invoke_release(fe, fe->ops.release); |
|---|
| 141 | 141 | |
|---|
| .. | .. |
|---|
| 292 | 292 | } |
|---|
| 293 | 293 | |
|---|
| 294 | 294 | if (events->eventw == events->eventr) { |
|---|
| 295 | | - int ret; |
|---|
| 295 | + struct wait_queue_entry wait; |
|---|
| 296 | + int ret = 0; |
|---|
| 296 | 297 | |
|---|
| 297 | 298 | if (flags & O_NONBLOCK) |
|---|
| 298 | 299 | return -EWOULDBLOCK; |
|---|
| 299 | 300 | |
|---|
| 300 | | - ret = wait_event_interruptible(events->wait_queue, |
|---|
| 301 | | - dvb_frontend_test_event(fepriv, events)); |
|---|
| 302 | | - |
|---|
| 301 | + init_waitqueue_entry(&wait, current); |
|---|
| 302 | + add_wait_queue(&events->wait_queue, &wait); |
|---|
| 303 | + while (!dvb_frontend_test_event(fepriv, events)) { |
|---|
| 304 | + wait_woken(&wait, TASK_INTERRUPTIBLE, 0); |
|---|
| 305 | + if (signal_pending(current)) { |
|---|
| 306 | + ret = -ERESTARTSYS; |
|---|
| 307 | + break; |
|---|
| 308 | + } |
|---|
| 309 | + } |
|---|
| 310 | + remove_wait_queue(&events->wait_queue, &wait); |
|---|
| 303 | 311 | if (ret < 0) |
|---|
| 304 | 312 | return ret; |
|---|
| 305 | 313 | } |
|---|
| .. | .. |
|---|
| 2961 | 2969 | .name = fe->ops.info.name, |
|---|
| 2962 | 2970 | #endif |
|---|
| 2963 | 2971 | }; |
|---|
| 2972 | + int ret; |
|---|
| 2964 | 2973 | |
|---|
| 2965 | 2974 | dev_dbg(dvb->device, "%s:\n", __func__); |
|---|
| 2966 | 2975 | |
|---|
| .. | .. |
|---|
| 2994 | 3003 | "DVB: registering adapter %i frontend %i (%s)...\n", |
|---|
| 2995 | 3004 | fe->dvb->num, fe->id, fe->ops.info.name); |
|---|
| 2996 | 3005 | |
|---|
| 2997 | | - dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, |
|---|
| 3006 | + ret = dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, |
|---|
| 2998 | 3007 | fe, DVB_DEVICE_FRONTEND, 0); |
|---|
| 3008 | + if (ret) { |
|---|
| 3009 | + dvb_frontend_put(fe); |
|---|
| 3010 | + mutex_unlock(&frontend_mutex); |
|---|
| 3011 | + return ret; |
|---|
| 3012 | + } |
|---|
| 2999 | 3013 | |
|---|
| 3000 | 3014 | /* |
|---|
| 3001 | 3015 | * Initialize the cache to the proper values according with the |
|---|