Skip to contentSkip to conversation

A dvb-core code problem

linux-dvb Zhang Xiaobing 2 participants 2 messages Feb 13, 2009 – Feb 15, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

I found a code problem in dvb-core when I was debugging with my dvb driver.

The code in dvb_dvr_release() file dmxdev.c
/* TODO */
dvbdev->users--;

   if(*dvbdev->users== -1* && dmxdev->exit==1) {
       fops_put(file->f_op);
       file->f_op = NULL;
       mutex_unlock(&dmxdev->mutex);

"dvbdev->users== -1" should be changed to "dvbdev->users== 1", otherwise driver may block forever in dvb_dmxdev_release() where a wakeup condition is "dvbdev->users== 1".

Here is the code in dvb_dmxdev_release().

if (dmxdev->dvr_dvbdev->users > 1) {
       wait_event(dmxdev->dvr_dvbdev->wait_queue,
               *dmxdev->dvr_dvbdev->users==1*);
}

I hope it is right to post this message here.

Signature · 1 line
Xiaobing Zhang

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead [email protected] [email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#1 lore raw
Quoted 15 lines · Zhang Xiaobing

I found a code problem in dvb-core when I was debugging with my dvb driver.

The code in dvb_dvr_release() file dmxdev.c
/* TODO */

    dvbdev->users--;
    if(*dvbdev->users== -1* && dmxdev->exit==1) {
        fops_put(file->f_op);
        file->f_op = NULL;
        mutex_unlock(&dmxdev->mutex);

"dvbdev->users== -1" should be changed to "dvbdev->users== 1", otherwise driver may block forever in dvb_dmxdev_release() where a wakeup condition is "dvbdev->users== 1".

Quoted 8 lines

Here is the code in dvb_dmxdev_release().

if (dmxdev->dvr_dvbdev->users > 1) {
        wait_event(dmxdev->dvr_dvbdev->wait_queue,
                *dmxdev->dvr_dvbdev->users==1*);
}

I hope it is right to post this message here.

Hi Zhang, could you post a patch to the linux-media mail list; for general info see here:
http://www.linuxtv.org/wiki/index.php/Development:_How_to_submit_patches