Browse Source

[device] Make driver name a generic device property

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
fc7e2be617

+ 2
- 2
src/drivers/bus/eisa.c View File

@@ -63,8 +63,8 @@ static int eisa_probe ( struct eisa_device *eisa ) {
63 63
 			     ISA_PROD_ID ( eisa->prod_id ) )
64 64
 				continue;
65 65
 			eisa->driver = driver;
66
-			eisa->driver_name = id->name;
67
-			DBG ( "...using driver %s\n", eisa->driver_name );
66
+			eisa->dev.driver_name = id->name;
67
+			DBG ( "...using driver %s\n", eisa->dev.driver_name );
68 68
 			if ( ( rc = driver->probe ( eisa, id ) ) != 0 ) {
69 69
 				DBG ( "......probe failed\n" );
70 70
 				continue;

+ 1
- 0
src/drivers/bus/isa.c View File

@@ -114,6 +114,7 @@ static int isabus_probe ( struct root_device *rootdev ) {
114 114
 			/* Add to device hierarchy */
115 115
 			snprintf ( isa->dev.name, sizeof ( isa->dev.name ),
116 116
 				   "ISA%04x", isa->ioaddr );
117
+			isa->dev.driver_name = driver->name;
117 118
 			isa->dev.desc.bus_type = BUS_TYPE_ISA;
118 119
 			isa->dev.desc.vendor = driver->vendor_id;
119 120
 			isa->dev.desc.device = driver->prod_id;

+ 2
- 2
src/drivers/bus/isapnp.c View File

@@ -600,8 +600,8 @@ static int isapnp_probe ( struct isapnp_device *isapnp ) {
600 600
 			     ISA_PROD_ID ( isapnp->prod_id ) )
601 601
 				continue;
602 602
 			isapnp->driver = driver;
603
-			isapnp->driver_name = id->name;
604
-			DBG ( "...using driver %s\n", isapnp->driver_name );
603
+			isapnp->dev.driver_name = id->name;
604
+			DBG ( "...using driver %s\n", isapnp->dev.driver_name );
605 605
 			if ( ( rc = driver->probe ( isapnp, id ) ) != 0 ) {
606 606
 				DBG ( "......probe failed\n" );
607 607
 				continue;

+ 2
- 2
src/drivers/bus/mca.c View File

@@ -44,8 +44,8 @@ static int mca_probe ( struct mca_device *mca ) {
44 44
 			if ( id->id != MCA_ID ( mca ) )
45 45
 				continue;
46 46
 			mca->driver = driver;
47
-			mca->driver_name = id->name;
48
-			DBG ( "...using driver %s\n", mca->driver_name );
47
+			mca->dev.driver_name = id->name;
48
+			DBG ( "...using driver %s\n", mca->dev.driver_name );
49 49
 			if ( ( rc = driver->probe ( mca, id ) ) != 0 ) {
50 50
 				DBG ( "......probe failed\n" );
51 51
 				continue;

+ 1
- 0
src/drivers/linux/linux.c View File

@@ -75,6 +75,7 @@ static int linux_probe(struct root_device *rootdev)
75 75
 
76 76
 		if (driver->probe(device, request) == 0) {
77 77
 			device->driver = driver;
78
+			device->dev.driver_name = driver->name;
78 79
 			/* Driver handled the device so release ownership */
79 80
 			device = NULL;
80 81
 		} else {

+ 2
- 0
src/include/ipxe/device.h View File

@@ -58,6 +58,8 @@ struct device_description {
58 58
 struct device {
59 59
 	/** Name */
60 60
 	char name[16];
61
+	/** Driver name */
62
+	const char *driver_name;
61 63
 	/** Device description */
62 64
 	struct device_description desc;
63 65
 	/** Devices on the same bus */

+ 0
- 2
src/include/ipxe/eisa.h View File

@@ -54,8 +54,6 @@ struct eisa_device {
54 54
 	 * this field.
55 55
 	 */
56 56
 	void *priv;
57
-	/** Driver name */
58
-	const char *driver_name;
59 57
 };
60 58
 
61 59
 /** An EISA driver */

+ 0
- 2
src/include/ipxe/isa.h View File

@@ -22,8 +22,6 @@ struct isa_device {
22 22
 	 * this field.
23 23
 	 */
24 24
 	void *priv;
25
-	/** Driver name */
26
-	const char *driver_name;
27 25
 };
28 26
 
29 27
 /*

+ 0
- 2
src/include/ipxe/isapnp.h View File

@@ -198,8 +198,6 @@ struct isapnp_device {
198 198
 	 * this field.
199 199
 	 */
200 200
 	void *priv;
201
-	/** Driver name */
202
-	const char *driver_name;
203 201
 };
204 202
 
205 203
 /** An ISAPnP driver */

+ 0
- 2
src/include/ipxe/mca.h View File

@@ -50,8 +50,6 @@ struct mca_device {
50 50
 	 * this field.
51 51
 	 */
52 52
 	void *priv;
53
-	/** Driver name */
54
-	const char *driver_name;
55 53
 };
56 54
 
57 55
 #define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )

+ 1
- 0
src/include/ipxe/pci.h View File

@@ -410,6 +410,7 @@ static inline void pci_set_driver ( struct pci_device *pci,
410 410
 				    struct pci_device_id *id ) {
411 411
 	pci->driver = driver;
412 412
 	pci->id = id;
413
+	pci->dev.driver_name = id->name;
413 414
 }
414 415
 
415 416
 /**

+ 3
- 2
src/usr/ifmgmt.c View File

@@ -87,9 +87,10 @@ static void ifstat_errors ( struct net_device_stats *stats,
87 87
  * @v netdev		Network device
88 88
  */
89 89
 void ifstat ( struct net_device *netdev ) {
90
-	printf ( "%s: %s on %s (%s)\n"
90
+	printf ( "%s: %s using %s on %s (%s)\n"
91 91
 		 "  [Link:%s, TX:%d TXE:%d RX:%d RXE:%d]\n",
92
-		 netdev->name, netdev_addr ( netdev ), netdev->dev->name,
92
+		 netdev->name, netdev_addr ( netdev ),
93
+		 netdev->dev->driver_name, netdev->dev->name,
93 94
 		 ( netdev_is_open ( netdev ) ? "open" : "closed" ),
94 95
 		 ( netdev_link_ok ( netdev ) ? "up" : "down" ),
95 96
 		 netdev->tx_stats.good, netdev->tx_stats.bad,

Loading…
Cancel
Save