static void dwc_otg_shutdown(struct pci_dev *pdev) { struct dwc_otg2 *otg = the_transceiver; /* stop main thread, ignore notification events */ stop_main_thread(otg); pci_disable_device(pdev); }
void *catch_signals(void *data) { gboolean quitting = FALSE; int current_signal = 0; install_dummy_handlers(); /* * Don't start catching signals until the speaking thread is running. * If the speaking thread couldn't be started, there's * nothing for us to do. */ pthread_mutex_lock(&thread_controller); if (speak_thread_started == FALSE) quitting = TRUE; pthread_mutex_unlock(&thread_controller); while (quitting != TRUE) { sigwait(&blocked_signals, ¤t_signal); switch (current_signal) { case SIGINT: case SIGTERM: /* Fall-through. */ quitting = TRUE; break; case SIGUSR1: log_msg(OTTS_LOG_NOTICE, "Reloading dead output modules at user request."); stop_speak_thread(); reload_dead_modules(); start_speak_thread(); pthread_mutex_lock(&thread_controller); if (speak_thread_started == FALSE) quitting = TRUE; pthread_mutex_unlock(&thread_controller); break; case SIGHUP: log_msg(OTTS_LOG_NOTICE, "Reloading configuration file at user request."); stop_speak_thread(); configure(); start_speak_thread(); pthread_mutex_lock(&thread_controller); if (speak_thread_started == FALSE) quitting = TRUE; pthread_mutex_unlock(&thread_controller); break; default: break; /* Nothing to do for this signal. */ } } stop_main_thread(); return NULL; }
static int dwc_otg2_set_host(struct usb_otg *x, struct usb_bus *host) { struct dwc_otg2 *otg; if (!x) return -ENODEV; otg = xceiv_to_dwc_otg2(x); otg_dbg(otg, "\n"); if (!host) { otg->otg.host = NULL; stop_main_thread(otg); return -ENODEV; } otg->otg.host = host; start_main_thread(otg); return 0; }
static int dwc_otg2_set_peripheral(struct usb_otg *x, struct usb_gadget *gadget) { struct dwc_otg2 *otg; if (!x) return -ENODEV; otg = xceiv_to_dwc_otg2(x); otg_dbg(otg, "\n"); if (!gadget) { otg->otg.gadget = NULL; stop_main_thread(otg); return -ENODEV; } otg->otg.gadget = gadget; otg->usb2_phy.state = OTG_STATE_B_IDLE; start_main_thread(otg); return 0; }