Browse Source

Tweaked API to minimise changes to existing drivers even further.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
cfe3a663af
4 changed files with 12 additions and 12 deletions
  1. 9
    9
      src/drivers/bus/pci.c
  2. 1
    1
      src/drivers/net/pnic.c
  3. 1
    1
      src/include/dev.h
  4. 1
    1
      src/include/pci.h

+ 9
- 9
src/drivers/bus/pci.c View File

143
  *
143
  *
144
  */
144
  */
145
 static int pci_check_driver ( struct bus_dev *bus_dev,
145
 static int pci_check_driver ( struct bus_dev *bus_dev,
146
-		       struct device_driver *device_driver ) {
146
+			      struct device_driver *device_driver ) {
147
 	struct pci_device *pci = ( struct pci_device * ) bus_dev;
147
 	struct pci_device *pci = ( struct pci_device * ) bus_dev;
148
-	struct pci_driver_info *pci_driver_info
149
-		= ( struct pci_driver_info * ) device_driver->bus_driver_info;
148
+	struct pci_driver *pci_driver
149
+		= ( struct pci_driver * ) device_driver->bus_driver_info;
150
 	unsigned int i;
150
 	unsigned int i;
151
 
151
 
152
 	/* If driver has a class, and class matches, use it */
152
 	/* If driver has a class, and class matches, use it */
153
-	if ( pci_driver_info->class && 
154
-	     ( pci_driver_info->class == pci->class ) ) {
153
+	if ( pci_driver->class && 
154
+	     ( pci_driver->class == pci->class ) ) {
155
 		DBG ( "driver %s matches class %hx\n",
155
 		DBG ( "driver %s matches class %hx\n",
156
-		      device_driver->name, pci_driver_info->class );
156
+		      device_driver->name, pci_driver->class );
157
 		pci->name = device_driver->name;
157
 		pci->name = device_driver->name;
158
 		return 1;
158
 		return 1;
159
 	}
159
 	}
160
 		
160
 		
161
 	/* If any of driver's IDs match, use it */
161
 	/* If any of driver's IDs match, use it */
162
-	for ( i = 0 ; i < pci_driver_info->id_count; i++ ) {
163
-		struct pci_id *id = &pci_driver_info->ids[i];
162
+	for ( i = 0 ; i < pci_driver->id_count; i++ ) {
163
+		struct pci_id *id = &pci_driver->ids[i];
164
 		
164
 		
165
 		if ( ( pci->vendor_id == id->vendor_id ) &&
165
 		if ( ( pci->vendor_id == id->vendor_id ) &&
166
 		     ( pci->device_id == id->device_id ) ) {
166
 		     ( pci->device_id == id->device_id ) ) {
193
  * Name a PCI device
193
  * Name a PCI device
194
  *
194
  *
195
  */
195
  */
196
-static char * pci_name ( struct bus_dev *bus_dev ) {
196
+static const char * pci_name ( struct bus_dev *bus_dev ) {
197
 	struct pci_device *pci = ( struct pci_device * ) bus_dev;
197
 	struct pci_device *pci = ( struct pci_device * ) bus_dev;
198
 	
198
 	
199
 	return pci->name;
199
 	return pci->name;

+ 1
- 1
src/drivers/net/pnic.c View File

246
 PCI_ROM ( 0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor" ),
246
 PCI_ROM ( 0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor" ),
247
 };
247
 };
248
 
248
 
249
-static struct pci_driver_info pnic_driver =
249
+static struct pci_driver pnic_driver =
250
 	PCI_DRIVER ( pnic_nics, PCI_NO_CLASS );
250
 	PCI_DRIVER ( pnic_nics, PCI_NO_CLASS );
251
 
251
 
252
 DRIVER ( "PNIC", nic_driver, pci_driver, pnic_driver,
252
 DRIVER ( "PNIC", nic_driver, pci_driver, pnic_driver,

+ 1
- 1
src/include/dev.h View File

154
 	int ( *check_driver ) ( struct bus_dev *bus_dev,
154
 	int ( *check_driver ) ( struct bus_dev *bus_dev,
155
 				struct device_driver *device_driver );
155
 				struct device_driver *device_driver );
156
 	char * ( *describe ) ( struct bus_dev *bus_dev );
156
 	char * ( *describe ) ( struct bus_dev *bus_dev );
157
-	char * ( *name ) ( struct bus_dev *bus_dev );
157
+	const char * ( *name ) ( struct bus_dev *bus_dev );
158
 };
158
 };
159
 
159
 
160
 #define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))
160
 #define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))

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

296
  * can handle an entire class of devices.
296
  * can handle an entire class of devices.
297
  *
297
  *
298
  */
298
  */
299
-struct pci_driver_info {
299
+struct pci_driver {
300
 	struct pci_id *ids;
300
 	struct pci_id *ids;
301
 	unsigned int id_count;
301
 	unsigned int id_count;
302
 	uint16_t class;
302
 	uint16_t class;

Loading…
Cancel
Save