diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c index dba136897f..9f98b31210 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c @@ -737,6 +737,7 @@ init_driver(void) int ix = 0; void *settings_handle; pci_info info; + status_t err; num_cards = 0; PRINT(("init_driver()\n")); @@ -788,8 +789,21 @@ init_driver(void) } memset(&cards[num_cards], 0, sizeof(auich_dev)); cards[num_cards].info = info; +#ifdef __HAIKU__ + if ((err = (*pci->reserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards])) < B_OK) { + dprintf("%s: failed to reserve_device(%d, %d, %d,): %s\n", + DRIVER_NAME, info.bus, info.device, info.function, + strerror(err)); + continue; + } +#endif if (auich_setup(&cards[num_cards])) { PRINT(("Setup of auich %ld failed\n", num_cards+1)); +#ifdef __HAIKU__ + (*pci->unreserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards]); +#endif } else { num_cards++; diff --git a/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c b/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c index 09d5a1a63f..f1b0263683 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c @@ -576,8 +576,8 @@ status_t init_driver(void) { pci_info info; + status_t err; int ix = 0; - num_cards = 0; PRINT(("init_driver()\n")); @@ -596,8 +596,21 @@ init_driver(void) } memset(&cards[num_cards], 0, sizeof(auvia_dev)); cards[num_cards].info = info; +#ifdef __HAIKU__ + if ((err = (*pci->reserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards])) < B_OK) { + dprintf("%s: failed to reserve_device(%d, %d, %d,): %s\n", + DRIVER_NAME, info.bus, info.device, info.function, + strerror(err)); + continue; + } +#endif if (auvia_setup(&cards[num_cards])) { PRINT(("Setup of auvia %ld failed\n", num_cards+1)); +#ifdef __HAIKU__ + (*pci->unreserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards]); +#endif } else { num_cards++; diff --git a/src/add-ons/kernel/drivers/audio/echo/echo.cpp b/src/add-ons/kernel/drivers/audio/echo/echo.cpp index 38911a2c02..07c12c9295 100644 --- a/src/add-ons/kernel/drivers/audio/echo/echo.cpp +++ b/src/add-ons/kernel/drivers/audio/echo/echo.cpp @@ -548,6 +548,7 @@ init_driver(void) int ix=0; pci_info info; + status_t err; num_cards = 0; if (get_module(B_PCI_MODULE_NAME, (module_info **) &pci)) @@ -590,8 +591,21 @@ init_driver(void) memset(&cards[num_cards], 0, sizeof(echo_dev)); cards[num_cards].info = info; cards[num_cards].type = card_type; +#ifdef __HAIKU__ + if ((err = (*pci->reserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards])) < B_OK) { + dprintf("%s: failed to reserve_device(%d, %d, %d,): %s\n", + DRIVER_NAME, info.bus, info.device, info.function, + strerror(err)); + continue; + } +#endif if (echo_setup(&cards[num_cards])) { PRINT(("Setup of "DRIVER_NAME" %ld failed\n", num_cards+1)); +#ifdef __HAIKU__ + (*pci->unreserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards]); +#endif } else { num_cards++; diff --git a/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c b/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c index 2d977bccac..a9bbb9fe03 100644 --- a/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c +++ b/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c @@ -2861,6 +2861,7 @@ init_driver(void) { void *settings_handle; pci_info info; + status_t err; int ix = 0; num_cards = 0; @@ -2934,8 +2935,21 @@ init_driver(void) } memset(&cards[num_cards], 0, sizeof(emuxki_dev)); cards[num_cards].info = info; +#ifdef __HAIKU__ + if ((err = (*pci->reserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards])) < B_OK) { + dprintf("%s: failed to reserve_device(%d, %d, %d,): %s\n", + DRIVER_NAME, info.bus, info.device, info.function, + strerror(err)); + continue; + } +#endif if (emuxki_setup(&cards[num_cards])) { PRINT(("Setup of emuxki %ld failed\n", num_cards+1)); +#ifdef __HAIKU__ + (*pci->unreserve_device)(info.bus, info.device, info.function, + DRIVER_NAME, &cards[num_cards]); +#endif } else { num_cards++; }