Fixed inconsistent behavior, removed unnecesary while loop
This commit is contained in:
parent
047a057e9b
commit
f437724cb1
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../system/vfs.h"
|
#include "../system/vfs.h"
|
||||||
#include "../shared/string.h"
|
#include "../shared/string.h"
|
||||||
#include "../shared/memory.h"
|
#include "../shared/memory.h"
|
||||||
|
#include "../drivers/serial.h"
|
||||||
#define MODULE_NAME "PCI"
|
#define MODULE_NAME "PCI"
|
||||||
|
|
||||||
char *classes[][20] = {
|
char *classes[][20] = {
|
||||||
|
|
@ -79,20 +80,21 @@ void pci_make_file(uint32_t class, uint8_t bus, uint8_t slot, uint8_t func){
|
||||||
char cpy[256];
|
char cpy[256];
|
||||||
vfile_t *file = 0;
|
vfile_t *file = 0;
|
||||||
uint8_t tries = 0;
|
uint8_t tries = 0;
|
||||||
while(file == 0){
|
// while(file == 0){
|
||||||
itoa(tries++, num, 10);
|
itoa(tries++, num, 10);
|
||||||
strcpy(str, cpy);
|
strcpy(str, cpy);
|
||||||
strcpy(num, cpy + strlen(cpy));
|
strcpy(num, cpy + strlen(cpy));
|
||||||
file = fcreate(cpy, 0);
|
file = fcreate(cpy, 0);
|
||||||
// file->read = pci_read_file;
|
// file->read = pci_read_file;
|
||||||
// file->write = pci_write_file;
|
// file->write = pci_write_file;
|
||||||
if(file == 0) break;
|
// if(file == 0) break;
|
||||||
file->fileops = &pci_fileops;
|
if(!file){
|
||||||
if(tries >= 254){
|
mlog(MODULE_NAME, "Failed to make file for PCI device!\n", MLOG_PRINT);
|
||||||
mlog(MODULE_NAME, "Failed to make PCI file for device!\n", MLOG_PRINT);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
// printf("ASSERT file == null: %d\n", file == 0);
|
||||||
|
file->fileops = &pci_fileops;
|
||||||
|
// }
|
||||||
file->id = (uint32_t)slot | ((uint32_t)func << 8) | ((uint32_t)bus << 16);
|
file->id = (uint32_t)slot | ((uint32_t)func << 8) | ((uint32_t)bus << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue