Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1455774 > unrolled thread

[PATCH v0 0/4] Use complete() instead of complete_all()

Started byDaniel Wagner <wagi@monom.org>
First post2016-08-03 14:20 +0200
Last post2016-08-05 06:20 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v0 0/4] Use complete() instead of complete_all() Daniel Wagner <wagi@monom.org> - 2016-08-03 14:20 +0200
    [PATCH v0 1/4] i2c: bcm-iproc: Use complete() instead of complete_all() Daniel Wagner <wagi@monom.org> - 2016-08-03 14:20 +0200
      Re: [PATCH v0 1/4] i2c: bcm-iproc: Use complete() instead of  complete_all() Ray Jui <ray.jui@broadcom.com> - 2016-08-03 18:40 +0200
    [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all() Daniel Wagner <wagi@monom.org> - 2016-08-03 14:20 +0200
      Re: [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of  complete_all() Ray Jui <ray.jui@broadcom.com> - 2016-08-03 19:10 +0200
      Re: [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all() Tim Kryger <tim.kryger@gmail.com> - 2016-08-05 06:20 +0200

#1455774 — [PATCH v0 0/4] Use complete() instead of complete_all()

FromDaniel Wagner <wagi@monom.org>
Date2016-08-03 14:20 +0200
Subject[PATCH v0 0/4] Use complete() instead of complete_all()
Message-ID<s239M-2mN-45@gated-at.bofh.it>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>

Hi,

Using complete_all() is not wrong per se but it suggest that there
might be more than one reader. For -rt I am reviewing all
complete_all() users and would like to leave only the real ones in the
tree. The main problem for -rt about complete_all() is that it can be
uses inside IRQ context and that can lead to unbounded amount work
inside the interrupt handler. That is a no no for -rt.

The patches grouped per subsystem and in small batches to allow
reviewing. Unfortanatly I am not so good in coming up with unique
commit message, so please bear with me in that regard. I could also
squash them together, although each patch containts a very short
reasoning why there is only one waiter. Let me know what you rather
prefer. One patch which updates all complete_all() users or those 4
patches with some reasoning.

It is only test compiled because I don't have the all the hardware.

cheers,
daniel

Daniel Wagner (4):
  i2c: bcm-iproc: Use complete() instead of complete_all()
  i2c: bcm-kona: Use complete() instead of complete_all()
  i2c: brcmstb: Use complete() instead of complete_all()
  i2c: meson: Use complete() instead of complete_all()

 drivers/i2c/busses/i2c-bcm-iproc.c | 2 +-
 drivers/i2c/busses/i2c-bcm-kona.c  | 2 +-
 drivers/i2c/busses/i2c-brcmstb.c   | 2 +-
 drivers/i2c/busses/i2c-meson.c     | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1455775 — [PATCH v0 1/4] i2c: bcm-iproc: Use complete() instead of complete_all()

FromDaniel Wagner <wagi@monom.org>
Date2016-08-03 14:20 +0200
Subject[PATCH v0 1/4] i2c: bcm-iproc: Use complete() instead of complete_all()
Message-ID<s23jr-2qd-17@gated-at.bofh.it>
In reply to#1455774
From: Daniel Wagner <daniel.wagner@bmw-carit.de>

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

bcm_iproc_i2c_xfer_single_msg()
  reinit_completion()
  ...
  (activate the transfer)
  ...
  wait_for_completion_timeout()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 drivers/i2c/busses/i2c-bcm-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index 19c8438..95f7cac 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -158,7 +158,7 @@ static irqreturn_t bcm_iproc_i2c_isr(int irq, void *data)
 
 	if (status & BIT(IS_M_START_BUSY_SHIFT)) {
 		iproc_i2c->xfer_is_done = 1;
-		complete_all(&iproc_i2c->done);
+		complete(&iproc_i2c->done);
 	}
 
 	writel(status, iproc_i2c->base + IS_OFFSET);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1455889 — Re: [PATCH v0 1/4] i2c: bcm-iproc: Use complete() instead of complete_all()

FromRay Jui <ray.jui@broadcom.com>
Date2016-08-03 18:40 +0200
SubjectRe: [PATCH v0 1/4] i2c: bcm-iproc: Use complete() instead of complete_all()
Message-ID<s27n9-4Sd-31@gated-at.bofh.it>
In reply to#1455775
Hi Daniel,

On 8/3/2016 5:03 AM, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
>
> There is only one waiter for the completion, therefore there
> is no need to use complete_all(). Let's make that clear by
> using complete() instead of complete_all().
>
> The usage pattern of the completion is:
>
> bcm_iproc_i2c_xfer_single_msg()
>   reinit_completion()
>   ...
>   (activate the transfer)
>   ...
>   wait_for_completion_timeout()
>
> Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
> ---
>  drivers/i2c/busses/i2c-bcm-iproc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
> index 19c8438..95f7cac 100644
> --- a/drivers/i2c/busses/i2c-bcm-iproc.c
> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c
> @@ -158,7 +158,7 @@ static irqreturn_t bcm_iproc_i2c_isr(int irq, void *data)
>
>  	if (status & BIT(IS_M_START_BUSY_SHIFT)) {
>  		iproc_i2c->xfer_is_done = 1;
> -		complete_all(&iproc_i2c->done);
> +		complete(&iproc_i2c->done);
>  	}
>
>  	writel(status, iproc_i2c->base + IS_OFFSET);
>

Yes each time there's only one waiter invoked from the main transfer 
routine 'bcm_iproc_i2c_xfer_single_msg'.

This change looks good to me, thanks!

Acked-by: Ray Jui <ray.jui@broadcom.com>

[toc] | [prev] | [next] | [standalone]


#1455776 — [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all()

FromDaniel Wagner <wagi@monom.org>
Date2016-08-03 14:20 +0200
Subject[PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all()
Message-ID<s23jr-2qd-19@gated-at.bofh.it>
In reply to#1455774
From: Daniel Wagner <daniel.wagner@bmw-carit.de>

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

The usage pattern of the completion is:

bcm_kona_send_i2c_cmd()
  reinit_completion()
  ...
  bcm_kona_i2c_send_cmd_to_ctrl()
  ...
  wait_for_completion_timeout()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 drivers/i2c/busses/i2c-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c
index ac9f476..f987432 100644
--- a/drivers/i2c/busses/i2c-bcm-kona.c
+++ b/drivers/i2c/busses/i2c-bcm-kona.c
@@ -229,7 +229,7 @@ static irqreturn_t bcm_kona_i2c_isr(int irq, void *devid)
 		       dev->base + TXFCR_OFFSET);
 
 	writel(status & ~ISR_RESERVED_MASK, dev->base + ISR_OFFSET);
-	complete_all(&dev->done);
+	complete(&dev->done);
 
 	return IRQ_HANDLED;
 }
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1455904 — Re: [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all()

FromRay Jui <ray.jui@broadcom.com>
Date2016-08-03 19:10 +0200
SubjectRe: [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all()
Message-ID<s27Q5-5ht-11@gated-at.bofh.it>
In reply to#1455776
Hi Daniel,

On 8/3/2016 5:03 AM, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
>
> There is only one waiter for the completion, therefore there
> is no need to use complete_all(). Let's make that clear by
> using complete() instead of complete_all().
>
> The usage pattern of the completion is:
>
> bcm_kona_send_i2c_cmd()
>   reinit_completion()
>   ...
>   bcm_kona_i2c_send_cmd_to_ctrl()
>   ...
>   wait_for_completion_timeout()
>
> Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
> ---
>  drivers/i2c/busses/i2c-bcm-kona.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c
> index ac9f476..f987432 100644
> --- a/drivers/i2c/busses/i2c-bcm-kona.c
> +++ b/drivers/i2c/busses/i2c-bcm-kona.c
> @@ -229,7 +229,7 @@ static irqreturn_t bcm_kona_i2c_isr(int irq, void *devid)
>  		       dev->base + TXFCR_OFFSET);
>
>  	writel(status & ~ISR_RESERVED_MASK, dev->base + ISR_OFFSET);
> -	complete_all(&dev->done);
> +	complete(&dev->done);
>
>  	return IRQ_HANDLED;
>  }
>

This change looks good me! Thanks.

Acked-by: Ray Jui <ray.jui@broadcom.com>

[toc] | [prev] | [next] | [standalone]


#1456870 — Re: [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all()

FromTim Kryger <tim.kryger@gmail.com>
Date2016-08-05 06:20 +0200
SubjectRe: [PATCH v0 2/4] i2c: bcm-kona: Use complete() instead of complete_all()
Message-ID<s2EM1-2By-3@gated-at.bofh.it>
In reply to#1455776
On Wed, Aug 3, 2016 at 5:03 AM, Daniel Wagner <wagi@monom.org> wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
>
> There is only one waiter for the completion, therefore there
> is no need to use complete_all(). Let's make that clear by
> using complete() instead of complete_all().
>
> The usage pattern of the completion is:
>
> bcm_kona_send_i2c_cmd()
>   reinit_completion()
>   ...
>   bcm_kona_i2c_send_cmd_to_ctrl()
>   ...
>   wait_for_completion_timeout()
>
> Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>

Reviewed-by: Tim Kryger <tim.kryger@gmail.com>

> ---
>  drivers/i2c/busses/i2c-bcm-kona.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c
> index ac9f476..f987432 100644
> --- a/drivers/i2c/busses/i2c-bcm-kona.c
> +++ b/drivers/i2c/busses/i2c-bcm-kona.c
> @@ -229,7 +229,7 @@ static irqreturn_t bcm_kona_i2c_isr(int irq, void *devid)
>                        dev->base + TXFCR_OFFSET);
>
>         writel(status & ~ISR_RESERVED_MASK, dev->base + ISR_OFFSET);
> -       complete_all(&dev->done);
> +       complete(&dev->done);
>
>         return IRQ_HANDLED;
>  }
> --
> 2.7.4
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web