18/34: ieee1394/video1394: replace
/me finally gets time to review this...
This doesn't apply to anything I can find. Patches against 1394 svn ( svn://svn.linux1394.org/libraw1394/ ) or development bk ( http://linux-1394.bkbits.net/1394-dev ) are most useful, but I can deal with others.
Quoted 19 lines · Nishanth Aravamudan
Hi,
I mistakenly sent to the wrong address for the list. Please reply in CC to [email protected] and [email protected]. Thanks!
Please consider applying.
Description: Use
wait_event_interruptible()instead of the deprecatedinterruptible_sleep_on(). The first change is simply to clean up the code a little to make it clearer. The second actually does a replacement, mimicking exactly the first. I removed the #if 1/#else/endif logic, as it duplicated the same code. Patch is compile-tested.Signed-off-by Nishanth Aravamudan <[email protected]>drivers/ieee1394/video1394.c +0
-0@@ -964,10 +964,9 @@ static int __video1394_ioctl(struct file }
drivers/ieee1394/video1394.c static int __video1394_ioctl(struct file · line 970
Quoted 10 lines
drivers/ieee1394/video1394.c +3
-4}#else -if (wait_event_interruptible (d->waitq, - d->buffer_status[v.buffer] - ==VIDEO1394_BUFFER_READY ) - == -ERESTARTSYS ) +wait_event_interruptible (d->waitq, + (d->buffer_status[v.buffer] ==VIDEO1394_BUFFER_READY )); +if (signal_pending (current))return -EINTR ;
Fine, but that only touches the #else of an #if 1 and leaves an interruptible_sleep_on in the part that's actually executed.
Can you change this to be more like hunk 2?
For what it's worth, the #if 1 has been there since 2002 so it's probably safe to remove by now :)
Thanks,
Jody
Quoted 35 lines
drivers/ieee1394/video1394.c +3
-13#endif d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE ;@@ -1126,19 +1125,10 @@ static int __video1394_ioctl(struct file d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE ;return 0 ;case VIDEO1394_BUFFER_QUEUED : -#if 1 -while (d->buffer_status[v.buffer]!= -VIDEO1394_BUFFER_READY ) { -interruptible_sleep_on (&d->waitq); -if (signal_pending (current))return -EINTR ; - } -#else -if (wait_event_interruptible (d->waitq, - d->buffer_status[v.buffer] - ==VIDEO1394_BUFFER_READY ) - == -ERESTARTSYS ) +wait_event_interruptible (d->waitq, + (d->buffer_status[v.buffer] ==VIDEO1394_BUFFER_READY )); +if (signal_pending (current))return -EINTR ; -#endif d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE ;return 0 ;default : -------------------------------------------------------This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 6 lines · Jody McIntyre
/me finally gets time to review this...
This doesn't apply to anything I can find. Patches against 1394 svn ( svn://svn.linux1394.org/libraw1394/ ) or development bk ( http://linux-1394.bkbits.net/1394-dev ) are most useful, but I can deal with others.
OK, I will add that to my notes for ieee1394. Thanks!
Quoted 34 lines · Nishanth Aravamudan
Quoted 19 lines
Hi,
I mistakenly sent to the wrong address for the list. Please reply in CC to [email protected] and [email protected]. Thanks!
Please consider applying.
Description: Use
wait_event_interruptible()instead of the deprecatedinterruptible_sleep_on(). The first change is simply to clean up the code a little to make it clearer. The second actually does a replacement, mimicking exactly the first. I removed the #if 1/#else/endif logic, as it duplicated the same code. Patch is compile-tested.Signed-off-by Nishanth Aravamudan <[email protected]>drivers/ieee1394/video1394.c +0
-0@@ -964,10 +964,9 @@ static int __video1394_ioctl(struct file }drivers/ieee1394/video1394.c static int __video1394_ioctl(struct file · line 970
Quoted 10 lines
drivers/ieee1394/video1394.c +3
-4}#else -if (wait_event_interruptible (d->waitq, - d->buffer_status[v.buffer] - ==VIDEO1394_BUFFER_READY ) - == -ERESTARTSYS ) +wait_event_interruptible (d->waitq, + (d->buffer_status[v.buffer] ==VIDEO1394_BUFFER_READY )); +if (signal_pending (current))return -EINTR ;Fine, but that only touches the #else of an #if 1 and leaves an
interruptible_sleep_onin the part that's actually executed.
Quoted 4 lines
Can you change this to be more like hunk 2?
For what it's worth, the #if 1 has been there since 2002 so it's probably safe to remove by now :)
I will look into it, but from a cursory glance, the #if 1 case uses locking around the sleep, which is currently not supported by wait_event*(). I have sent a patch to LKML regarding this issue and the need, perhaps, for alternative wait_event*() style functions, such as ones that accept locks as parameters.
Any suggestions?
Thanks,
Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 7 lines · Nishanth Aravamudan
[...]
I will look into it, but from a cursory glance, the #if 1 case uses locking around the sleep, which is currently not supported by wait_event*(). I have sent a patch to LKML regarding this issue and the need, perhaps, for alternative wait_event*() style functions, such as ones that accept locks as parameters.
In my copy, it _unlocks_ around the sleep. I don't see why this couldn't be done with wait_event_interruptible (unlock, wait, lock). Can you produce a patch with that? I'll find a video1394 user to test it.
Thanks,
Jody
Quoted 15 lines
Any suggestions?
Thanks,
Nish-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 9 lines · Jody McIntyre
Quoted 7 lines · Nishanth Aravamudan
[...]
I will look into it, but from a cursory glance, the #if 1 case uses locking around the sleep, which is currently not supported by wait_event*(). I have sent a patch to LKML regarding this issue and the need, perhaps, for alternative wait_event*() style functions, such as ones that accept locks as parameters.
Quoted 4 lines
In my copy, it _unlocks_ around the sleep. I don't see why this couldn't be done with
wait_event_interruptible(unlock, wait, lock). Can you produce a patch with that? I'll find a video1394 user to test it.
Sorry for my mis-statement/lack of clarity. In my copy, it also unlocks around the sleep... The problem is that wait_event*() should be used in such a way that the while-loop is not at all necessary (ideally). Instead, we'll have a while-loop around the unlock-wait_event-lock code, which is just ugly to me, as wait_event is just a macro around another while loop. The real solution is wait_event_interruptible_lock(). Hopefully I can get such a macro accepted into mainline sooner or later...
I'm assuming the locking is done this way so that other variables protected by the same lock can be changed while this one sleeps?
Thanks,
Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 5 lines · Nishanth Aravamudan
Quoted 4 lines
In my copy, it _unlocks_ around the sleep. I don't see why this couldn't be done with
wait_event_interruptible(unlock, wait, lock). Can you produce a patch with that? I'll find a video1394 user to test it.
Quoted 8 lines
Sorry for my mis-statement/lack of clarity. In my copy, it also unlocks around the sleep... The problem is that wait_event*() should be used in such a way that the while-loop is not at all necessary (ideally). Instead, we'll have a while-loop around the unlock-wait_event-lock code, which is just ugly to me, as
wait_eventis just a macro around another while loop. The real solution iswait_event_interruptible_lock(). Hopefully I can get such a macro accepted into mainline sooner or later...
So you want to leave tho old code in until then? Fair enough.
Quoted 2 lines
I'm assuming the locking is done this way so that other variables protected by the same lock can be changed while this one sleeps?
Correct. See, for example, wakeup_dma_ir_ctx() .
Jody
Quoted 13 lines
Thanks,
Nish-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 16 lines · Jody McIntyre
Quoted 5 lines · Nishanth Aravamudan
Quoted 4 lines
In my copy, it _unlocks_ around the sleep. I don't see why this couldn't be done with
wait_event_interruptible(unlock, wait, lock). Can you produce a patch with that? I'll find a video1394 user to test it.Quoted 8 lines
Sorry for my mis-statement/lack of clarity. In my copy, it also unlocks around the sleep... The problem is that wait_event*() should be used in such a way that the while-loop is not at all necessary (ideally). Instead, we'll have a while-loop around the unlock-wait_event-lock code, which is just ugly to me, as
wait_eventis just a macro around another while loop. The real solution iswait_event_interruptible_lock(). Hopefully I can get such a macro accepted into mainline sooner or later...
Quoted 1 line
So you want to leave tho old code in until then? Fair enough.
Yup, I think that's the best solution for now.
Quoted 4 lines
Quoted 2 lines
I'm assuming the locking is done this way so that other variables protected by the same lock can be changed while this one sleeps?
Correct. See, for example,
wakeup_dma_ir_ctx().
That's what I thought, but I just wanted to get confirmation from you :) Thanks for all the feedback! I will send an updated patch against the bk-repo once the other wait_event*() macros go in (expect it before 2.6.12's full release).
Thanks,
Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 16 lines · Jody McIntyre
Quoted 5 lines · Nishanth Aravamudan
Quoted 4 lines
In my copy, it _unlocks_ around the sleep. I don't see why this couldn't be done with
wait_event_interruptible(unlock, wait, lock). Can you produce a patch with that? I'll find a video1394 user to test it.Quoted 8 lines
Sorry for my mis-statement/lack of clarity. In my copy, it also unlocks around the sleep... The problem is that wait_event*() should be used in such a way that the while-loop is not at all necessary (ideally). Instead, we'll have a while-loop around the unlock-wait_event-lock code, which is just ugly to me, as
wait_eventis just a macro around another while loop. The real solution iswait_event_interruptible_lock(). Hopefully I can get such a macro accepted into mainline sooner or later...
Quoted 6 lines
So you want to leave tho old code in until then? Fair enough.
Quoted 2 lines
I'm assuming the locking is done this way so that other variables protected by the same lock can be changed while this one sleeps?
Correct. See, for example,
wakeup_dma_ir_ctx().
I am not sure if you have seen some of the discussion (under the
subject: "[RFC UPDATE PATCH] add wait_event_*_lock() functions and comments") on LKML regarding these macros. Does Arnd's proposal to fix video1394 seem reasonable? I can throw up a patch, if you'd like to test.
Thanks,
Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 5 lines · Nishanth Aravamudan
I am not sure if you have seen some of the discussion (under the
subject: "[RFC UPDATE PATCH] add wait_event_*_lock() functions and comments") on LKML regarding these macros. Does Arnd's proposal to fix video1394 seem reasonable? I can throw up a patch, if you'd like to test.
I just read it now. Arnd's suggestion looks like it will work. I thought of something similar while reading the thread and his code looks correct. If you have time to make a patch, I'll find some video1394 users to test it.
Thanks,
Jody
Quoted 13 lines
Thanks,
Nish-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 8 lines · Jody McIntyre
Quoted 5 lines · Nishanth Aravamudan
I am not sure if you have seen some of the discussion (under the
subject: "[RFC UPDATE PATCH] add wait_event_*_lock() functions and comments") on LKML regarding these macros. Does Arnd's proposal to fix video1394 seem reasonable? I can throw up a patch, if you'd like to test.
Quoted 4 lines
I just read it now. Arnd's suggestion looks like it will work. I thought of something similar while reading the thread and his code looks correct. If you have time to make a patch, I'll find some video1394 users to test it.
If someone could test the following, I think it implements exactly what Arnd suggested...
Thanks,
Nish
drivers/ieee1394/video1394.c +16 -17
@@ -699,6 +699,17 @@ static void initialize_dma_it_ctx(structreg_write (ohci, OHCI1394_IsoXmitIntMaskSet,1 <<d->ctx); } +static inline unsigned video1394_buffer_state (struct dma_iso_ctx *d, +unsigned int buffer) +{ +unsigned long flags; +unsigned int ret; +spin_lock_irqsave (&d->lock, flags); + ret = d->buffer_status[buffer]; +spin_unlock_irqrestore (&d->lock, flags); +return ret; +} +static int __video1394_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {
@@ -952,24 +963,12 @@ static int __video1394_ioctl(struct filereturn -EINTR ; } -#if 1 -while (d->buffer_status[v.buffer]!= -VIDEO1394_BUFFER_READY ) { -spin_unlock_irqrestore (&d->lock, flags); -interruptible_sleep_on (&d->waitq); -spin_lock_irqsave (&d->lock, flags); -if (signal_pending (current)) { -spin_unlock_irqrestore (&d->lock,flags); -return -EINTR ; - } - } -#else -if (wait_event_interruptible (d->waitq, - d->buffer_status[v.buffer] - ==VIDEO1394_BUFFER_READY ) - == -ERESTARTSYS ) +spin_unlock_irqrestore (&d->lock, flags); +wait_event_interruptible (d->waitq, +video1394_buffer_state (d, v.buffer) ==VIDEO1394_BUFFER_READY ); +if (signal_pending (current)) {return -EINTR ; -#endif +spin_lock_irqsave (&d->lock, flags); d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE ;break ;default :
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Please add a Signed-off-by: line.
(more comments below)
Quoted 34 lines · Nishanth Aravamudan
drivers/ieee1394/video1394.c +11
-10@@ -699,6 +699,17 @@ static void initialize_dma_it_ctx(structreg_write (ohci, OHCI1394_IsoXmitIntMaskSet,1 <<d->ctx); } +static inline unsigned video1394_buffer_state (struct dma_iso_ctx *d, +unsigned int buffer) +{ +unsigned long flags; +unsigned int ret; +spin_lock_irqsave (&d->lock, flags); + ret = d->buffer_status[buffer]; +spin_unlock_irqrestore (&d->lock, flags); +return ret; +} +static int __video1394_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {@@ -952,24 +963,12 @@ static int __video1394_ioctl(struct filereturn -EINTR ; } -#if 1 -while (d->buffer_status[v.buffer]!= -VIDEO1394_BUFFER_READY ) { -spin_unlock_irqrestore (&d->lock, flags); -interruptible_sleep_on (&d->waitq); -spin_lock_irqsave (&d->lock, flags); -if (signal_pending (current)) { -spin_unlock_irqrestore (&d->lock,flags); -return -EINTR ; - }
drivers/ieee1394/video1394.c static int __video1394_ioctl(struct file · line 969
Quoted 10 lines
drivers/ieee1394/video1394.c +4
-6- } -#else -if (wait_event_interruptible (d->waitq, - d->buffer_status[v.buffer] - ==VIDEO1394_BUFFER_READY ) - == -ERESTARTSYS ) +spin_unlock_irqrestore (&d->lock, flags); +wait_event_interruptible (d->waitq, +video1394_buffer_state (d, v.buffer) ==VIDEO1394_BUFFER_READY ); +if (signal_pending (current)) {
Extra {.
drivers/ieee1394/video1394.c static int __video1394_ioctl(struct file · line 974
Quoted 6 lines
drivers/ieee1394/video1394.c +1
-1return -EINTR ; -#endif +spin_lock_irqsave (&d->lock, flags); d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE ;break ;default :
With this fixed, it compiles. I'll find a video1394 user to test it.
Thanks,
Jody
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 1 line · Jody McIntyre
Please add a Signed-off-by: line.
Will do, I just wanted to get you a patch to test first. If it works, I'll send an "official" one :)
Quoted 1 line
(more comments below)
<snip>
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ if (signal_pending(current)) {Extra {.
Whoops, thanks for the catch. Let us know how the testing goes...
-Nish
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 5 lines · Nishanth Aravamudan
Quoted 1 line · Jody McIntyre
Please add a Signed-off-by: line.
Will do, I just wanted to get you a patch to test first. If it works, I'll send an "official" one :)
It's been over a week and nobody's reported any problems with your patch. Please send an "official" one and I will apply it.
Thanks,
Jody
Quoted 22 lines
Quoted 2 lines
(more comments below)
<snip>
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ if (signal_pending(current)) {Extra {.
Whoops, thanks for the catch. Let us know how the testing goes...
-Nish
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors