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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 25 Jul 2014 10:04:54 +0100
From:	Ian Abbott <abbotti@....co.uk>
To:	driverdev-devel@...uxdriverproject.org
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Ian Abbott <abbotti@....co.uk>,
	H Hartley Sweeten <hartleys@...ionengravers.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 08/12] staging: comedi: amplc_pc236: split pc236_boards[] into ISA & PCI

Split `pc236_boards[]` into `pc236_isa_boards[]` for ISA cards and
`pc236_pci_boards[]` for PCI cards (there is only one of each).  Only
initialize the board name look-up members of `struct comedi_driver
amplc_pc236_driver` if the ISA part of the driver is enabled in the
kernel config (`CONFIG_COMEDI_AMPLC_PC236_ISA`) using the array of ISA
boards (`pc236_isa_boards[]`).  The driver doesn't allow manual
configuration of PCI devices, so there is no point having the comedi
core match the names of the PCI boards before it calls our driver's
legacy attach routine (`pc236_attach()`).

Signed-off-by: Ian Abbott <abbotti@....co.uk>
---
 drivers/staging/comedi/drivers/amplc_pc236.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
index 129578f..0a5ba10 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -88,20 +88,20 @@ struct pc236_board {
 	unsigned short devid;
 	enum pc236_bustype bustype;
 };
-static const struct pc236_board pc236_boards[] = {
-#if DO_ISA
+
+static const struct pc236_board pc236_isa_boards[] = {
 	{
 		.name = "pc36at",
 		.bustype = isa_bustype,
 	},
-#endif
-#if DO_PCI
+};
+
+static const struct pc236_board pc236_pci_boards[] = {
 	{
 		.name = "pci236",
 		.devid = PCI_DEVICE_ID_AMPLICON_PCI236,
 		.bustype = pci_bustype,
 	},
-#endif
 };
 
 struct pc236_private {
@@ -128,10 +128,10 @@ static const struct pc236_board *pc236_find_pci_board(struct pci_dev *pci_dev)
 {
 	unsigned int i;
 
-	for (i = 0; i < ARRAY_SIZE(pc236_boards); i++)
-		if (is_pci_board(&pc236_boards[i]) &&
-		    pci_dev->device == pc236_boards[i].devid)
-			return &pc236_boards[i];
+	for (i = 0; i < ARRAY_SIZE(pc236_pci_boards); i++)
+		if (is_pci_board(&pc236_pci_boards[i]) &&
+		    pci_dev->device == pc236_pci_boards[i].devid)
+			return &pc236_pci_boards[i];
 	return NULL;
 }
 
@@ -429,9 +429,11 @@ static struct comedi_driver amplc_pc236_driver = {
 	.attach = pc236_attach,
 	.auto_attach = pc236_auto_attach,
 	.detach = pc236_detach,
-	.board_name = &pc236_boards[0].name,
+#if DO_ISA
+	.board_name = &pc236_isa_boards[0].name,
 	.offset = sizeof(struct pc236_board),
-	.num_names = ARRAY_SIZE(pc236_boards),
+	.num_names = ARRAY_SIZE(pc236_isa_boards),
+#endif
 };
 
 #if DO_PCI
-- 
2.0.0

--
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