lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1369583597-3801-17-git-send-email-jiang.liu@huawei.com>
Date:	Sun, 26 May 2013 23:53:13 +0800
From:	Jiang Liu <liuj97@...il.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>,
	Yinghai Lu <yinghai@...nel.org>
Cc:	Jiang Liu <jiang.liu@...wei.com>,
	"Rafael J . Wysocki" <rjw@...k.pl>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Gu Zheng <guz.fnst@...fujitsu.com>,
	Toshi Kani <toshi.kani@...com>,
	Myron Stowe <myron.stowe@...hat.com>,
	Yijing Wang <wangyijing@...wei.com>,
	Jiang Liu <liuj97@...il.com>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Mauro Carvalho Chehab <mchehab@...hat.com>,
	Daniel Drake <dsd@...top.org>,
	Jonathan Corbet <corbet@....net>,
	Javier Martin <javier.martin@...ta-silicon.com>,
	linux-media@...r.kernel.org
Subject: [PATCH v3, part2 16/20] PCI, via-camera: use hotplug-safe iterators to walk PCI buses

Enhance via-camera drviers to use hotplug-safe iterators to walk
PCI buses.

Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
Cc: Mauro Carvalho Chehab <mchehab@...hat.com>
Cc: Daniel Drake <dsd@...top.org>
Cc: Jonathan Corbet <corbet@....net>
Cc: Javier Martin <javier.martin@...ta-silicon.com>
Cc: linux-media@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
 drivers/media/platform/via-camera.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/via-camera.c b/drivers/media/platform/via-camera.c
index a794cd6..3ea3fac 100644
--- a/drivers/media/platform/via-camera.c
+++ b/drivers/media/platform/via-camera.c
@@ -1284,7 +1284,8 @@ static struct video_device viacam_v4l_template = {
 
 static bool viacam_serial_is_enabled(void)
 {
-	struct pci_bus *pbus = pci_find_bus(0, 0);
+	struct pci_bus *pbus = pci_get_bus(0, 0);
+	bool ret = false;
 	u8 cbyte;
 
 	if (!pbus)
@@ -1292,18 +1293,21 @@ static bool viacam_serial_is_enabled(void)
 	pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN,
 			VIACAM_SERIAL_CREG, &cbyte);
 	if ((cbyte & VIACAM_SERIAL_BIT) == 0)
-		return false; /* Not enabled */
+		goto out; /* Not enabled */
 	if (override_serial == 0) {
 		printk(KERN_NOTICE "Via camera: serial port is enabled, " \
 				"refusing to load.\n");
 		printk(KERN_NOTICE "Specify override_serial=1 to force " \
 				"module loading.\n");
-		return true;
+		ret = true;
+		goto out;
 	}
 	printk(KERN_NOTICE "Via camera: overriding serial port\n");
 	pci_bus_write_config_byte(pbus, VIACAM_SERIAL_DEVFN,
 			VIACAM_SERIAL_CREG, cbyte & ~VIACAM_SERIAL_BIT);
-	return false;
+out:
+	pci_bus_put(pbus);
+	return ret;
 }
 
 static struct ov7670_config sensor_cfg = {
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ