qla2xxx: use kthread_ API
Subsystems (2)
PATCH 1/1 qla2xxx: use kthread_ API
Use the kthread_ API instead of opencoding lots of hairy code for kernel thread creation and teardown.
Also switch from semaphore-based thread wakeup to wake_up_process.
Signed-off-by Christoph Hellwig <[email protected]>
drivers/scsi/qla2xxx/qla_def.h +1 -5
@@ -2390,11 +2390,7 @@struct sns_cmd_pkt *sns_cmd;dma_addr_t sns_cmd_dma; -pid_t dpc_pid; -int dpc_should_die; -struct completion dpc_inited; -struct completion dpc_exited; -struct semaphore *dpc_wait; +struct task_struct *dpc_thread;uint8_t dpc_active;/* DPC routine is active */ /* Timeout timers. */
drivers/scsi/qla2xxx/qla_gbl.h +2 -0
@@ -81,6 +81,8 @@extern struct fw_blob *qla2x00_request_firmware (scsi_qla_host_t *); +extern void qla2xxx_wake_dpc (scsi_qla_host_t *); +/* * Global Function Prototypes in qla_iocb.c source file. */
drivers/scsi/qla2xxx/qla_isr.c +2 -5
@@ -838,9 +838,7 @@qla_printk (KERN_WARNING , ha,"Status Entry invalid handle.\n" );set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -if (ha->dpc_wait && !ha->dpc_active) -up (ha->dpc_wait); - +qla2xxx_wake_dpc (ha);return ; } cp = sp->cmd;
@@ -1271,8 +1269,7 @@ "Error entry - invalid handle\n");set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -if (ha->dpc_wait && !ha->dpc_active) -up (ha->dpc_wait); +qla2xxx_wake_dpc (ha); } }
drivers/scsi/qla2xxx/qla_mbx.c +1 -3
@@ -285,9 +285,7 @@"Mailbox command timeout occured. Scheduling ISP " "abort.\n");set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -if (ha->dpc_wait && !ha->dpc_active) -up (ha->dpc_wait); - +qla2xxx_wake_dpc (ha); }else if (!abort_active) {/* call abort directly since we are in the DPC thread */ DEBUG(printk("%s(%ld): timeout calling abort_isp\n",
drivers/scsi/qla2xxx/qla_os.c +30 -59
183 lines not on this page · raw message
Quoted 7 lines · Christoph Hellwig
Use the
kthread_API instead of opencoding lots of hairy code for kernel thread creation and teardown.Also switch from semaphore-based thread wakeup to
wake_up_process.Signed-off-by Christoph Hellwig <[email protected]>
Ack. Thanks for doing this.
I've also rebased it against the lastest linux-2.6.git tree to correct the rejected hunk and additonal DPC ringing done in qla_sup.c.
I've added something similar to qla4xxx (which I hope will be submitted soon... nudge...nudge...).
--
av
---
drivers/scsi/qla2xxx/qla_def.h +1 -5
@@ -2414,11 +2414,7 @@ typedef struct scsi_qla_host {struct sns_cmd_pkt *sns_cmd;dma_addr_t sns_cmd_dma; -pid_t dpc_pid; -int dpc_should_die; -struct completion dpc_inited; -struct completion dpc_exited; -struct semaphore *dpc_wait; +struct task_struct *dpc_thread;uint8_t dpc_active;/* DPC routine is active */ /* Timeout timers. */
drivers/scsi/qla2xxx/qla_gbl.h +2 -0
@@ -81,6 +81,8 @@ extern struct fw_blob *qla2x00_request_fextern int qla2x00_wait_for_hba_online (scsi_qla_host_t *); +extern void qla2xxx_wake_dpc (scsi_qla_host_t *); +/* * Global Function Prototypes in qla_iocb.c source file. */
drivers/scsi/qla2xxx/qla_isr.c +2 -5
@@ -838,9 +838,7 @@ qla2x00_status_entry(scsi_qla_host_t *haqla_printk (KERN_WARNING , ha,"Status Entry invalid handle.\n" );set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -if (ha->dpc_wait && !ha->dpc_active) -up (ha->dpc_wait); - +qla2xxx_wake_dpc (ha);return ; } cp = sp->cmd;
@@ -1271,8 +1269,7 @@ qla2x00_error_entry(scsi_qla_host_t *ha, "Error entry - invalid handle\n");set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -if (ha->dpc_wait && !ha->dpc_active) -up (ha->dpc_wait); +qla2xxx_wake_dpc (ha); } }
drivers/scsi/qla2xxx/qla_mbx.c +1 -3
@@ -284,9 +284,7 @@ qla2x00_mailbox_command(scsi_qla_host_t"Mailbox command timeout occured. Scheduling ISP " "abort.\n");set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -if (ha->dpc_wait && !ha->dpc_active) -up (ha->dpc_wait); - +qla2xxx_wake_dpc (ha); }else if (!abort_active) {/* call abort directly since we are in the DPC thread */ DEBUG(printk("%s(%ld): timeout calling abort_isp\n",
drivers/scsi/qla2xxx/qla_os.c +30 -59
183 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_sup.c +2 -2
@@ -1354,7 +1354,7 @@ qla2x00_resume_hba(struct scsi_qla_host/* Resume HBA. */ clear_bit (MBX_UPDATE_FLASH_ACTIVE , &ha->mbx_cmd_flags);set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -up (ha->dpc_wait); +qla2xxx_wake_dpc (ha);qla2x00_wait_for_hba_online (ha);scsi_unblock_requests (ha->host); }
@@ -1652,7 +1652,7 @@ qla24xx_write_optrom_data(struct scsi_ql/* Resume HBA -- RISC reset needed. */ clear_bit (MBX_UPDATE_FLASH_ACTIVE , &ha->mbx_cmd_flags);set_bit (ISP_ABORT_NEEDED , &ha->dpc_flags); -up (ha->dpc_wait); +qla2xxx_wake_dpc (ha);qla2x00_wait_for_hba_online (ha);scsi_unblock_requests (ha->host);