]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[device] Make driver name a generic device property
authorMichael Brown <mcb30@ipxe.org>
Thu, 7 Apr 2011 19:59:47 +0000 (20:59 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 7 Apr 2011 22:09:19 +0000 (23:09 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
12 files changed:
src/drivers/bus/eisa.c
src/drivers/bus/isa.c
src/drivers/bus/isapnp.c
src/drivers/bus/mca.c
src/drivers/linux/linux.c
src/include/ipxe/device.h
src/include/ipxe/eisa.h
src/include/ipxe/isa.h
src/include/ipxe/isapnp.h
src/include/ipxe/mca.h
src/include/ipxe/pci.h
src/usr/ifmgmt.c

index 22a615860686c65e74272823a6d208a69ecb9abb..a4efe2621f11bf27868282af0655b7d72ad81a6c 100644 (file)
@@ -63,8 +63,8 @@ static int eisa_probe ( struct eisa_device *eisa ) {
                             ISA_PROD_ID ( eisa->prod_id ) )
                                continue;
                        eisa->driver = driver;
-                       eisa->driver_name = id->name;
-                       DBG ( "...using driver %s\n", eisa->driver_name );
+                       eisa->dev.driver_name = id->name;
+                       DBG ( "...using driver %s\n", eisa->dev.driver_name );
                        if ( ( rc = driver->probe ( eisa, id ) ) != 0 ) {
                                DBG ( "......probe failed\n" );
                                continue;
index e40d382a64a50a3b20a7d4016a280bcf2d6fca57..9b562c6646c8457f179a82652f74a04b704949d3 100644 (file)
@@ -114,6 +114,7 @@ static int isabus_probe ( struct root_device *rootdev ) {
                        /* Add to device hierarchy */
                        snprintf ( isa->dev.name, sizeof ( isa->dev.name ),
                                   "ISA%04x", isa->ioaddr );
+                       isa->dev.driver_name = driver->name;
                        isa->dev.desc.bus_type = BUS_TYPE_ISA;
                        isa->dev.desc.vendor = driver->vendor_id;
                        isa->dev.desc.device = driver->prod_id;
index d8bfcd7c28794d76927a6b6beeed208cd1c6519a..f7845d3fa2ea09a25010b4c285acdd664a62d991 100644 (file)
@@ -600,8 +600,8 @@ static int isapnp_probe ( struct isapnp_device *isapnp ) {
                             ISA_PROD_ID ( isapnp->prod_id ) )
                                continue;
                        isapnp->driver = driver;
-                       isapnp->driver_name = id->name;
-                       DBG ( "...using driver %s\n", isapnp->driver_name );
+                       isapnp->dev.driver_name = id->name;
+                       DBG ( "...using driver %s\n", isapnp->dev.driver_name );
                        if ( ( rc = driver->probe ( isapnp, id ) ) != 0 ) {
                                DBG ( "......probe failed\n" );
                                continue;
index 055b010df1ba60226092f8c8ade6f3ee47d37231..0405c3b88197e43488215b8a89f1beecfe07cdec 100644 (file)
@@ -44,8 +44,8 @@ static int mca_probe ( struct mca_device *mca ) {
                        if ( id->id != MCA_ID ( mca ) )
                                continue;
                        mca->driver = driver;
-                       mca->driver_name = id->name;
-                       DBG ( "...using driver %s\n", mca->driver_name );
+                       mca->dev.driver_name = id->name;
+                       DBG ( "...using driver %s\n", mca->dev.driver_name );
                        if ( ( rc = driver->probe ( mca, id ) ) != 0 ) {
                                DBG ( "......probe failed\n" );
                                continue;
index 1f26f56630ebd694620a8adb78e932fe4714b7ba..83546b27e0e26ab39431b0d17556a22b0682148a 100644 (file)
@@ -75,6 +75,7 @@ static int linux_probe(struct root_device *rootdev)
 
                if (driver->probe(device, request) == 0) {
                        device->driver = driver;
+                       device->dev.driver_name = driver->name;
                        /* Driver handled the device so release ownership */
                        device = NULL;
                } else {
index 635ce59cc70322f70521286ec8568760370ea5f7..435af6ecfb6f198196ac6bbe3785991e6c7581e4 100644 (file)
@@ -58,6 +58,8 @@ struct device_description {
 struct device {
        /** Name */
        char name[16];
+       /** Driver name */
+       const char *driver_name;
        /** Device description */
        struct device_description desc;
        /** Devices on the same bus */
index 1588f81140dc94d7ab42562039b49931d90c70e8..22a1ed94ee53a228d3d60a033aae7ffb8b5a317b 100644 (file)
@@ -54,8 +54,6 @@ struct eisa_device {
         * this field.
         */
        void *priv;
-       /** Driver name */
-       const char *driver_name;
 };
 
 /** An EISA driver */
index 6d8f761618ca6e3b6300db63791cd18d76f2772d..4e69fc6f7c407aa2120050e852fef050186aa667 100644 (file)
@@ -22,8 +22,6 @@ struct isa_device {
         * this field.
         */
        void *priv;
-       /** Driver name */
-       const char *driver_name;
 };
 
 /*
index f2b0b34ac80d574eaad0af3d8283308f77344e82..47a47025bbf1958b64280902cf7127cd5dfccfb8 100644 (file)
@@ -198,8 +198,6 @@ struct isapnp_device {
         * this field.
         */
        void *priv;
-       /** Driver name */
-       const char *driver_name;
 };
 
 /** An ISAPnP driver */
index 79543c1a06a836e885e2e6c18983910b88294eed..d86dab1957881940d327b0b4c1306a9871a582ea 100644 (file)
@@ -50,8 +50,6 @@ struct mca_device {
         * this field.
         */
        void *priv;
-       /** Driver name */
-       const char *driver_name;
 };
 
 #define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )
index 90802a3f191e9aa9b287770be6baf84fee1018bc..960454d69df678fbecc658039090263cc28f7a3e 100644 (file)
@@ -410,6 +410,7 @@ static inline void pci_set_driver ( struct pci_device *pci,
                                    struct pci_device_id *id ) {
        pci->driver = driver;
        pci->id = id;
+       pci->dev.driver_name = id->name;
 }
 
 /**
index e9fdaad0d70d9c27b879a36ae6ff16419ab240e6..049851596da0514d1a8cd9077d3d950f73362872 100644 (file)
@@ -87,9 +87,10 @@ static void ifstat_errors ( struct net_device_stats *stats,
  * @v netdev           Network device
  */
 void ifstat ( struct net_device *netdev ) {
-       printf ( "%s: %s on %s (%s)\n"
+       printf ( "%s: %s using %s on %s (%s)\n"
                 "  [Link:%s, TX:%d TXE:%d RX:%d RXE:%d]\n",
-                netdev->name, netdev_addr ( netdev ), netdev->dev->name,
+                netdev->name, netdev_addr ( netdev ),
+                netdev->dev->driver_name, netdev->dev->name,
                 ( netdev_is_open ( netdev ) ? "open" : "closed" ),
                 ( netdev_link_ok ( netdev ) ? "up" : "down" ),
                 netdev->tx_stats.good, netdev->tx_stats.bad,