2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 23:31:39 +00:00

Tweaked API to minimise changes to existing drivers even further.

This commit is contained in:
Michael Brown 2005-04-21 19:04:53 +00:00
parent a713813596
commit cfe3a663af
4 changed files with 12 additions and 12 deletions

View File

@ -143,24 +143,24 @@ static int pci_fill_device ( struct bus_dev *bus_dev,
*
*/
static int pci_check_driver ( struct bus_dev *bus_dev,
struct device_driver *device_driver ) {
struct device_driver *device_driver ) {
struct pci_device *pci = ( struct pci_device * ) bus_dev;
struct pci_driver_info *pci_driver_info
= ( struct pci_driver_info * ) device_driver->bus_driver_info;
struct pci_driver *pci_driver
= ( struct pci_driver * ) device_driver->bus_driver_info;
unsigned int i;
/* If driver has a class, and class matches, use it */
if ( pci_driver_info->class &&
( pci_driver_info->class == pci->class ) ) {
if ( pci_driver->class &&
( pci_driver->class == pci->class ) ) {
DBG ( "driver %s matches class %hx\n",
device_driver->name, pci_driver_info->class );
device_driver->name, pci_driver->class );
pci->name = device_driver->name;
return 1;
}
/* If any of driver's IDs match, use it */
for ( i = 0 ; i < pci_driver_info->id_count; i++ ) {
struct pci_id *id = &pci_driver_info->ids[i];
for ( i = 0 ; i < pci_driver->id_count; i++ ) {
struct pci_id *id = &pci_driver->ids[i];
if ( ( pci->vendor_id == id->vendor_id ) &&
( pci->device_id == id->device_id ) ) {
@ -193,7 +193,7 @@ static char * pci_describe ( struct bus_dev *bus_dev ) {
* Name a PCI device
*
*/
static char * pci_name ( struct bus_dev *bus_dev ) {
static const char * pci_name ( struct bus_dev *bus_dev ) {
struct pci_device *pci = ( struct pci_device * ) bus_dev;
return pci->name;

View File

@ -246,7 +246,7 @@ static struct pci_id pnic_nics[] = {
PCI_ROM ( 0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor" ),
};
static struct pci_driver_info pnic_driver =
static struct pci_driver pnic_driver =
PCI_DRIVER ( pnic_nics, PCI_NO_CLASS );
DRIVER ( "PNIC", nic_driver, pci_driver, pnic_driver,

View File

@ -154,7 +154,7 @@ struct bus_driver {
int ( *check_driver ) ( struct bus_dev *bus_dev,
struct device_driver *device_driver );
char * ( *describe ) ( struct bus_dev *bus_dev );
char * ( *name ) ( struct bus_dev *bus_dev );
const char * ( *name ) ( struct bus_dev *bus_dev );
};
#define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))

View File

@ -296,7 +296,7 @@ struct pci_id {
* can handle an entire class of devices.
*
*/
struct pci_driver_info {
struct pci_driver {
struct pci_id *ids;
unsigned int id_count;
uint16_t class;