Lines Matching refs:acpi_aml_io

47 struct acpi_aml_io {  struct
62 static struct acpi_aml_io acpi_aml_io; argument
69 return acpi_aml_io.thread ? true : false; in __acpi_aml_running()
81 if (!(acpi_aml_io.flags & ACPI_AML_OPENED) || in __acpi_aml_access_ok()
82 (acpi_aml_io.flags & ACPI_AML_CLOSED) || in __acpi_aml_access_ok()
86 current != acpi_aml_io.thread) in __acpi_aml_access_ok()
97 if (!(acpi_aml_io.flags & flag) && circ_count(circ)) in __acpi_aml_readable()
108 if (!(acpi_aml_io.flags & flag) && circ_space(circ)) in __acpi_aml_writable()
115 if (acpi_aml_io.flags & ACPI_AML_BUSY) in __acpi_aml_busy()
122 return acpi_aml_io.usages ? true : false; in __acpi_aml_used()
129 mutex_lock(&acpi_aml_io.lock); in acpi_aml_running()
131 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_running()
139 mutex_lock(&acpi_aml_io.lock); in acpi_aml_busy()
141 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_busy()
153 mutex_lock(&acpi_aml_io.lock); in acpi_aml_used()
155 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_used()
163 mutex_lock(&acpi_aml_io.lock); in acpi_aml_kern_readable()
165 __acpi_aml_readable(&acpi_aml_io.in_crc, ACPI_AML_IN_KERN); in acpi_aml_kern_readable()
166 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_kern_readable()
174 mutex_lock(&acpi_aml_io.lock); in acpi_aml_kern_writable()
176 __acpi_aml_writable(&acpi_aml_io.out_crc, ACPI_AML_OUT_KERN); in acpi_aml_kern_writable()
177 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_kern_writable()
185 mutex_lock(&acpi_aml_io.lock); in acpi_aml_user_readable()
187 __acpi_aml_readable(&acpi_aml_io.out_crc, ACPI_AML_OUT_USER); in acpi_aml_user_readable()
188 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_user_readable()
196 mutex_lock(&acpi_aml_io.lock); in acpi_aml_user_writable()
198 __acpi_aml_writable(&acpi_aml_io.in_crc, ACPI_AML_IN_USER); in acpi_aml_user_writable()
199 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_user_writable()
207 mutex_lock(&acpi_aml_io.lock); in acpi_aml_lock_write()
216 acpi_aml_io.flags |= flag; in acpi_aml_lock_write()
218 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_lock_write()
226 mutex_lock(&acpi_aml_io.lock); in acpi_aml_lock_read()
235 acpi_aml_io.flags |= flag; in acpi_aml_lock_read()
237 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_lock_read()
243 mutex_lock(&acpi_aml_io.lock); in acpi_aml_unlock_fifo()
244 acpi_aml_io.flags &= ~flag; in acpi_aml_unlock_fifo()
246 wake_up_interruptible(&acpi_aml_io.wait); in acpi_aml_unlock_fifo()
247 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_unlock_fifo()
253 struct circ_buf *crc = &acpi_aml_io.out_crc; in acpi_aml_write_kern()
275 struct circ_buf *crc = &acpi_aml_io.in_crc; in acpi_aml_readb_kern()
313 ret = wait_event_interruptible(acpi_aml_io.wait, in acpi_aml_write_log()
357 ret = wait_event_interruptible(acpi_aml_io.wait, in acpi_aml_read_cmd()
388 mutex_lock(&acpi_aml_io.lock); in acpi_aml_thread()
389 if (acpi_aml_io.function) { in acpi_aml_thread()
390 acpi_aml_io.usages++; in acpi_aml_thread()
391 function = acpi_aml_io.function; in acpi_aml_thread()
392 context = acpi_aml_io.context; in acpi_aml_thread()
394 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_thread()
399 mutex_lock(&acpi_aml_io.lock); in acpi_aml_thread()
400 acpi_aml_io.usages--; in acpi_aml_thread()
402 acpi_aml_io.thread = NULL; in acpi_aml_thread()
403 wake_up(&acpi_aml_io.wait); in acpi_aml_thread()
405 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_thread()
422 mutex_lock(&acpi_aml_io.lock); in acpi_aml_create_thread()
423 acpi_aml_io.function = function; in acpi_aml_create_thread()
424 acpi_aml_io.context = context; in acpi_aml_create_thread()
425 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_create_thread()
433 mutex_lock(&acpi_aml_io.lock); in acpi_aml_create_thread()
434 acpi_aml_io.thread = t; in acpi_aml_create_thread()
437 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_create_thread()
467 mutex_lock(&acpi_aml_io.lock); in acpi_aml_open()
472 if (acpi_aml_io.flags & ACPI_AML_CLOSED) { in acpi_aml_open()
493 if (!(acpi_aml_io.flags & ACPI_AML_OPENED)) { in acpi_aml_open()
500 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_open()
511 mutex_lock(&acpi_aml_io.lock); in acpi_aml_open()
512 acpi_aml_io.flags |= ACPI_AML_OPENED; in acpi_aml_open()
513 acpi_aml_io.out_crc.head = acpi_aml_io.out_crc.tail = 0; in acpi_aml_open()
514 acpi_aml_io.in_crc.head = acpi_aml_io.in_crc.tail = 0; in acpi_aml_open()
517 acpi_aml_io.users++; in acpi_aml_open()
523 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_open()
530 mutex_lock(&acpi_aml_io.lock); in acpi_aml_release()
531 acpi_aml_io.users--; in acpi_aml_release()
537 acpi_aml_io.flags |= ACPI_AML_CLOSED; in acpi_aml_release()
543 wake_up_interruptible(&acpi_aml_io.wait); in acpi_aml_release()
544 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_release()
550 wait_event(acpi_aml_io.wait, !acpi_aml_busy()); in acpi_aml_release()
558 wait_event(acpi_aml_io.wait, !acpi_aml_used()); in acpi_aml_release()
561 mutex_lock(&acpi_aml_io.lock); in acpi_aml_release()
562 acpi_aml_io.flags &= ~ACPI_AML_OPENED; in acpi_aml_release()
564 if (acpi_aml_io.users == 0) { in acpi_aml_release()
566 acpi_aml_io.flags &= ~ACPI_AML_CLOSED; in acpi_aml_release()
568 mutex_unlock(&acpi_aml_io.lock); in acpi_aml_release()
575 struct circ_buf *crc = &acpi_aml_io.out_crc; in acpi_aml_read_user()
617 ret = wait_event_interruptible(acpi_aml_io.wait, in acpi_aml_read()
645 struct circ_buf *crc = &acpi_aml_io.in_crc; in acpi_aml_write_user()
687 ret = wait_event_interruptible(acpi_aml_io.wait, in acpi_aml_write()
715 poll_wait(file, &acpi_aml_io.wait, wait); in acpi_aml_poll()
749 mutex_init(&acpi_aml_io.lock); in acpi_aml_init()
750 init_waitqueue_head(&acpi_aml_io.wait); in acpi_aml_init()
751 acpi_aml_io.out_crc.buf = acpi_aml_io.out_buf; in acpi_aml_init()
752 acpi_aml_io.in_crc.buf = acpi_aml_io.in_buf; in acpi_aml_init()