[RFC PATCH] pci: Improve handling of constant id_table pointer

Uwe Kleine-König uwe at kleine-koenig.org
Tue Apr 14 12:56:23 PDT 2015


From: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

This makes it more obvious why the cast is needed. Still looks ugly though.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 drivers/pci/bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 866ab08..fca4f5c 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -27,11 +27,11 @@ static int pci_match(struct device_d *dev, struct driver_d *drv)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct pci_driver *pdrv = to_pci_driver(drv);
-	struct pci_device_id *id;
+	const struct pci_device_id *id;
 
-	for (id = (struct pci_device_id *)pdrv->id_table; id->vendor; id++)
+	for (id = pdrv->id_table; id->vendor; id++)
 		if (pci_match_one_device(id, pdev)) {
-			dev->priv = id;
+			dev->priv = (/* non-const */ void *)id;
 			return 0;
 		}
 
-- 
2.1.4




More information about the barebox mailing list