Add "name" field to struct device to allow human-readable hardware device

names.

Add "dev" pointer in struct net_device to tie network interfaces back to a
hardware device.

Force natural alignment of data types in __table() macros.  This seems to
prevent gcc from taking the unilateral decision to occasionally increase
their alignment (which screws up the table packing).
This commit is contained in:
Michael Brown
2007-01-10 04:22:09 +00:00
parent cc9b32c405
commit dad5274522
51 changed files with 184 additions and 135 deletions

View File

@@ -19,6 +19,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vsprintf.h>
#include <gpxe/pci.h>
#include <undi.h>
#include <undirom.h>
@@ -96,6 +97,8 @@ static int undipci_probe ( struct pci_device *pci,
}
/* Add to device hierarchy */
snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
"UNDI%04x:%04x", undi->entry.segment, undi->entry.offset );
undi->dev.parent = &pci->dev;
INIT_LIST_HEAD ( &undi->dev.children );
list_add ( &undi->dev.siblings, &pci->dev.children );

View File

@@ -577,6 +577,7 @@ int undinet_probe ( struct undi_device *undi ) {
return -ENOMEM;
undinic = netdev->priv;
undi_set_drvdata ( undi, netdev );
netdev->dev = &undi->dev;
memset ( undinic, 0, sizeof ( *undinic ) );
undinic->entry = undi->entry;
DBGC ( undinic, "UNDINIC %p using UNDI %p\n", undinic, undi );

View File

@@ -58,6 +58,8 @@ static int undibus_probe ( struct root_device *rootdev ) {
}
/* Add to device hierarchy */
strncpy ( preloaded_undi.dev.name, "UNDI",
( sizeof ( preloaded_undi.dev.name ) - 1 ) );
preloaded_undi.dev.parent = &rootdev->dev;
list_add ( &preloaded_undi.dev.siblings, &rootdev->dev.children);
INIT_LIST_HEAD ( &preloaded_undi.dev.children );
@@ -91,6 +93,6 @@ static struct root_driver undi_root_driver = {
/** UNDI bus root device */
struct root_device undi_root_device __root_device = {
.name = "UNDI",
.dev = { .name = "UNDI" },
.driver = &undi_root_driver,
};