From: Arun Thomas Date: Wed, 22 Apr 2009 12:42:37 +0000 (+0000) Subject: Make the rtl8139 and orinoco drivers handle the system shutdown case X-Git-Tag: v3.1.4~74 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/verify-sign/verify.pl?a=commitdiff_plain;h=3b37103fa37f6e53b5394db8b7eb0d16031b570a;p=minix.git Make the rtl8139 and orinoco drivers handle the system shutdown case like other drivers. Also, some minor cleanups. --- diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index 338adecc6..48183db42 100755 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -190,7 +190,6 @@ struct { #define BITRATE_TABLE_SIZE (sizeof(bitrate_table) / sizeof(bitrate_table[0])) -_PROTOTYPE (static void sig_handler, (void)); _PROTOTYPE (static void or_writev, (message * mp, int from_int, int vectored)); _PROTOTYPE (static void or_readv, (message * mp, int from_int, int vectored)); _PROTOTYPE (static void or_writev_s, (message * mp, int from_int)); @@ -268,7 +267,7 @@ int main(int argc, char *argv[]) { else if (r != ESRCH) printf("orinoco: ds_retrieve_u32 failed for 'inet': %d\n", r); - while (42) { + while (TRUE) { if ((r = receive (ANY, &m)) != OK) panic(__FILE__, "orinoco: receive failed", NO_NUM); @@ -309,6 +308,13 @@ int main(int argc, char *argv[]) { case SYN_ALARM: or_watchdog_f(NULL); break; + case SYS_SIG: + { + sigset_t sigset = m.NOTIFY_ARG; + if ( sigismember( &sigset, SIGKSTOP ) ) + orinoco_stop(); + } + break; case HARD_INT: do_hard_int(); if (int_event_check) @@ -318,7 +324,6 @@ int main(int argc, char *argv[]) { or_dump(&m); break; case PROC_EVENT: - sig_handler(); break; default: panic(__FILE__,"orinoco: illegal message:", m.m_type); @@ -326,23 +331,6 @@ int main(int argc, char *argv[]) { } } -/***************************************************************************** - * sig_handler * - * * - * Handles signals to the driver. * - *****************************************************************************/ -PRIVATE void sig_handler() { - sigset_t sigset; - int sig; - - if(getsigset(&sigset) != 0) return; - - if(sigismember(&sigset, SIGTERM)) { - orinoco_stop(); - } -} - - /***************************************************************************** * check_int_events * * * @@ -675,7 +663,7 @@ static int or_probe (t_or * orp) { just_one = FALSE; } - while (42) { + while (TRUE) { /* loop through the pcitab to find a maching entry. The match * being between one of the values in pcitab and the * information provided by the pci bus */ @@ -712,7 +700,7 @@ static int or_probe (t_or * orp) { /* Get the name as advertised by pci */ dname = pci_dev_name (vid, did); if (!dname) - dname = "unknow device"; + dname = "unknown device"; printf ("%s: %s (%04x/%04x) at %s\n", orp->or_name, dname, vid, did, pci_slot_name (devind)); @@ -1032,7 +1020,7 @@ static void or_writerids (hermes_t * hw, t_or * orp) { setup_wepkey(orp, wepkey0); break; default: - printf("unvalid key provided. Has to be 13 chars\n"); + printf("Invalid key provided. Has to be 13 chars\n"); break; } } diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 836984bec..6c223232c 100755 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -253,7 +253,6 @@ static void my_outl(U16_t port, U32_t value) { #define rl_outw(port, offset, value) (my_outw((port) + (offset), (value))) #define rl_outl(port, offset, value) (my_outl((port) + (offset), (value))) -_PROTOTYPE( static void sig_handler, (void) ); _PROTOTYPE( static void rl_init, (message *mp) ); _PROTOTYPE( static void rl_pci_conf, (void) ); _PROTOTYPE( static int rl_probe, (re_t *rep) ); @@ -376,6 +375,13 @@ int main(int argc, char *argv[]) */ rl_watchdog_f(NULL); break; + case SYS_SIG: + { + sigset_t sigset = m.NOTIFY_ARG; + if ( sigismember( &sigset, SIGKSTOP ) ) + rtl8139_stop(); + } + break; case HARD_INT: do_hard_int(); if (int_event_check) @@ -383,7 +389,6 @@ int main(int argc, char *argv[]) break ; case FKEY_PRESSED: rtl8139_dump(&m); break; case PROC_EVENT: - sig_handler(); break; default: panic("rtl8139","illegal message", m.m_type); @@ -391,23 +396,6 @@ int main(int argc, char *argv[]) } } -/*===========================================================================* - * sig_handler * - *===========================================================================*/ -PRIVATE void sig_handler() -{ - sigset_t sigset; - int sig; - - /* Try to obtain signal set from PM. */ - if (getsigset(&sigset) != 0) return; - - /* Check for known signals. */ - if (sigismember(&sigset, SIGTERM)) { - rtl8139_stop(); - } -} - /*===========================================================================* * check_int_events * *===========================================================================*/ diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 681e3cbe9..551cac882 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -314,7 +314,7 @@ PUBLIC int do_getprocnr() /* This call should be moved to DS. */ if (mp->mp_effuid != 0) { - printf("PM: unauthorized call of do_procstat by proc %d\n", + printf("PM: unauthorized call of do_getprocnr by proc %d\n", mp->mp_endpoint); sys_sysctl_stacktrace(mp->mp_endpoint); return EPERM;