mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: peterz@infradead.org, mingo@kernel.org, davem@davemloft.net,
	cw00.choi@samsung.com, dougthompson@xmission.com, bp@alien8.de,
	gregkh@linuxfoundation.org, pfg@sgi.com, jikos@kernel.org,
	hans.verkuil@cisco.com, awalls@md.metrocast.net,
	dledford@redhat.com, sean.hefty@intel.com, kys@microsoft.com,
	heiko.carstens@de.ibm.com, James.Bottomley@HansenPartnership.com,
	sumit.semwal@linaro.org, schwidefsky@de.ibm.com,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH 07/12] drivers/media: Employ atomic_fetch_inc()
Date: Wed, 13 Jul 2016 13:07:14 -0300	[thread overview]
Message-ID: <20160713130714.286b1f31@recife.lan> (raw)
In-Reply-To: <1466453164-13185-8-git-send-email-dave@stgolabs.net>

Em Mon, 20 Jun 2016 13:05:59 -0700
Davidlohr Bueso <dave@stgolabs.net> escreveu:

> Now that we have fetch_inc() we can stop using inc_return() - 1.
> 
> These are very similar to the existing OP-RETURN primitives we already
> have, except they return the value of the atomic variable _before_
> modification.
> 
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: Andy Walls <awalls@md.metrocast.net>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>

I suspect that you'll be applying this together with the other patches
in this series. So:

Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

> ---
>  drivers/media/pci/cobalt/cobalt-driver.c | 2 +-
>  drivers/media/pci/cx18/cx18-driver.c     | 2 +-
>  drivers/media/v4l2-core/v4l2-device.c    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c
> index 8d6f04fc8013..70dfcb0c6a72 100644
> --- a/drivers/media/pci/cobalt/cobalt-driver.c
> +++ b/drivers/media/pci/cobalt/cobalt-driver.c
> @@ -683,7 +683,7 @@ static int cobalt_probe(struct pci_dev *pci_dev,
>  	int i;
>  
>  	/* FIXME - module parameter arrays constrain max instances */
> -	i = atomic_inc_return(&cobalt_instance) - 1;
> +	i = atomic_fetch_inc(&cobalt_instance);
>  
>  	cobalt = kzalloc(sizeof(struct cobalt), GFP_ATOMIC);
>  	if (cobalt == NULL)
> diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
> index 260e462d91b4..5cb3408c6859 100644
> --- a/drivers/media/pci/cx18/cx18-driver.c
> +++ b/drivers/media/pci/cx18/cx18-driver.c
> @@ -908,7 +908,7 @@ static int cx18_probe(struct pci_dev *pci_dev,
>  	struct cx18 *cx;
>  
>  	/* FIXME - module parameter arrays constrain max instances */
> -	i = atomic_inc_return(&cx18_instance) - 1;
> +	i = atomic_fetch_inc(&cx18_instance);
>  	if (i >= CX18_MAX_CARDS) {
>  		printk(KERN_ERR "cx18: cannot manage card %d, driver has a "
>  		       "limit of 0 - %d\n", i, CX18_MAX_CARDS - 1);
> diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
> index 06fa5f1b2cff..1bc5b68c2724 100644
> --- a/drivers/media/v4l2-core/v4l2-device.c
> +++ b/drivers/media/v4l2-core/v4l2-device.c
> @@ -76,7 +76,7 @@ EXPORT_SYMBOL_GPL(v4l2_device_put);
>  int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
>  						atomic_t *instance)
>  {
> -	int num = atomic_inc_return(instance) - 1;
> +	int num = atomic_fetch_inc(instance);
>  	int len = strlen(basename);
>  
>  	if (basename[len - 1] >= '0' && basename[len - 1] <= '9')



Thanks,
Mauro

  reply	other threads:[~2016-07-13 16:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 20:05 [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls for FETCH-OP flavors Davidlohr Bueso
2016-06-20 20:05 ` [PATCH 01/12] locking/atomic: Introduce inc/dec " Davidlohr Bueso
2016-06-21  7:28   ` Peter Zijlstra
2016-06-21 13:33   ` [PATCH v2 " Davidlohr Bueso
2016-06-21 16:36     ` Davidlohr Bueso
2016-06-23  9:09       ` Peter Zijlstra
2016-06-24 16:34         ` Davidlohr Bueso
2016-06-24 18:48           ` Peter Zijlstra
2016-06-28 21:56             ` [PATCH -v4 " Davidlohr Bueso
2016-07-07  8:33               ` [tip:locking/core] locking/atomic: Introduce inc/dec variants for the atomic_fetch_$op() API tip-bot for Davidlohr Bueso
2016-06-20 20:05 ` [PATCH 02/12] net/neighbour: Employ atomic_fetch_inc() Davidlohr Bueso
2016-06-20 20:05 ` [PATCH 03/12] PM,devfreq: " Davidlohr Bueso
2016-07-02  5:04   ` Chanwoo Choi
2016-06-20 20:05 ` [PATCH 04/12] EDAC: " Davidlohr Bueso
2016-06-21 13:59   ` Borislav Petkov
2016-06-20 20:05 ` [PATCH 05/12] tty/serial: " Davidlohr Bueso
2016-06-20 20:05 ` [PATCH 06/12] HID,wacom: " Davidlohr Bueso
2016-06-22  8:10   ` Jiri Kosina
2016-06-20 20:05 ` [PATCH 07/12] drivers/media: " Davidlohr Bueso
2016-07-13 16:07   ` Mauro Carvalho Chehab [this message]
2016-06-20 20:06 ` [PATCH 08/12] infiniband: " Davidlohr Bueso
2016-06-20 20:06 ` [PATCH 09/12] drivers/hv: " Davidlohr Bueso
2016-06-20 20:06 ` [PATCH 10/12] s390/scm_block: " Davidlohr Bueso
2016-06-20 20:06 ` [PATCH 11/12] scsi: " Davidlohr Bueso
2016-06-20 20:06 ` [PATCH 12/12] dma-buf/fence: Employ atomic_fetch_add Davidlohr Bueso
2016-06-24 16:46 ` [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls for FETCH-OP flavors James Bottomley
2016-06-24 17:30   ` Davidlohr Bueso
2016-06-24 17:44     ` James Bottomley
2016-06-24 20:35       ` Davidlohr Bueso
2016-06-24 17:45     ` KY Srinivasan
2016-06-24 19:35       ` Davidlohr Bueso
2016-06-24 19:17   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160713130714.286b1f31@recife.lan \
    --to=mchehab@s-opensource.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=awalls@md.metrocast.net \
    --cc=bp@alien8.de \
    --cc=cw00.choi@samsung.com \
    --cc=dave@stgolabs.net \
    --cc=davem@davemloft.net \
    --cc=dbueso@suse.de \
    --cc=dledford@redhat.com \
    --cc=dougthompson@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hans.verkuil@cisco.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jikos@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pfg@sgi.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=sean.hefty@intel.com \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome