Commit a8d8e38a authored by Elena Reshetova's avatar Elena Reshetova Committed by Mauro Carvalho Chehab

[media] cx88: convert struct cx88_core.refcount from atomic_t to refcount_t

refcount_t is better suitable for counting references than atomic_t.
Signed-off-by: default avatarElena Reshetova <elena.reshetova@intel.com>
Signed-off-by: default avatarHans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid Windsor <dwindsor@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 6eae60c5
......@@ -3670,7 +3670,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
if (!core)
return NULL;
atomic_inc(&core->refcount);
refcount_set(&core->refcount, 1);
core->pci_bus = pci->bus->number;
core->pci_slot = PCI_SLOT(pci->devfn);
core->pci_irqmask = PCI_INT_RISC_RD_BERRINT | PCI_INT_RISC_WR_BERRINT |
......
......@@ -1052,7 +1052,7 @@ struct cx88_core *cx88_core_get(struct pci_dev *pci)
mutex_unlock(&devlist);
return NULL;
}
atomic_inc(&core->refcount);
refcount_inc(&core->refcount);
mutex_unlock(&devlist);
return core;
}
......@@ -1073,7 +1073,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
release_mem_region(pci_resource_start(pci, 0),
pci_resource_len(pci, 0));
if (!atomic_dec_and_test(&core->refcount))
if (!refcount_dec_and_test(&core->refcount))
return;
mutex_lock(&devlist);
......
......@@ -24,6 +24,7 @@
#include <linux/i2c-algo-bit.h>
#include <linux/videodev2.h>
#include <linux/kdev_t.h>
#include <linux/refcount.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fh.h>
......@@ -339,7 +340,7 @@ struct cx8802_dev;
struct cx88_core {
struct list_head devlist;
atomic_t refcount;
refcount_t refcount;
/* board name */
int nr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment