poke: allow multiple open()
Not sure why it only ever allowed a single instance. Change-Id: I972a1d601d93725674a97fb341aa7ffb3625b105 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1075 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
9918c82954
commit
e5495bf648
|
@ -41,8 +41,6 @@ int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||||
isa_module_info* isa;
|
isa_module_info* isa;
|
||||||
pci_module_info* pci;
|
pci_module_info* pci;
|
||||||
|
|
||||||
static int32 open_count;
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
init_hardware(void)
|
init_hardware(void)
|
||||||
|
@ -54,8 +52,6 @@ init_hardware(void)
|
||||||
status_t
|
status_t
|
||||||
init_driver(void)
|
init_driver(void)
|
||||||
{
|
{
|
||||||
open_count = 0;
|
|
||||||
|
|
||||||
if (get_module(B_ISA_MODULE_NAME, (module_info**)&isa) < B_OK)
|
if (get_module(B_ISA_MODULE_NAME, (module_info**)&isa) < B_OK)
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
|
|
||||||
|
@ -101,11 +97,6 @@ poke_open(const char* name, uint32 flags, void** cookie)
|
||||||
if (getuid() != 0 && geteuid() != 0)
|
if (getuid() != 0 && geteuid() != 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
|
|
||||||
if (atomic_add(&open_count, 1) != 0) {
|
|
||||||
atomic_add(&open_count, -1);
|
|
||||||
return B_BUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +111,6 @@ poke_close(void* cookie)
|
||||||
status_t
|
status_t
|
||||||
poke_free(void* cookie)
|
poke_free(void* cookie)
|
||||||
{
|
{
|
||||||
atomic_add(&open_count, -1);
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue