diff --git a/qla_isp/linux/isp_linux.c b/qla_isp/linux/isp_linux.c index 48ac2c937..041149c6f 100644 --- a/qla_isp/linux/isp_linux.c +++ b/qla_isp/linux/isp_linux.c @@ -910,7 +910,7 @@ void isp_detach_target(ispsoftc_t *isp) { hba_register_t hba; - DECLARE_MUTEX_LOCKED(rsem); + struct semaphore rsem; hba.r_identity = isp; snprintf(hba.r_name, sizeof (hba.r_name), ISP_NAME); @@ -924,6 +924,7 @@ isp_detach_target(ispsoftc_t *isp) hba.r_type = R_SPI; } hba.r_private = &rsem; + sema_init(&rsem, 0); ISP_PARENT_TARGET(QOUT_HBA_UNREG, &hba); down(&rsem); } @@ -2667,7 +2668,7 @@ isp_fc_change_role(ispsoftc_t *isp, int chan, int new_role) int isp_enable_lun(ispsoftc_t *isp, uint16_t bus, uint16_t lun) { - DECLARE_MUTEX_LOCKED(rsem); + struct semaphore rsem; tgt_enalun_t *axl; uint16_t rstat; int cmd, r; @@ -2783,6 +2784,7 @@ isp_enable_lun(ispsoftc_t *isp, uint16_t bus, uint16_t lun) ISP_LOCK_SOFTC(isp); isp->isp_osinfo.rsemap = &rsem; + sema_init(&rsem, 0); if (IS_24XX(isp)) { rstat = LUN_OK; } else { @@ -2846,7 +2848,7 @@ out: int isp_disable_lun(ispsoftc_t *isp, uint16_t bus, uint16_t lun) { - DECLARE_MUTEX_LOCKED(rsem); + struct semaphore rsem; uint16_t rstat; tgt_enalun_t *axl; int cmd; @@ -2885,6 +2887,7 @@ isp_disable_lun(ispsoftc_t *isp, uint16_t bus, uint16_t lun) } isp->isp_osinfo.rsemap = &rsem; + sema_init(&rsem, 0); if (IS_24XX(isp)) { rstat = LUN_OK; } else { diff --git a/qla_isp/linux/isp_linux.h b/qla_isp/linux/isp_linux.h index ed4b1e48a..0dfc35d25 100644 --- a/qla_isp/linux/isp_linux.h +++ b/qla_isp/linux/isp_linux.h @@ -135,12 +135,18 @@ #define DESTROY_ISP_DEV(isp) \ class_device_destroy(isp_class, MKDEV(MAJOR(isp_dev), (isp)->isp_unit)); -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) #define ISP_CLASS struct class #define CREATE_ISP_CLASS class_create #define DESTROY_ISP_CLASS class_destroy #define CREATE_ISP_DEV(i, c) (void) device_create(c, NULL, MKDEV(MAJOR(isp_dev), (i)->isp_unit), "%s%d", ISP_NAME, (i)->isp_unit); #define DESTROY_ISP_DEV(i) device_destroy(isp_class, MKDEV(MAJOR(isp_dev), (i)->isp_unit)); +#else +#define ISP_CLASS struct class +#define CREATE_ISP_CLASS class_create +#define DESTROY_ISP_CLASS class_destroy +#define CREATE_ISP_DEV(i, c) (void) device_create(c, NULL, MKDEV(MAJOR(isp_dev), (i)->isp_unit), NULL, "%s%d", ISP_NAME, (i)->isp_unit); +#define DESTROY_ISP_DEV(i) device_destroy(isp_class, MKDEV(MAJOR(isp_dev), (i)->isp_unit)); #endif typedef struct scsi_cmnd Scsi_Cmnd; @@ -194,10 +200,6 @@ typedef struct scsi_host_template Scsi_Host_Template; #undef max #endif -#ifndef DECLARE_MUTEX_LOCKED -#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) -#endif - #define ull unsigned long long #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)