--- R29/drivers/scsi/hosts.c 2004-03-24 19:55:43.000000000 +0000 +++ R63/drivers/scsi/hosts.c 2005-04-05 02:40:53.000000000 +0100 @@ -36,12 +36,15 @@ #define __KERNEL_SYSCALLS__ #include - +//pete +#include +#include +// #include "scsi.h" #include "hosts.h" /* -static const char RCSid[] = "$Header: /home/cvsroot/NSLU2/linux-2.4.x/drivers/scsi/hosts.c,v 1.1.1.1 2004/03/24 19:55:43 sure Exp $"; +static const char RCSid[] = "$Header: /home/nas-cvsroot/NSLU2_V2/linux-2.4.x/drivers/scsi/hosts.c,v 1.2 2005/04/05 01:40:53 shearer Exp $"; */ /* @@ -84,6 +87,12 @@ int max_scsi_hosts; /* host_no for next new host */ int next_scsi_host; /* count of registered scsi hosts */ +//pete +extern pid_t sd_mc_thread_pid; +//extern DECLARE_COMPLETION(scsi_mc_thread_exited); +extern struct completion sd_mc_thread_exited; +// + void scsi_unregister(struct Scsi_Host * sh){ struct Scsi_Host * shpnt; @@ -110,6 +119,15 @@ next_scsi_host--; + //pete + //printk("+++++ scsi_unregister:next_scsi_host:%d\n", next_scsi_host); + if( next_scsi_host == 0){ + /* Send a signal to exit the thread. */ + kill_proc(sd_mc_thread_pid, SIGTERM, 1); + /* If no scsi host left, we wait the thread to exit. */ + wait_for_completion(&sd_mc_thread_exited); + } + // kfree((char *) sh); }