mbox series

[v2,0/8] media: use 'time_left' instead of 'timeout' with wait_*() functions

Message ID 20240805215123.3528-1-wsa+renesas@sang-engineering.com
Headers show
Series media: use 'time_left' instead of 'timeout' with wait_*() functions | expand

Message

Wolfram Sang Aug. 5, 2024, 9:51 p.m. UTC
Changes since v1:
* fixed another occasion in the allegro driver (Thanks, Michael)
* added tags (Thanks Ismael and Thierry)
* rebased to 6.11-rc1

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_*() functions causing patterns like:

        timeout = wait_for_completion_timeout(...)
        if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
obvious and self explaining. Also correct the type of the variable if
the original code got it wrong.

This is part of a tree-wide series. The rest of the patches can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/time_left

Because these patches are generated, I audit them before sending. This is why I
will send series step by step. Build bot is happy with these patches, though.
No functional changes intended.


Wolfram Sang (8):
  media: allegro: use 'time_left' variable with
    wait_for_completion_timeout()
  media: atmel-isi: use 'time_left' variable with
    wait_for_completion_timeout()
  media: bdisp: use 'time_left' variable with wait_event_timeout()
  media: fimc-is: use 'time_left' variable with wait_event_timeout()
  media: platform: exynos-gsc: use 'time_left' variable with
    wait_event_timeout()
  media: solo6x10: use 'time_left' variable with
    wait_for_completion_timeout()
  media: tegra-vde: use 'time_left' variable with
    wait_for_completion_interruptible_timeout()
  media: ti: cal: use 'time_left' variable with wait_event_timeout()

 drivers/media/pci/solo6x10/solo6x10-p2m.c     |  8 +++----
 .../media/platform/allegro-dvt/allegro-core.c | 24 +++++++++----------
 drivers/media/platform/atmel/atmel-isi.c      |  8 +++----
 .../media/platform/nvidia/tegra-vde/h264.c    | 10 ++++----
 .../platform/samsung/exynos-gsc/gsc-core.c    | 10 ++++----
 .../platform/samsung/exynos4-is/fimc-core.c   | 10 ++++----
 .../media/platform/st/sti/bdisp/bdisp-v4l2.c  | 10 ++++----
 drivers/media/platform/ti/cal/cal.c           |  8 +++----
 8 files changed, 44 insertions(+), 44 deletions(-)

Comments

Hans Verkuil Aug. 7, 2024, 1:08 p.m. UTC | #1
Hi Wolfram,

On 05/08/2024 23:51, Wolfram Sang wrote:
> Changes since v1:
> * fixed another occasion in the allegro driver (Thanks, Michael)
> * added tags (Thanks Ismael and Thierry)
> * rebased to 6.11-rc1

Can you resend this series? This patch series wasn't picked up by our patchwork,
probably due to a full filesystem.

Apologies for the inconvenience.

Regards,

	Hans

> 
> There is a confusing pattern in the kernel to use a variable named 'timeout' to
> store the result of wait_*() functions causing patterns like:
> 
>         timeout = wait_for_completion_timeout(...)
>         if (!timeout) return -ETIMEDOUT;
> 
> with all kinds of permutations. Use 'time_left' as a variable to make the code
> obvious and self explaining. Also correct the type of the variable if
> the original code got it wrong.
> 
> This is part of a tree-wide series. The rest of the patches can be found here:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/time_left
> 
> Because these patches are generated, I audit them before sending. This is why I
> will send series step by step. Build bot is happy with these patches, though.
> No functional changes intended.
> 
> 
> Wolfram Sang (8):
>   media: allegro: use 'time_left' variable with
>     wait_for_completion_timeout()
>   media: atmel-isi: use 'time_left' variable with
>     wait_for_completion_timeout()
>   media: bdisp: use 'time_left' variable with wait_event_timeout()
>   media: fimc-is: use 'time_left' variable with wait_event_timeout()
>   media: platform: exynos-gsc: use 'time_left' variable with
>     wait_event_timeout()
>   media: solo6x10: use 'time_left' variable with
>     wait_for_completion_timeout()
>   media: tegra-vde: use 'time_left' variable with
>     wait_for_completion_interruptible_timeout()
>   media: ti: cal: use 'time_left' variable with wait_event_timeout()
> 
>  drivers/media/pci/solo6x10/solo6x10-p2m.c     |  8 +++----
>  .../media/platform/allegro-dvt/allegro-core.c | 24 +++++++++----------
>  drivers/media/platform/atmel/atmel-isi.c      |  8 +++----
>  .../media/platform/nvidia/tegra-vde/h264.c    | 10 ++++----
>  .../platform/samsung/exynos-gsc/gsc-core.c    | 10 ++++----
>  .../platform/samsung/exynos4-is/fimc-core.c   | 10 ++++----
>  .../media/platform/st/sti/bdisp/bdisp-v4l2.c  | 10 ++++----
>  drivers/media/platform/ti/cal/cal.c           |  8 +++----
>  8 files changed, 44 insertions(+), 44 deletions(-)
>
Hans Verkuil Aug. 7, 2024, 1:16 p.m. UTC | #2
On 07/08/2024 15:08, Hans Verkuil wrote:
> Hi Wolfram,
> 
> On 05/08/2024 23:51, Wolfram Sang wrote:
>> Changes since v1:
>> * fixed another occasion in the allegro driver (Thanks, Michael)
>> * added tags (Thanks Ismael and Thierry)
>> * rebased to 6.11-rc1
> 
> Can you resend this series? This patch series wasn't picked up by our patchwork,
> probably due to a full filesystem.

Actually, it's better to wait a bit: I now see that patchwork hasn't accepted new
patches since August 5th, so until that is fixed, there is no point in resending...

I'll let you know when it is OK again.

> Apologies for the inconvenience.

Even more apologies,

	Hans

> 
> Regards,
> 
> 	Hans
> 
>>
>> There is a confusing pattern in the kernel to use a variable named 'timeout' to
>> store the result of wait_*() functions causing patterns like:
>>
>>         timeout = wait_for_completion_timeout(...)
>>         if (!timeout) return -ETIMEDOUT;
>>
>> with all kinds of permutations. Use 'time_left' as a variable to make the code
>> obvious and self explaining. Also correct the type of the variable if
>> the original code got it wrong.
>>
>> This is part of a tree-wide series. The rest of the patches can be found here:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/time_left
>>
>> Because these patches are generated, I audit them before sending. This is why I
>> will send series step by step. Build bot is happy with these patches, though.
>> No functional changes intended.
>>
>>
>> Wolfram Sang (8):
>>   media: allegro: use 'time_left' variable with
>>     wait_for_completion_timeout()
>>   media: atmel-isi: use 'time_left' variable with
>>     wait_for_completion_timeout()
>>   media: bdisp: use 'time_left' variable with wait_event_timeout()
>>   media: fimc-is: use 'time_left' variable with wait_event_timeout()
>>   media: platform: exynos-gsc: use 'time_left' variable with
>>     wait_event_timeout()
>>   media: solo6x10: use 'time_left' variable with
>>     wait_for_completion_timeout()
>>   media: tegra-vde: use 'time_left' variable with
>>     wait_for_completion_interruptible_timeout()
>>   media: ti: cal: use 'time_left' variable with wait_event_timeout()
>>
>>  drivers/media/pci/solo6x10/solo6x10-p2m.c     |  8 +++----
>>  .../media/platform/allegro-dvt/allegro-core.c | 24 +++++++++----------
>>  drivers/media/platform/atmel/atmel-isi.c      |  8 +++----
>>  .../media/platform/nvidia/tegra-vde/h264.c    | 10 ++++----
>>  .../platform/samsung/exynos-gsc/gsc-core.c    | 10 ++++----
>>  .../platform/samsung/exynos4-is/fimc-core.c   | 10 ++++----
>>  .../media/platform/st/sti/bdisp/bdisp-v4l2.c  | 10 ++++----
>>  drivers/media/platform/ti/cal/cal.c           |  8 +++----
>>  8 files changed, 44 insertions(+), 44 deletions(-)
>>
> 
>
Wolfram Sang Aug. 7, 2024, 2:26 p.m. UTC | #3
Hi Hans,

thanks for the fast reply!

> > Can you resend this series? This patch series wasn't picked up by our patchwork,
> > probably due to a full filesystem.

You use the kernel.org one, or? There was an update including a small
downtime but no mail got lost. patchwork only needs to catch up.

> I'll let you know when it is OK again.

Seems to be good now?

https://patchwork.kernel.org/project/linux-media/list/?series=876862

> > Apologies for the inconvenience.

No worries, things happen!

All the best,

   Wolfram
Hans Verkuil Aug. 7, 2024, 2:29 p.m. UTC | #4
On 07/08/2024 16:26, Wolfram Sang wrote:
> Hi Hans,
> 
> thanks for the fast reply!
> 
>>> Can you resend this series? This patch series wasn't picked up by our patchwork,
>>> probably due to a full filesystem.
> 
> You use the kernel.org one, or? There was an update including a small
> downtime but no mail got lost. patchwork only needs to catch up.

No, we use https://patchwork.linuxtv.org/project/linux-media/list/

The server was rebooted and now emails are trickling in again.

I'm optimistic that nothing was lost, but I'll let you know if your
series disappeared after all.

Regards,

	Hans

> 
>> I'll let you know when it is OK again.
> 
> Seems to be good now?
> 
> https://patchwork.kernel.org/project/linux-media/list/?series=876862
> 
>>> Apologies for the inconvenience.
> 
> No worries, things happen!
> 
> All the best,
> 
>    Wolfram
>