From abd34d8d6b213c792c1a06fd75488595c5fb6d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=83=C2=B8rn=20Mork?= Date: Mon, 21 Mar 2011 11:35:56 -0300 Subject: [media] use pci_dev->revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pci_setup_device() has saved the PCI revision in the pci_dev struct since Linux 2.6.23. Use it. Cc: Auke Kok Signed-off-by: Bjørn Mork Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/video/cx88/cx88-video.c') diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 287a41ee1c4f..b1f734dccea0 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1832,7 +1832,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, dev->core = core; /* print pci info */ - pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); + dev->pci_rev = pci_dev->revision; pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " "latency: %d, mmio: 0x%llx\n", core->name, -- cgit v1.2.2 From 8d115931622eb19a15f2633cb35dd2c4a66db255 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 1 May 2011 06:31:40 -0300 Subject: [media] cx88: don't use atomic_t for core->users users is always read or written with core->lock held. A plain int is simpler and faster. Tested-by: Andi Huber Tested-by: Marlon de Boer Signed-off-by: Jonathan Nieder Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/media/video/cx88/cx88-video.c') diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index b1f734dccea0..cef4f282e5aa 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -824,7 +824,7 @@ static int video_open(struct file *file) call_all(core, tuner, s_radio); } - atomic_inc(&core->users); + core->users++; mutex_unlock(&core->lock); return 0; @@ -922,7 +922,8 @@ static int video_release(struct file *file) file->private_data = NULL; kfree(fh); - if(atomic_dec_and_test(&dev->core->users)) + dev->core->users--; + if (!dev->core->users) call_all(dev->core, core, s_power, 0); mutex_unlock(&dev->core->lock); -- cgit v1.2.2