Skip to contentSkip to conversation

scsi: core: Drop Scsi_Host.default_lock

PATCH Applied John Garry 4 participants 4 messages Aug 31 – Sep 2

Subsystems (41)
Documentation SCSI USB PowerPC +37 more subsystems
lore
Share & tools
lore

John Garry

author reviewer
#0 lore raw

PATCH v5 1/1 scsi: core: Drop Scsi_Host.default_lock

From: John Garry <[email protected]>

Back in the 2.6.xx days, it was possible to for low-level drivers to set the shost lock pointer. That is why there is a default lock and a pointer to the shost lock.

However, support for this has long been removed, so drop Scsi_Host.default_lock and make Scsi_Host.host_lock as the actual lock.

Getting the address of embedded host_lock structure just requires adding a fixed offset value to the shost pointer. However, getting the value of the host_lock pointer requires loading from a fixed offset to the shost pointer. The latter should be very slightly slower, which is relevant as this lock is used a lot throughout the core code and drivers.

---
Differences to v4:
- rebase
- add RB tag from Hannes (thanks!)

Difference to v3:
- Rebase and update some annotations

Differences to v2:
- Add tags from Bart and Damien (Thanks!)
- Update Documentation reference to default_lock (Bart)

Documentation/scsi/scsi_mid_low_api.rst +2 -6
index 7f59dff43eb54..5489e9d07ab7e 100644
@@ -1148,12 +1148,8 @@ The scsi_cmnd structure is defined in include/scsi/scsi_cmnd.h
 Locks
 =====
 Each struct Scsi_Host instance has a spin_lock called struct
-Scsi_Host::default_lock which is initialized in scsi_host_alloc() [found in
-hosts.c]. Within the same function the struct Scsi_Host::host_lock pointer
-is initialized to point at default_lock.  Thereafter lock and unlock
-operations performed by the mid level use the struct Scsi_Host::host_lock
-pointer.  Previously drivers could override the host_lock pointer but
-this is not allowed anymore.
+Scsi_Host::host_lock which is initialized in scsi_host_alloc() [found in
+hosts.c].
 
 
 Autosense
drivers/ata/libata-eh.c +2 -2
index c93c24b22d9ca..0bc7f01c7778e 100644
@@ -573,9 +573,9 @@ void ata_scsi_error(struct Scsi_Host *host)
 	int nr_timedout;
 	LIST_HEAD(eh_work_q);
 
-	spin_lock_irqsave(host->host_lock, flags);
+	spin_lock_irqsave(&host->host_lock, flags);
 	list_splice_init(&host->eh_cmd_q, &eh_work_q);
-	spin_unlock_irqrestore(host->host_lock, flags);
+	spin_unlock_irqrestore(&host->host_lock, flags);
 
 	/*
 	 * First check what errors we got with ata_scsi_cmd_error_handler().
drivers/message/fusion/mptfc.c +4 -4
index b55deb988ad92..bca05099718a0 100644
@@ -196,20 +196,20 @@ mptfc_block_error_handler(struct fc_rport *rport)
 
 	hd = shost_priv(shost);
 	ioc = hd->ioc;
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY
 	 || (loops > 0 && ioc->active == 0)) {
-		spin_unlock_irqrestore(shost->host_lock, flags);
+		spin_unlock_irqrestore(&shost->host_lock, flags);
 		dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
 			"mptfc_block_error_handler.%d: %s, port status is "
 			"%x, active flag %d, deferring recovery.\n",
 			ioc->name, ioc->sh->host_no,
 			dev_name(&rport->dev), ready, ioc->active));
 		msleep(1000);
-		spin_lock_irqsave(shost->host_lock, flags);
+		spin_lock_irqsave(&shost->host_lock, flags);
 		loops --;
 	}
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 
 	if (ready == DID_NO_CONNECT || ioc->active == 0) {
 		dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
drivers/s390/scsi/zfcp_erp.c +15 -15
index ec6c0e1021199..adfe15f5cb429 100644
@@ -95,11 +95,11 @@ static void zfcp_erp_action_dismiss_port(struct zfcp_port *port)
 	if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
 		zfcp_erp_action_dismiss(&port->erp_action);
 	else {
-		spin_lock(port->adapter->scsi_host->host_lock);
+		spin_lock(&port->adapter->scsi_host->host_lock);
 		__shost_for_each_device(sdev, port->adapter->scsi_host)
 			if (sdev_to_zfcp(sdev)->port == port)
 				zfcp_erp_action_dismiss_lun(sdev);
-		spin_unlock(port->adapter->scsi_host->host_lock);
+		spin_unlock(&port->adapter->scsi_host->host_lock);
 	}
 }
 
@@ -670,11 +670,11 @@ static void _zfcp_erp_lun_reopen_all(struct zfcp_port *port, int clear,
 {
 	struct scsi_device *sdev;
 
-	spin_lock(port->adapter->scsi_host->host_lock);
+	spin_lock(&port->adapter->scsi_host->host_lock);
 	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port)
 			_zfcp_erp_lun_reopen(sdev, clear, dbftag, 0);
-	spin_unlock(port->adapter->scsi_host->host_lock);
+	spin_unlock(&port->adapter->scsi_host->host_lock);
 }
 
 static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
@@ -1429,7 +1429,7 @@ static void zfcp_erp_try_rport_unblock(struct zfcp_port *port)
 		write_unlock_irqrestore(&adapter->erp_lock, flags);
 		return;
 	}
-	spin_lock(shost->host_lock);
+	spin_lock(&shost->host_lock);
 	__shost_for_each_device(sdev, shost) {
 		struct zfcp_scsi_dev *zsdev = sdev_to_zfcp(sdev);
 		int lun_status;
@@ -1451,7 +1451,7 @@ static void zfcp_erp_try_rport_unblock(struct zfcp_port *port)
 			 * or meanwhile blocked [new LUN recovery triggered]
 			 */
 			zfcp_dbf_rec_run_lvl(4, "ertru_l", &zsdev->erp_action);
-			spin_unlock(shost->host_lock);
+			spin_unlock(&shost->host_lock);
 			write_unlock_irqrestore(&adapter->erp_lock, flags);
 			return;
 		}
@@ -1460,7 +1460,7 @@ static void zfcp_erp_try_rport_unblock(struct zfcp_port *port)
 	 * and no ERP of severity >= port was meanwhile triggered elsewhere
 	 */
 	zfcp_scsi_schedule_rport_register(port);
-	spin_unlock(shost->host_lock);
+	spin_unlock(&shost->host_lock);
 	write_unlock_irqrestore(&adapter->erp_lock, flags);
 }
 
@@ -1713,10 +1713,10 @@ void zfcp_erp_set_adapter_status(struct zfcp_adapter *adapter, u32 mask)
 	if (adapter->scsi_host == NULL)
 		return;
 
-	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	spin_lock_irqsave(&adapter->scsi_host->host_lock, flags);
 	__shost_for_each_device(sdev, adapter->scsi_host)
 		atomic_or(common_mask, &sdev_to_zfcp(sdev)->status);
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
+	spin_unlock_irqrestore(&adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1757,13 +1757,13 @@ void zfcp_erp_clear_adapter_status(struct zfcp_adapter *adapter, u32 mask)
 	if (adapter->scsi_host == NULL)
 		return;
 
-	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	spin_lock_irqsave(&adapter->scsi_host->host_lock, flags);
 	__shost_for_each_device(sdev, adapter->scsi_host) {
 		atomic_andnot(common_mask, &sdev_to_zfcp(sdev)->status);
 		if (clear_counter)
 			atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
 	}
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
+	spin_unlock_irqrestore(&adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1784,12 +1784,12 @@ void zfcp_erp_set_port_status(struct zfcp_port *port, u32 mask)
 	if (!common_mask)
 		return;
 
-	spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
+	spin_lock_irqsave(&port->adapter->scsi_host->host_lock, flags);
 	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port)
 			atomic_or(common_mask,
 					&sdev_to_zfcp(sdev)->status);
-	spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
+	spin_unlock_irqrestore(&port->adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1814,7 +1814,7 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)
 	if (clear_counter)
 		atomic_set(&port->erp_counter, 0);
 
-	spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
+	spin_lock_irqsave(&port->adapter->scsi_host->host_lock, flags);
 	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port) {
 			atomic_andnot(common_mask,
@@ -1822,7 +1822,7 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)
 			if (clear_counter)
 				atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
 		}
-	spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
+	spin_unlock_irqrestore(&port->adapter->scsi_host->host_lock, flags);
 }
 
 /**
drivers/s390/scsi/zfcp_sysfs.c +2 -2
index 4f23d585d0620..b1ed0cb30a724 100644
@@ -270,7 +270,7 @@ static bool zfcp_sysfs_port_in_use(struct zfcp_port *const port)
 	if (atomic_read(&port->units) > 0)
 		goto unlock_port_units_mutex; /* zfcp_unit(s) under port */
 
-	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	spin_lock_irqsave(&adapter->scsi_host->host_lock, flags);
 	__shost_for_each_device(sdev, adapter->scsi_host) {
 		const struct zfcp_scsi_dev *zsdev = sdev_to_zfcp(sdev);
 
@@ -288,7 +288,7 @@ static bool zfcp_sysfs_port_in_use(struct zfcp_port *const port)
 	in_use = false;
 
 unlock_host_lock:
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
+	spin_unlock_irqrestore(&adapter->scsi_host->host_lock, flags);
 unlock_port_units_mutex:
 	mutex_unlock(&zfcp_sysfs_port_units_mutex);
 	return in_use;
drivers/scsi/3w-9xxx.c +10 -10
index 9b93a2440af8f..e6694f242ebed 100644
@@ -160,7 +160,7 @@ static ssize_t twa_show_stats(struct device *dev,
 	unsigned long flags = 0;
 	ssize_t len;
 
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 	len = sysfs_emit(buf, "3w-9xxx Driver version: %s\n"
 			 "Current commands posted:   %4d\n"
 			 "Max commands posted:       %4d\n"
@@ -183,7 +183,7 @@ static ssize_t twa_show_stats(struct device *dev,
 			 tw_dev->max_sector_count,
 			 tw_dev->num_resets,
 			 tw_dev->aen_count);
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 	return len;
 } /* End twa_show_stats() */
 
@@ -694,7 +694,7 @@ static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
 	/* See which ioctl we are doing */
 	switch (cmd) {
 	case TW_IOCTL_FIRMWARE_PASS_THROUGH:
-		spin_lock_irqsave(tw_dev->host->host_lock, flags);
+		spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 		twa_get_request_id(tw_dev, &request_id);
 
 		/* Flag internal command */
@@ -712,7 +712,7 @@ static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
 
 		/* Now post the command packet to the controller */
 		twa_post_command_packet(tw_dev, request_id, 1);
-		spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+		spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 		timeout = TW_IOCTL_CHRDEV_TIMEOUT*HZ;
 
@@ -734,11 +734,11 @@ static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
 		memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_Full));
 
 		/* Now complete the io */
-		spin_lock_irqsave(tw_dev->host->host_lock, flags);
+		spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 		tw_dev->posted_request_count--;
 		tw_dev->state[request_id] = TW_S_COMPLETED;
 		twa_free_request_id(tw_dev, request_id);
-		spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+		spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 		break;
 	case TW_IOCTL_GET_COMPATIBILITY_INFO:
 		tw_ioctl->driver_command.status = 0;
@@ -1223,7 +1223,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 	int handled = 0;
 
 	/* Get the per adapter lock */
-	spin_lock(tw_dev->host->host_lock);
+	spin_lock(&tw_dev->host->host_lock);
 
 	/* Read the registers */
 	status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev));
@@ -1372,7 +1372,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 	}
 
 twa_interrupt_bail:
-	spin_unlock(tw_dev->host->host_lock);
+	spin_unlock(&tw_dev->host->host_lock);
 	return IRQ_RETVAL(handled);
 } /* End twa_interrupt() */
 
@@ -1585,7 +1585,7 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
 	set_bit(TW_IN_RESET, &tw_dev->flags);
 	TW_DISABLE_INTERRUPTS(tw_dev);
 	TW_MASK_COMMAND_INTERRUPT(tw_dev);
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 
 	/* Abort all requests that are in progress */
 	for (i = 0; i < TW_Q_LENGTH; i++) {
@@ -1616,7 +1616,7 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
 	tw_dev->pending_tail = TW_Q_START;
 	tw_dev->reset_print = 0;
 
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 	if (twa_reset_sequence(tw_dev, 1))
 		goto out;
drivers/scsi/3w-sas.c +14 -14
index 52dc1aa639f7e..060f97805319f 100644
@@ -108,9 +108,9 @@ static ssize_t twl_sysfs_aen_read(struct file *filp, struct kobject *kobj,
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 	ret = memory_read_from_buffer(outbuf, count, &offset, tw_dev->event_queue[0], sizeof(TW_Event) * TW_Q_LENGTH);
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 	return ret;
 } /* End twl_sysfs_aen_read() */
@@ -139,9 +139,9 @@ static ssize_t twl_sysfs_compat_info(struct file *filp, struct kobject *kobj,
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 	ret = memory_read_from_buffer(outbuf, count, &offset, &tw_dev->tw_compat_info, sizeof(TW_Compatibility_Info));
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 	return ret;
 } /* End twl_sysfs_compat_info() */
@@ -165,7 +165,7 @@ static ssize_t twl_show_stats(struct device *dev,
 	unsigned long flags = 0;
 	ssize_t len;
 
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 	len = sysfs_emit(buf, "3w-sas Driver version: %s\n"
 			 "Current commands posted:   %4d\n"
 			 "Max commands posted:       %4d\n"
@@ -184,7 +184,7 @@ static ssize_t twl_show_stats(struct device *dev,
 			 tw_dev->max_sector_count,
 			 tw_dev->num_resets,
 			 tw_dev->aen_count);
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 	return len;
 } /* End twl_show_stats() */
 
@@ -763,7 +763,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
 	/* See which ioctl we are doing */
 	switch (cmd) {
 	case TW_IOCTL_FIRMWARE_PASS_THROUGH:
-		spin_lock_irqsave(tw_dev->host->host_lock, flags);
+		spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 		twl_get_request_id(tw_dev, &request_id);
 
 		/* Flag internal command */
@@ -781,7 +781,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
 
 		/* Now post the command packet to the controller */
 		twl_post_command_packet(tw_dev, request_id);
-		spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+		spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 		timeout = TW_IOCTL_CHRDEV_TIMEOUT*HZ;
 
@@ -803,11 +803,11 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
 		memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id], sizeof(TW_Command_Full));
 
 		/* Now complete the io */
-		spin_lock_irqsave(tw_dev->host->host_lock, flags);
+		spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 		tw_dev->posted_request_count--;
 		tw_dev->state[request_id] = TW_S_COMPLETED;
 		twl_free_request_id(tw_dev, request_id);
-		spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+		spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 		break;
 	default:
 		retval = -ENOTTY;
@@ -1125,7 +1125,7 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)
 	struct scsi_cmnd *cmd;
 	TW_Command_Full *full_command_packet;
 
-	spin_lock(tw_dev->host->host_lock);
+	spin_lock(&tw_dev->host->host_lock);
 
 	/* Read host interrupt status */
 	reg = readl(TWL_HISTAT_REG_ADDR(tw_dev));
@@ -1229,7 +1229,7 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)
 	}
 
 twl_interrupt_bail:
-	spin_unlock(tw_dev->host->host_lock);
+	spin_unlock(&tw_dev->host->host_lock);
 	return IRQ_RETVAL(handled);
 } /* End twl_interrupt() */
 
@@ -1360,7 +1360,7 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
 	TWL_MASK_INTERRUPTS(tw_dev);
 	TWL_CLEAR_DB_INTERRUPT(tw_dev);
 
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 
 	/* Abort all requests that are in progress */
 	for (i = 0; i < TW_Q_LENGTH; i++) {
@@ -1386,7 +1386,7 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
 	tw_dev->free_tail = TW_Q_START;
 	tw_dev->posted_request_count = 0;
 
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 	if (twl_reset_sequence(tw_dev, 1))
 		goto out;
drivers/scsi/3w-xxxx.c +12 -12
index c68678fa72c1e..7f7bf5b5640de 100644
@@ -495,7 +495,7 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
 	unsigned long flags = 0;
 	ssize_t len;
 
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 	len = sysfs_emit(buf, "3w-xxxx Driver version: %s\n"
 			 "Current commands posted:   %4d\n"
 			 "Max commands posted:       %4d\n"
@@ -518,7 +518,7 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
 			 tw_dev->max_sector_count,
 			 tw_dev->num_resets,
 			 tw_dev->aen_count);
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 	return len;
 } /* End tw_show_stats() */
 
@@ -935,7 +935,7 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long a
 			dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): caught TW_AEN_LISTEN.\n");
 			memset(tw_ioctl->data_buffer, 0, data_buffer_length);
 
-			spin_lock_irqsave(tw_dev->host->host_lock, flags);
+			spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 			if (tw_dev->aen_head == tw_dev->aen_tail) {
 				tw_aen_code = TW_AEN_QUEUE_EMPTY;
 			} else {
@@ -946,12 +946,12 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long a
 					tw_dev->aen_head = tw_dev->aen_head + 1;
 				}
 			}
-			spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+			spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 			memcpy(tw_ioctl->data_buffer, &tw_aen_code, sizeof(tw_aen_code));
 			break;
 		case TW_CMD_PACKET_WITH_DATA:
 			dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): caught TW_CMD_PACKET_WITH_DATA.\n");
-			spin_lock_irqsave(tw_dev->host->host_lock, flags);
+			spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 
 			tw_state_request_start(tw_dev, &request_id);
 
@@ -983,7 +983,7 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long a
 
 			/* Now post the command packet to the controller */
 			tw_post_command_packet(tw_dev, request_id);
-			spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+			spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 			timeout = TW_IOCTL_CHRDEV_TIMEOUT*HZ;
 
@@ -1005,11 +1005,11 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long a
 			memcpy(&(tw_ioctl->firmware_command), tw_dev->command_packet_virtual_address[request_id], sizeof(TW_Command));
 
 			/* Now complete the io */
-			spin_lock_irqsave(tw_dev->host->host_lock, flags);
+			spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 			tw_dev->posted_request_count--;
 			tw_dev->state[request_id] = TW_S_COMPLETED;
 			tw_state_request_finish(tw_dev, request_id);
-			spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+			spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 			break;
 		default:
 			retval = -ENOTTY;
@@ -1296,7 +1296,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
 	set_bit(TW_IN_RESET, &tw_dev->flags);
 	TW_DISABLE_INTERRUPTS(tw_dev);
 	TW_MASK_COMMAND_INTERRUPT(tw_dev);
-	spin_lock_irqsave(tw_dev->host->host_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 
 	/* Abort all requests that are in progress */
 	for (i=0;i<TW_Q_LENGTH;i++) {
@@ -1325,7 +1325,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
 	tw_dev->pending_tail = TW_Q_START;
 	tw_dev->reset_print = 0;
 
-	spin_unlock_irqrestore(tw_dev->host->host_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 
 	if (tw_reset_sequence(tw_dev)) {
 		printk(KERN_WARNING "3w-xxxx: scsi%d: Reset sequence failed.\n", tw_dev->host->host_no);
@@ -2005,7 +2005,7 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)
 	int handled = 0;
 
 	/* Get the host lock for io completions */
-	spin_lock(tw_dev->host->host_lock);
+	spin_lock(&tw_dev->host->host_lock);
 
 	/* Read the registers */
 	status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev));
@@ -2185,7 +2185,7 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)
 	}
 
 tw_interrupt_bail:
-	spin_unlock(tw_dev->host->host_lock);
+	spin_unlock(&tw_dev->host->host_lock);
 	return IRQ_RETVAL(handled);
 } /* End tw_interrupt() */
 
drivers/scsi/53c700.c +8 -8
index c78f74b8f45c8..eb3a69dff1e72 100644
@@ -1499,7 +1499,7 @@ NCR_700_intr(int irq, void *dev_id)
 	 * lock to enter the done routines.  When that happens, we
 	 * need to ensure that for this driver, the host lock and the
 	 * queue lock point to the same thing. */
-	spin_lock_irqsave(host->host_lock, flags);
+	spin_lock_irqsave(&host->host_lock, flags);
 	if((istat = NCR_700_readb(host, ISTAT_REG))
 	      & (SCSI_INT_PENDING | DMA_INT_PENDING)) {
 		__u32 dsps;
@@ -1747,7 +1747,7 @@ NCR_700_intr(int irq, void *dev_id)
 		}
 	}
  out_unlock:
-	spin_unlock_irqrestore(host->host_lock, flags);
+	spin_unlock_irqrestore(&host->host_lock, flags);
 	return IRQ_RETVAL(handled);
 }
 
@@ -1948,27 +1948,27 @@ NCR_700_host_reset(struct scsi_cmnd * SCp)
 	/* In theory, eh_complete should always be null because the
 	 * eh is single threaded, but just in case we're handling a
 	 * reset via sg or something */
-	spin_lock_irq(SCp->device->host->host_lock);
+	spin_lock_irq(&SCp->device->host->host_lock);
 	while (hostdata->eh_complete != NULL) {
-		spin_unlock_irq(SCp->device->host->host_lock);
+		spin_unlock_irq(&SCp->device->host->host_lock);
 		msleep_interruptible(100);
-		spin_lock_irq(SCp->device->host->host_lock);
+		spin_lock_irq(&SCp->device->host->host_lock);
 	}
 
 	hostdata->eh_complete = &complete;
 	NCR_700_internal_bus_reset(SCp->device->host);
 	NCR_700_chip_reset(SCp->device->host);
 
-	spin_unlock_irq(SCp->device->host->host_lock);
+	spin_unlock_irq(&SCp->device->host->host_lock);
 	wait_for_completion(&complete);
-	spin_lock_irq(SCp->device->host->host_lock);
+	spin_lock_irq(&SCp->device->host->host_lock);
 
 	hostdata->eh_complete = NULL;
 	/* Revalidate the transport parameters of the failing device */
 	if(hostdata->fast)
 		spi_schedule_dv_device(SCp->device);
 
-	spin_unlock_irq(SCp->device->host->host_lock);
+	spin_unlock_irq(&SCp->device->host->host_lock);
 	return SUCCESS;
 }
 
drivers/scsi/BusLogic.c +10 -10
index 5304d2febd63e..27b446c0c5d0f 100644
@@ -2744,7 +2744,7 @@ static irqreturn_t blogic_inthandler(int irq_ch, void *devid)
 	/*
 	   Acquire exclusive access to Host Adapter.
 	 */
-	spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag);
+	spin_lock_irqsave(&adapter->scsi_host->host_lock, processor_flag);
 	/*
 	   Handle Interrupts appropriately for each Host Adapter type.
 	 */
@@ -2812,7 +2812,7 @@ static irqreturn_t blogic_inthandler(int irq_ch, void *devid)
 	/*
 	   Release exclusive access to Host Adapter.
 	 */
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag);
+	spin_unlock_irqrestore(&adapter->scsi_host->host_lock, processor_flag);
 	return IRQ_HANDLED;
 }
 
@@ -2864,12 +2864,12 @@ static int blogic_hostreset(struct scsi_cmnd *SCpnt)
 	struct blogic_tgt_stats *stats = &adapter->tgt_stats[id];
 	int rc;
 
-	spin_lock_irq(SCpnt->device->host->host_lock);
+	spin_lock_irq(&SCpnt->device->host->host_lock);
 
 	blogic_inc_count(&stats->adapter_reset_req);
 
 	rc = blogic_resetadapter(adapter, false);
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(&SCpnt->device->host->host_lock);
 	return rc;
 }
 
@@ -2915,9 +2915,9 @@ static enum scsi_qc_status blogic_qcmd_lck(struct scsi_cmnd *command)
 	 */
 	ccb = blogic_alloc_ccb(adapter);
 	if (ccb == NULL) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
+		spin_unlock_irq(&adapter->scsi_host->host_lock);
 		blogic_delay(1);
-		spin_lock_irq(adapter->scsi_host->host_lock);
+		spin_lock_irq(&adapter->scsi_host->host_lock);
 		ccb = blogic_alloc_ccb(adapter);
 		if (ccb == NULL) {
 			command->result = DID_ERROR << 16;
@@ -3062,10 +3062,10 @@ static enum scsi_qc_status blogic_qcmd_lck(struct scsi_cmnd *command)
 		   be initiated soon.
 		 */
 		if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
-			spin_unlock_irq(adapter->scsi_host->host_lock);
+			spin_unlock_irq(&adapter->scsi_host->host_lock);
 			blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter);
 			blogic_delay(1);
-			spin_lock_irq(adapter->scsi_host->host_lock);
+			spin_lock_irq(&adapter->scsi_host->host_lock);
 			if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START,
 						ccb)) {
 				blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter);
@@ -3212,9 +3212,9 @@ static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
 	 */
 
 	if (hard_reset) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
+		spin_unlock_irq(&adapter->scsi_host->host_lock);
 		blogic_delay(adapter->bus_settle_time);
-		spin_lock_irq(adapter->scsi_host->host_lock);
+		spin_lock_irq(&adapter->scsi_host->host_lock);
 	}
 
 	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
drivers/scsi/a100u2w.c +2 -2
index 4365b896f5c47..7e6776325d9b8 100644
@@ -1058,9 +1058,9 @@ static irqreturn_t inia100_intr(int irqno, void *devid)
 	unsigned long flags;
 	irqreturn_t res;
 
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	res = orc_interrupt(host);
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 
 	return res;
 }
drivers/scsi/a2091.c +2 -2
index f81e53b53e203..223065529654f 100644
@@ -39,9 +39,9 @@ static irqreturn_t a2091_intr(int irq, void *data)
 	if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS))
 		return IRQ_NONE;
 
-	spin_lock_irqsave(instance->host_lock, flags);
+	spin_lock_irqsave(&instance->host_lock, flags);
 	wd33c93_intr(instance);
-	spin_unlock_irqrestore(instance->host_lock, flags);
+	spin_unlock_irqrestore(&instance->host_lock, flags);
 	return IRQ_HANDLED;
 }
 
drivers/scsi/a3000.c +2 -2
index bf054dd7682bf..dd0924572c0e1 100644
@@ -41,9 +41,9 @@ static irqreturn_t a3000_intr(int irq, void *data)
 	if (!(status & ISTR_INT_P))
 		return IRQ_NONE;
 	if (status & ISTR_INTS) {
-		spin_lock_irqsave(instance->host_lock, flags);
+		spin_lock_irqsave(&instance->host_lock, flags);
 		wd33c93_intr(instance);
-		spin_unlock_irqrestore(instance->host_lock, flags);
+		spin_unlock_irqrestore(&instance->host_lock, flags);
 		return IRQ_HANDLED;
 	}
 	pr_warn("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n", status);
drivers/scsi/aacraid/commsup.c +4 -4
index c4485629f7923..347d480a39b08 100644
@@ -1487,7 +1487,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	 */
 	aac_adapter_disable_int(aac);
 	if (aac->thread && aac->thread->pid != current->pid) {
-		spin_unlock_irq(host->host_lock);
+		spin_unlock_irq(&host->host_lock);
 		kthread_stop(aac->thread);
 		aac->thread = NULL;
 		jafo = 1;
@@ -1612,7 +1612,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	}
 
 	if (jafo) {
-		spin_lock_irq(host->host_lock);
+		spin_lock_irq(&host->host_lock);
 	}
 	return retval;
 }
@@ -1644,11 +1644,11 @@ int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	/* Quiesce build, flush cache, write through mode */
 	if (forced < 2)
 		aac_send_shutdown(aac);
-	spin_lock_irqsave(host->host_lock, flagv);
+	spin_lock_irqsave(&host->host_lock, flagv);
 	bled = forced ? forced :
 			(aac_check_reset != 0 && aac_check_reset != 1);
 	retval = _aac_reset_adapter(aac, bled, reset_type);
-	spin_unlock_irqrestore(host->host_lock, flagv);
+	spin_unlock_irqrestore(&host->host_lock, flagv);
 
 	unblock_retval = scsi_host_unblock(host, SDEV_RUNNING);
 	if (!retval)
drivers/scsi/advansys.c +4 -4
index 5cdbf2bdb13df..e6fa05ffc0240 100644
@@ -7072,9 +7072,9 @@ static int advansys_reset(struct scsi_cmnd *scp)
 			ret = FAILED;
 			break;
 		}
-		spin_lock_irqsave(shost->host_lock, flags);
+		spin_lock_irqsave(&shost->host_lock, flags);
 		AdvISR(adv_dvc);
-		spin_unlock_irqrestore(shost->host_lock, flags);
+		spin_unlock_irqrestore(&shost->host_lock, flags);
 	}
 
 	ASC_DBG(1, "ret %d\n", ret);
@@ -7138,7 +7138,7 @@ static irqreturn_t advansys_interrupt(int irq, void *dev_id)
 	unsigned long flags;
 
 	ASC_DBG(2, "boardp 0x%p\n", boardp);
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	if (ASC_NARROW_BOARD(boardp)) {
 		if (AscIsIntPending(shost->io_port)) {
 			result = IRQ_HANDLED;
@@ -7153,7 +7153,7 @@ static irqreturn_t advansys_interrupt(int irq, void *dev_id)
 			ASC_STATS(shost, interrupt);
 		}
 	}
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 
 	ASC_DBG(1, "end\n");
 	return result;
drivers/scsi/aha1542.c +10 -10
index 93dab19c1cb95..7ea38d5090720 100644
@@ -306,7 +306,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
 #endif
 	number_serviced = 0;
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 	while (1) {
 		flag = inb(INTRFLAGS(sh->io_port));
 
@@ -339,7 +339,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
 		} while (mbi != aha1542->aha1542_last_mbi_used);
 
 		if (mb[mbi].status == 0) {
-			spin_unlock_irqrestore(sh->host_lock, flags);
+			spin_unlock_irqrestore(&sh->host_lock, flags);
 			/* Hmm, no mail.  Must have read it the last time around */
 			if (!number_serviced)
 				shost_printk(KERN_WARNING, sh, "interrupt received, but no mail.\n");
@@ -367,7 +367,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
 		tmp_cmd = aha1542->int_cmds[mbo];
 
 		if (!tmp_cmd) {
-			spin_unlock_irqrestore(sh->host_lock, flags);
+			spin_unlock_irqrestore(&sh->host_lock, flags);
 			shost_printk(KERN_WARNING, sh, "Unexpected interrupt\n");
 			shost_printk(KERN_WARNING, sh, "tarstat=%x, hastat=%x idlun=%x ccb#=%d\n", ccb[mbo].tarstat,
 			       ccb[mbo].hastat, ccb[mbo].idlun, mbo);
@@ -461,7 +461,7 @@ static enum scsi_qc_status aha1542_queuecommand(struct Scsi_Host *sh,
 	 * is how the host adapter will scan for them
 	 */
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 	mbo = aha1542->aha1542_last_mbo_used + 1;
 	if (mbo >= AHA1542_MAILBOXES)
 		mbo = 0;
@@ -518,7 +518,7 @@ static enum scsi_qc_status aha1542_queuecommand(struct Scsi_Host *sh,
 #endif
 	mb[mbo].status = 1;
 	aha1542_outb(cmd->device->host->io_port, CMD_START_SCSI);
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 
 	return 0;
 }
@@ -873,7 +873,7 @@ static int aha1542_dev_reset(struct scsi_cmnd *cmd)
 	int mbo;
 	struct ccb *ccb = aha1542->ccb;
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 	mbo = aha1542->aha1542_last_mbo_used + 1;
 	if (mbo >= AHA1542_MAILBOXES)
 		mbo = 0;
@@ -913,7 +913,7 @@ static int aha1542_dev_reset(struct scsi_cmnd *cmd)
 	 * target
 	 */
 	aha1542_outb(sh->io_port, CMD_START_SCSI);
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 
 	scmd_printk(KERN_WARNING, cmd,
 		"Trying device reset for target\n");
@@ -928,7 +928,7 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)
 	unsigned long flags;
 	int i;
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 	/*
 	 * This does a scsi reset for all devices on the bus.
 	 * In principle, we could also reset the 1542 - should
@@ -939,7 +939,7 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)
 
 	if (!wait_mask(STATUS(cmd->device->host->io_port),
 	     STATMASK, IDLE, STST | DIAGF | INVDCMD | DF | CDF, 0)) {
-		spin_unlock_irqrestore(sh->host_lock, flags);
+		spin_unlock_irqrestore(&sh->host_lock, flags);
 		return FAILED;
 	}
 
@@ -978,7 +978,7 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)
 		}
 	}
 
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 	return SUCCESS;
 }
 
drivers/scsi/aha1740.c +6 -6
index c435769359f22..b01701d139b90 100644
@@ -225,7 +225,7 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id)
 	
 	if (!host)
 		panic("aha1740.c: Irq from unknown host!\n");
-	spin_lock_irqsave(host->host_lock, flags);
+	spin_lock_irqsave(&host->host_lock, flags);
 	base = host->io_port;
 	number_serviced = 0;
 	edev = HOSTDATA(host)->edev;
@@ -315,7 +315,7 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id)
 		number_serviced++;
 	}
 
-	spin_unlock_irqrestore(host->host_lock, flags);
+	spin_unlock_irqrestore(&host->host_lock, flags);
 	return IRQ_RETVAL(handled);
 }
 
@@ -353,7 +353,7 @@ static enum scsi_qc_status aha1740_queuecommand_lck(struct scsi_cmnd *SCpnt)
 #endif
 
 	/* locate an available ecb */
-	spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
+	spin_lock_irqsave(&SCpnt->device->host->host_lock, flags);
 	ecbno = host->last_ecb_used + 1; /* An optimization */
 	if (ecbno >= AHA1740_ECBS)
 		ecbno = 0;
@@ -372,7 +372,7 @@ static enum scsi_qc_status aha1740_queuecommand_lck(struct scsi_cmnd *SCpnt)
 						    doubles as reserved flag */
 
 	host->last_ecb_used = ecbno;    
-	spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
+	spin_unlock_irqrestore(&SCpnt->device->host->host_lock, flags);
 
 #ifdef DEBUG
 	printk("Sending command (%d %x)...", ecbno, done);
@@ -465,7 +465,7 @@ static enum scsi_qc_status aha1740_queuecommand_lck(struct scsi_cmnd *SCpnt)
 		unsigned int base = SCpnt->device->host->io_port;
 		DEB(printk("aha1740[%d] critical section\n",ecbno));
 
-		spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
+		spin_lock_irqsave(&SCpnt->device->host->host_lock, flags);
 		for (loopcnt = 0; ; loopcnt++) {
 			if (inb(G2STAT(base)) & G2STAT_MBXOUT) break;
 			if (loopcnt == LOOPCNT_WARN) {
@@ -485,7 +485,7 @@ static enum scsi_qc_status aha1740_queuecommand_lck(struct scsi_cmnd *SCpnt)
 				panic("aha1740.c: attn wait failed!\n");
 		}
 		outb(ATTN_START | (target & 7), ATTN(base)); /* Start it up */
-		spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
+		spin_unlock_irqrestore(&SCpnt->device->host->host_lock, flags);
 		DEB(printk("aha1740[%d] request queued.\n",ecbno));
 	} else
 		printk(KERN_ALERT "aha1740_queuecommand: done can't be NULL\n");
drivers/scsi/arm/eesox.c +4 -4
index 99be9da8757f4..0cb1308eda4e6 100644
@@ -124,14 +124,14 @@ eesoxscsi_terminator_ctl(struct Scsi_Host *host, int on_off)
 	struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata;
 	unsigned long flags;
 
-	spin_lock_irqsave(host->host_lock, flags);
+	spin_lock_irqsave(&host->host_lock, flags);
 	if (on_off)
 		info->control |= EESOX_TERM_ENABLE;
 	else
 		info->control &= ~EESOX_TERM_ENABLE;
 
 	writeb(info->control, info->ctl_port);
-	spin_unlock_irqrestore(host->host_lock, flags);
+	spin_unlock_irqrestore(&host->host_lock, flags);
 }
 
 /* Prototype: void eesoxscsi_intr(irq, *dev_id, *regs)
@@ -457,14 +457,14 @@ static ssize_t eesoxscsi_store_term(struct device *dev, struct device_attribute
 	unsigned long flags;
 
 	if (len > 1) {
-		spin_lock_irqsave(host->host_lock, flags);
+		spin_lock_irqsave(&host->host_lock, flags);
 		if (buf[0] != '0') {
 			info->control |= EESOX_TERM_ENABLE;
 		} else {
 			info->control &= ~EESOX_TERM_ENABLE;
 		}
 		writeb(info->control, info->ctl_port);
-		spin_unlock_irqrestore(host->host_lock, flags);
+		spin_unlock_irqrestore(&host->host_lock, flags);
 	}
 
 	return len;
drivers/scsi/arm/fas216.c +10 -10
index fccfacaaf1d52..d0752c0bf4254 100644
@@ -2295,7 +2295,7 @@ static enum scsi_qc_status fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt)
 	 * However, we must re-enable interrupts, or else we'll be
 	 * waiting forever.
 	 */
-	spin_unlock_irq(info->host->host_lock);
+	spin_unlock_irq(&info->host->host_lock);
 
 	while (!info->internal_done) {
 		/*
@@ -2307,13 +2307,13 @@ static enum scsi_qc_status fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt)
 		 * to be some time (eg, disconnected).
 		 */
 		if (fas216_readb(info, REG_STAT) & STAT_INT) {
-			spin_lock_irq(info->host->host_lock);
+			spin_lock_irq(&info->host->host_lock);
 			fas216_intr(info);
-			spin_unlock_irq(info->host->host_lock);
+			spin_unlock_irq(&info->host->host_lock);
 		}
 	}
 
-	spin_lock_irq(info->host->host_lock);
+	spin_lock_irq(&info->host->host_lock);
 
 	scsi_done(SCpnt);
 
@@ -2662,7 +2662,7 @@ int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
 {
 	FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata;
 
-	spin_lock_irq(info->host->host_lock);
+	spin_lock_irq(&info->host->host_lock);
 
 	fas216_checkmagic(info);
 
@@ -2679,9 +2679,9 @@ int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
 	 * IRQs if we sleep, but we must relock and disable
 	 * IRQs after the sleep.
 	 */
-	spin_unlock_irq(info->host->host_lock);
+	spin_unlock_irq(&info->host->host_lock);
 	msleep(50 * 1000/100);
-	spin_lock_irq(info->host->host_lock);
+	spin_lock_irq(&info->host->host_lock);
 
 	/*
 	 * Release the SCSI reset.
@@ -2690,7 +2690,7 @@ int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
 
 	fas216_init_chip(info);
 
-	spin_unlock_irq(info->host->host_lock);
+	spin_unlock_irq(&info->host->host_lock);
 	return SUCCESS;
 }
 
@@ -2917,9 +2917,9 @@ int fas216_add(struct Scsi_Host *host, struct device *dev)
 	/*
 	 * scsi standard says wait 250ms
 	 */
-	spin_unlock_irq(info->host->host_lock);
+	spin_unlock_irq(&info->host->host_lock);
 	msleep(100*1000/100);
-	spin_lock_irq(info->host->host_lock);
+	spin_lock_irq(&info->host->host_lock);
 
 	fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]);
 	fas216_readb(info, REG_INST);
drivers/scsi/atp870u.c +6 -6
index 67459d81f479e..c608d22ad2c60 100644
@@ -225,7 +225,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
 			/*
 			 *	Issue more commands
 			 */
-			spin_lock_irqsave(dev->host->host_lock, flags);
+			spin_lock_irqsave(&dev->host->host_lock, flags);
 			if (((dev->quhd[c] != dev->quend[c]) ||
 			     (dev->last_cmd[c] != 0xff)) &&
 			    (dev->in_snd[c] == 0)) {
@@ -234,7 +234,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
 #endif
 				send_s870(dev,c);
 			}
-			spin_unlock_irqrestore(dev->host->host_lock, flags);
+			spin_unlock_irqrestore(&dev->host->host_lock, flags);
 			/*
 			 *	Done
 			 */
@@ -511,7 +511,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
 			 */
 			scsi_dma_unmap(workreq);
 
-			spin_lock_irqsave(dev->host->host_lock, flags);
+			spin_lock_irqsave(&dev->host->host_lock, flags);
 			scsi_done(workreq);
 #ifdef ED_DBGP
 			   printk("workreq->scsi_done\n");
@@ -521,7 +521,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
 			 */
 			dev->id[c][target_id].curr_req = NULL;
 			dev->working[c]--;
-			spin_unlock_irqrestore(dev->host->host_lock, flags);
+			spin_unlock_irqrestore(&dev->host->host_lock, flags);
 			/*
 			 *      Take it back wide
 			 */
@@ -533,7 +533,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
 			/*
 			 *	If there is stuff to send and nothing going then send it
 			 */
-			spin_lock_irqsave(dev->host->host_lock, flags);
+			spin_lock_irqsave(&dev->host->host_lock, flags);
 			if (((dev->last_cmd[c] != 0xff) ||
 			     (dev->quhd[c] != dev->quend[c])) &&
 			    (dev->in_snd[c] == 0)) {
@@ -542,7 +542,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
 #endif
 			   send_s870(dev,c);
 			}
-			spin_unlock_irqrestore(dev->host->host_lock, flags);
+			spin_unlock_irqrestore(&dev->host->host_lock, flags);
 			dev->in_int[c] = 0;
 			return IRQ_HANDLED;
 		}
drivers/scsi/bfa/bfad_bsg.c +2 -2
index 292bc9aa43f1f..143a3913c6504 100644
@@ -2552,7 +2552,7 @@ static void bfad_reset_sdev_bflags(struct bfad_im_port_s *im_port,
 	struct scsi_device *sdev;
 	unsigned long flags;
 
-	spin_lock_irqsave(im_port->shost->host_lock, flags);
+	spin_lock_irqsave(&im_port->shost->host_lock, flags);
 	list_for_each_entry(itnim, &im_port->itnim_mapped_list, list_entry) {
 		sdev = __scsi_device_lookup(im_port->shost, itnim->channel,
 					    itnim->scsi_tgt_id, 0);
@@ -2563,7 +2563,7 @@ static void bfad_reset_sdev_bflags(struct bfad_im_port_s *im_port,
 				sdev->sdev_bflags &= ~scan_flags;
 		}
 	}
-	spin_unlock_irqrestore(im_port->shost->host_lock, flags);
+	spin_unlock_irqrestore(&im_port->shost->host_lock, flags);
 }
 
 /* Function to reset the LUN SCAN mode */
drivers/scsi/csiostor/csio_attr.c +2 -2
index 200e50089711e..9f021a7f78bd2 100644
@@ -84,9 +84,9 @@ csio_reg_rnode(struct csio_rnode *rn)
 
 	ln->num_reg_rnodes++;
 	rport = rn->rport;
-	spin_lock_irq(shost->host_lock);
+	spin_lock_irq(&shost->host_lock);
 	*((struct csio_rnode **)rport->dd_data) = rn;
-	spin_unlock_irq(shost->host_lock);
+	spin_unlock_irq(&shost->host_lock);
 
 	sp = &rn->rn_sparm;
 	rport->maxframe_size = ntohs(sp->csp.sp_bb_data);
drivers/scsi/csiostor/csio_scsi.c +2 -2
index b1de615cf3162..0114e70e98844 100644
@@ -2256,14 +2256,14 @@ csio_scan_finished(struct Scsi_Host *shost, unsigned long time)
 	struct csio_lnode *ln = shost_priv(shost);
 	int rv = 1;
 
-	spin_lock_irq(shost->host_lock);
+	spin_lock_irq(&shost->host_lock);
 	if (!ln->hwp || csio_list_deleted(&ln->sm.sm_list))
 		goto out;
 
 	rv = csio_scan_done(ln, jiffies, time, csio_max_scan_tmo * HZ,
 			    csio_delta_scan_tmo * HZ);
 out:
-	spin_unlock_irq(shost->host_lock);
+	spin_unlock_irq(&shost->host_lock);
 
 	return rv;
 }
drivers/scsi/dc395x.c +4 -4
index ba490174a417d..10e2078f4a0fd 100644
@@ -91,8 +91,8 @@
 #endif
 
 
-#define DC395x_LOCK_IO(dev,flags)		spin_lock_irqsave(((struct Scsi_Host *)dev)->host_lock, flags)
-#define DC395x_UNLOCK_IO(dev,flags)		spin_unlock_irqrestore(((struct Scsi_Host *)dev)->host_lock, flags)
+#define DC395x_LOCK_IO(dev,flags)		spin_lock_irqsave(&((struct Scsi_Host *)dev)->host_lock, flags)
+#define DC395x_UNLOCK_IO(dev,flags)		spin_unlock_irqrestore(&((struct Scsi_Host *)dev)->host_lock, flags)
 
 #define DC395x_read8(acb,address)		(u8)(inb(acb->io_port_base + (address)))
 #define DC395x_read16(acb,address)		(u16)(inw(acb->io_port_base + (address)))
@@ -1016,9 +1016,9 @@ static int dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
 {
 	int rc;
 
-	spin_lock_irq(cmd->device->host->host_lock);
+	spin_lock_irq(&cmd->device->host->host_lock);
 	rc = __dc395x_eh_bus_reset(cmd);
-	spin_unlock_irq(cmd->device->host->host_lock);
+	spin_unlock_irq(&cmd->device->host->host_lock);
 
 	return rc;
 }
drivers/scsi/esp_scsi.c +16 -16
index 897a01d3e3038..9993b0ae9c4f2 100644
@@ -2174,7 +2174,7 @@ irqreturn_t scsi_esp_intr(int irq, void *dev_id)
 	unsigned long flags;
 	irqreturn_t ret;
 
-	spin_lock_irqsave(esp->host->host_lock, flags);
+	spin_lock_irqsave(&esp->host->host_lock, flags);
 	ret = IRQ_NONE;
 	if (esp->ops->irq_pending(esp)) {
 		ret = IRQ_HANDLED;
@@ -2194,7 +2194,7 @@ irqreturn_t scsi_esp_intr(int irq, void *dev_id)
 				break;
 		}
 	}
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
 	return ret;
 }
@@ -2497,7 +2497,7 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 	/* XXX This helps a lot with debugging but might be a bit
 	 * XXX much for the final driver.
 	 */
-	spin_lock_irqsave(esp->host->host_lock, flags);
+	spin_lock_irqsave(&esp->host->host_lock, flags);
 	shost_printk(KERN_ERR, esp->host, "Aborting command [%p:%02x]\n",
 		     cmd, cmd->cmnd[0]);
 	ent = esp->active_cmd;
@@ -2514,9 +2514,9 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 			     ent->cmd, ent->cmd->cmnd[0]);
 	}
 	esp_dump_cmd_log(esp);
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
-	spin_lock_irqsave(esp->host->host_lock, flags);
+	spin_lock_irqsave(&esp->host->host_lock, flags);
 
 	ent = NULL;
 	list_for_each_entry(tmp, &esp->queued_cmds, list) {
@@ -2579,12 +2579,12 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 		goto out_failure;
 	}
 
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
 	if (!wait_for_completion_timeout(&eh_done, 5 * HZ)) {
-		spin_lock_irqsave(esp->host->host_lock, flags);
+		spin_lock_irqsave(&esp->host->host_lock, flags);
 		ent->eh_done = NULL;
-		spin_unlock_irqrestore(esp->host->host_lock, flags);
+		spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
 		return FAILED;
 	}
@@ -2592,7 +2592,7 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 	return SUCCESS;
 
 out_success:
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 	return SUCCESS;
 
 out_failure:
@@ -2600,7 +2600,7 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 	 * XXX since we know which target/lun in particular is
 	 * XXX causing trouble.
 	 */
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 	return FAILED;
 }
 
@@ -2612,7 +2612,7 @@ static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 
 	init_completion(&eh_reset);
 
-	spin_lock_irqsave(esp->host->host_lock, flags);
+	spin_lock_irqsave(&esp->host->host_lock, flags);
 
 	esp->eh_reset = &eh_reset;
 
@@ -2624,14 +2624,14 @@ static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 	esp->flags |= ESP_FLAG_RESETTING;
 	scsi_esp_cmd(esp, ESP_CMD_RS);
 
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
 	ssleep(esp_bus_reset_settle);
 
 	if (!wait_for_completion_timeout(&eh_reset, 5 * HZ)) {
-		spin_lock_irqsave(esp->host->host_lock, flags);
+		spin_lock_irqsave(&esp->host->host_lock, flags);
 		esp->eh_reset = NULL;
-		spin_unlock_irqrestore(esp->host->host_lock, flags);
+		spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
 		return FAILED;
 	}
@@ -2645,10 +2645,10 @@ static int esp_eh_host_reset_handler(struct scsi_cmnd *cmd)
 	struct esp *esp = shost_priv(cmd->device->host);
 	unsigned long flags;
 
-	spin_lock_irqsave(esp->host->host_lock, flags);
+	spin_lock_irqsave(&esp->host->host_lock, flags);
 	esp_bootup_reset(esp);
 	esp_reset_cleanup(esp);
-	spin_unlock_irqrestore(esp->host->host_lock, flags);
+	spin_unlock_irqrestore(&esp->host->host_lock, flags);
 
 	ssleep(esp_bus_reset_settle);
 
drivers/scsi/fcoe/fcoe.c +2 -2
index 438ac7c3a9e3f..a2cf65fac2970 100644
@@ -2705,7 +2705,7 @@ static void fcoe_vport_remove(struct fc_lport *lport)
 	fc_host = shost_to_fc_host(shost);
 
 	/* Loop through all the vports and mark them for deletion */
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
 		if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) {
 			continue;
@@ -2715,7 +2715,7 @@ static void fcoe_vport_remove(struct fc_lport *lport)
 				   &vport->vport_delete_work);
 		}
 	}
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 
 	flush_workqueue(fc_host_work_q(shost));
 }
drivers/scsi/fdomain.c +8 -8
index 22fbb0222f07d..b5766f752cdd8 100644
@@ -273,7 +273,7 @@ static void fdomain_work(struct work_struct *work)
 	int status;
 	int done = 0;
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 
 	if (scsi_pointer->phase & in_arbitration) {
 		status = inb(fd->base + REG_ASTAT);
@@ -380,7 +380,7 @@ static void fdomain_work(struct work_struct *work)
 			     fd->base + REG_ICTL);
 	}
 out:
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 }
 
 static irqreturn_t fdomain_irq(int irq, void *dev_id)
@@ -416,7 +416,7 @@ static enum scsi_qc_status fdomain_queue(struct Scsi_Host *sh,
 	scsi_pointer->phase		= in_arbitration;
 	scsi_set_resid(cmd, scsi_bufflen(cmd));
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 
 	fd->cur_cmd = cmd;
 
@@ -431,7 +431,7 @@ static enum scsi_qc_status fdomain_queue(struct Scsi_Host *sh,
 	/* Start arbitration */
 	outb(ACTL_ARB | ACTL_IRQEN | PARITY_MASK, fd->base + REG_ACTL);
 
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 
 	return 0;
 }
@@ -445,7 +445,7 @@ static int fdomain_abort(struct scsi_cmnd *cmd)
 	if (!fd->cur_cmd)
 		return FAILED;
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 
 	fdomain_make_bus_idle(fd);
 	fdomain_scsi_pointer(fd->cur_cmd)->phase |= aborted;
@@ -453,7 +453,7 @@ static int fdomain_abort(struct scsi_cmnd *cmd)
 	/* Aborts are not done well. . . */
 	set_host_byte(fd->cur_cmd, DID_ABORT);
 	fdomain_finish_cmd(fd);
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 	return SUCCESS;
 }
 
@@ -463,9 +463,9 @@ static int fdomain_host_reset(struct scsi_cmnd *cmd)
 	struct fdomain *fd = shost_priv(sh);
 	unsigned long flags;
 
-	spin_lock_irqsave(sh->host_lock, flags);
+	spin_lock_irqsave(&sh->host_lock, flags);
 	fdomain_reset(fd->base);
-	spin_unlock_irqrestore(sh->host_lock, flags);
+	spin_unlock_irqrestore(&sh->host_lock, flags);
 	return SUCCESS;
 }
 
drivers/scsi/gvp11.c +2 -2
index 79bd64e12adc2..a29457f5adfbe 100644
@@ -42,9 +42,9 @@ static irqreturn_t gvp11_intr(int irq, void *data)
 	if (!(status & GVP11_DMAC_INT_PENDING))
 		return IRQ_NONE;
 
-	spin_lock_irqsave(instance->host_lock, flags);
+	spin_lock_irqsave(&instance->host_lock, flags);
 	wd33c93_intr(instance);
-	spin_unlock_irqrestore(instance->host_lock, flags);
+	spin_unlock_irqrestore(&instance->host_lock, flags);
 	return IRQ_HANDLED;
 }
 
drivers/scsi/hosts.c +8 -9
index e72055c1ebbb5..e8361ba655644 100644
@@ -73,7 +73,7 @@ static struct class shost_class = {
  *	transition is illegal.
  **/
 int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state)
-	__must_hold(shost->host_lock)
+	__must_hold(&shost->host_lock)
 {
 	enum scsi_host_state oldstate = READ_ONCE(shost->shost_state);
 
@@ -168,14 +168,14 @@ void scsi_remove_host(struct Scsi_Host *shost)
 	unsigned long flags;
 
 	mutex_lock(&shost->scan_mutex);
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	if (scsi_host_set_state(shost, SHOST_CANCEL))
 		if (scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY)) {
-			spin_unlock_irqrestore(shost->host_lock, flags);
+			spin_unlock_irqrestore(&shost->host_lock, flags);
 			mutex_unlock(&shost->scan_mutex);
 			return;
 		}
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 
 	scsi_autopm_get_host(shost);
 	flush_workqueue(shost->tmf_work_q);
@@ -193,10 +193,10 @@ void scsi_remove_host(struct Scsi_Host *shost)
 	kref_put(&shost->tagset_refcnt, scsi_mq_free_tags);
 	wait_for_completion(&shost->tagset_freed);
 
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	if (scsi_host_set_state(shost, SHOST_DEL))
 		BUG_ON(scsi_host_set_state(shost, SHOST_DEL_RECOVERY));
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 
 	transport_unregister_device(&shost->shost_gendev);
 	device_unregister(&shost->shost_dev);
@@ -277,7 +277,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	if (error)
 		goto out_disable_runtime_pm;
 
-	scoped_guard(spinlock_irq, shost->host_lock)
+	scoped_guard(spinlock_irq, &shost->host_lock)
 		scsi_host_set_state(shost, SHOST_RUNNING);
 	get_device(shost->shost_gendev.parent);
 
@@ -414,8 +414,7 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
 	if (!shost)
 		return NULL;
 
-	shost->host_lock = &shost->default_lock;
-	scoped_guard(spinlock_init, shost->host_lock)
+	scoped_guard(spinlock_init, &shost->host_lock)
 		shost->shost_state = SHOST_CREATED;
 	INIT_LIST_HEAD(&shost->__devices);
 	INIT_LIST_HEAD(&shost->__targets);
drivers/scsi/hptiop.c +4 -4
index 7083c14c53028..a3afb3446bbba 100644
@@ -385,9 +385,9 @@ static int iop_send_sync_msg(struct hptiop_hba *hba, u32 msg, u32 millisec)
 	hba->ops->post_msg(hba, msg);
 
 	for (i = 0; i < millisec; i++) {
-		spin_lock_irq(hba->host->host_lock);
+		spin_lock_irq(&hba->host->host_lock);
 		hba->ops->iop_intr(hba);
-		spin_unlock_irq(hba->host->host_lock);
+		spin_unlock_irq(&hba->host->host_lock);
 		if (hba->msg_done)
 			break;
 		msleep(1);
@@ -836,9 +836,9 @@ static irqreturn_t hptiop_intr(int irq, void *dev_id)
 	int  handled;
 	unsigned long flags;
 
-	spin_lock_irqsave(hba->host->host_lock, flags);
+	spin_lock_irqsave(&hba->host->host_lock, flags);
 	handled = hba->ops->iop_intr(hba);
-	spin_unlock_irqrestore(hba->host->host_lock, flags);
+	spin_unlock_irqrestore(&hba->host->host_lock, flags);
 
 	return handled;
 }
drivers/scsi/ibmvscsi/ibmvfc-core.c +131 -131

904 lines not on this page · raw message

drivers/scsi/ibmvscsi/ibmvfc-nvme.c +4 -4
index 54f80b6265d45..9ac2671a3567d 100644
@@ -208,7 +208,7 @@ static void ibmvfc_nvme_ls_abort(struct nvme_fc_local_port *lport,
 	if (!vhost->logged_in || !evt)
 		return;
 
-	spin_lock_irqsave(vhost->host->host_lock, flags);
+	spin_lock_irqsave(&vhost->host->host_lock, flags);
 	kref_get(&tgt->kref);
 	ibmvfc_init_event(evt, ibmvfc_sync_nvme_completion, IBMVFC_MAD_FORMAT);
 	ibmvfc_init_ls_abort(evt, ls_abort);
@@ -217,14 +217,14 @@ static void ibmvfc_nvme_ls_abort(struct nvme_fc_local_port *lport,
 	if (ibmvfc_send_event(evt, vhost, default_timeout))
 		goto out;
 
-	spin_unlock_irqrestore(vhost->host->host_lock, flags);
+	spin_unlock_irqrestore(&vhost->host->host_lock, flags);
 
 	wait_for_completion(&evt->comp);
 	status = be16_to_cpu(rsp.mad_common.status);
-	spin_lock_irqsave(vhost->host->host_lock, flags);
+	spin_lock_irqsave(&vhost->host->host_lock, flags);
 	ibmvfc_free_event(evt);
 out:
-	spin_unlock_irqrestore(vhost->host->host_lock, flags);
+	spin_unlock_irqrestore(&vhost->host->host_lock, flags);
 	ibmvfc_dbg(vhost, "ls_abort: cancel failed with rc=%x\n", status);
 	kref_put(&tgt->kref, ibmvfc_release_tgt);
 }
drivers/scsi/ibmvscsi/ibmvscsi.c +43 -43

269 lines not on this page · raw message

drivers/scsi/imm.c +2 -2
index 0535252e77e3b..680399bc866dd 100644
@@ -781,10 +781,10 @@ static void imm_interrupt(struct work_struct *work)
 
 	imm_pb_dismiss(dev);
 
-	spin_lock_irqsave(host->host_lock, flags);
+	spin_lock_irqsave(&host->host_lock, flags);
 	dev->cur_cmd = NULL;
 	scsi_done(cmd);
-	spin_unlock_irqrestore(host->host_lock, flags);
+	spin_unlock_irqrestore(&host->host_lock, flags);
 	return;
 }
 
drivers/scsi/initio.c +4 -4
index 06fbe85dccfa6..da2670cd7edf3 100644
@@ -2507,9 +2507,9 @@ static irqreturn_t i91u_intr(int irqno, void *dev_id)
 	unsigned long flags;
 	int r;
 	
-	spin_lock_irqsave(dev->host_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 	r = initio_isr((struct initio_host *)dev->hostdata);
-	spin_unlock_irqrestore(dev->host_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 	if (r)
 		return IRQ_HANDLED;
 	else
@@ -2635,9 +2635,9 @@ static int i91u_bus_reset(struct scsi_cmnd * cmnd)
 
 	host = (struct initio_host *) cmnd->device->host->hostdata;
 
-	spin_lock_irq(cmnd->device->host->host_lock);
+	spin_lock_irq(&cmnd->device->host->host_lock);
 	initio_reset_scsi(host, 0);
-	spin_unlock_irq(cmnd->device->host->host_lock);
+	spin_unlock_irq(&cmnd->device->host->host_lock);
 
 	return SUCCESS;
 }
drivers/scsi/ipr.c +160 -160

528 lines not on this page · raw message

drivers/scsi/ips.c +13 -13
index 41ed73966a48c..45c5b9acb664c 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/libfc/fc_fcp.c +4 -4
index a5139e43ca4ce..60a675aa5a99c 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/libsas/sas_scsi_host.c +5 -5
index 97ac3db5dccb3..76517c8f0684d 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/lpfc/lpfc_els.c +15 -15
index 52fc5058976d9..6f6394a0047c2 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/lpfc/lpfc_hbadisc.c +22 -22

44 lines not on this page · raw message

drivers/scsi/lpfc/lpfc_init.c +8 -8
index 23355f12fbffa..6460127bcc7b0 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/lpfc/lpfc_scsi.c +4 -4
index 8a795c65e3c3e..50616b05488a8 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/lpfc/lpfc_sli.c +2 -2
index cfa4371169f13..cd285e87c278c 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/mac53c94.c +4 -4
index de2bd860b9d7c..613bb204b6afa 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/megaraid/megaraid_sas_base.c +9 -9
index f0152b043e18c..e693cb9e0dee6 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/mesh.c +12 -12
index dc1402b321da4..1883ba08af7db 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/mvumi.c +13 -13
index e70d336b4ab39..e9e2c25cde682 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/nsp32.c +4 -4
index 9c9281222a0ac..98550c73d8a0c 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/pcmcia/sym53c500_cs.c +4 -4
index 1530c1ad5d36a..aeae5c16e406f 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/pmcraid.c +42 -42

84 lines not on this page · raw message

drivers/scsi/qla1280.c +22 -22

44 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_attr.c +2 -2
index a4ca22024edeb..781149497ff80 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_init.c +2 -2
index bb0cc71de37b8..ccb039d97353b 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qlogicfas408.c +4 -4
index d36293bc27173..af6f6eb516363 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qlogicpti.c +10 -10
index ea0a2b5a0a420..0989160618356 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi.c +6 -6
index 76cdad063f7bc..4e7e7a6b7315b 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi_debugfs.c +1 -1
index eb52e39f37c92..54d8824250b1a 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi_error.c +35 -35

70 lines not on this page · raw message

drivers/scsi/scsi_lib.c +23 -23

46 lines not on this page · raw message

drivers/scsi/scsi_scan.c +8 -8
index 3b82e80e807a7..96e4065ae8b55 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi_sysfs.c +14 -14
index 9480432f650b7..fe54792ed69e4 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi_transport_fc.c +68 -68

136 lines not on this page · raw message

drivers/scsi/sgiwd93.c +2 -2
index 6594661db5f40..455208776239c 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/snic/snic_disc.c +8 -8
index 71d34a702f2ab..8c262b4bbb831 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/stex.c +24 -24

48 lines not on this page · raw message

drivers/scsi/sym53c8xx_2/sym_glue.c +28 -28

56 lines not on this page · raw message

drivers/scsi/wd33c93.c +2 -2
index 1e49d0402f0b5..2a698b93faf8f 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/wd719x.c +12 -12
index 830d40f57f6a4..85cf6c9d2ec90 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/xen-scsifront.c +20 -20
index 989bcaee42caf..2bff5e35822f1 100644

Lines of this file are not shown. View the raw message.

drivers/target/target_core_pscsi.c +8 -8
index 9ed2818c3028d..fd1b82fc72902 100644

Lines of this file are not shown. View the raw message.

drivers/ufs/core/ufs-debugfs.c +2 -2
index ed1de70e2ec1c..9f83628f3e2cf 100644

Lines of this file are not shown. View the raw message.

drivers/ufs/core/ufs-sysfs.c +6 -6
index 63e670d1a9d9e..cf49ad0258e14 100644

Lines of this file are not shown. View the raw message.

drivers/ufs/core/ufshcd.c +76 -76

152 lines not on this page · raw message

drivers/ufs/host/ufs-mediatek.c +2 -2
index 814c1b7343b9e..359cdb30e9b65 100644

Lines of this file are not shown. View the raw message.

drivers/ufs/host/ufs-sprd.c +2 -2
index a5e8c591beadd..6862250c542e0 100644

Lines of this file are not shown. View the raw message.

drivers/usb/storage/uas.c +6 -6
index 2651629812694..8655edbd66b16 100644

Lines of this file are not shown. View the raw message.

drivers/usb/storage/usb.h +2 -2
index 97c6196d639b4..c26d008e5184e 100644

Lines of this file are not shown. View the raw message.

include/scsi/scsi_host.h +4 -5
index 16243ec376cd9..daaf1247673ff 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.7

Part of the diff is not shown here. View the raw message.

#1 lore raw
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

Pre-existing issues:
- [High] Permanent event pool leak in ibmvfc_cancel_all_mq() on error path.
- [High] Unchecked NULL pointer dereference in ibmvfc_cancel_all_sq() when ibmvfc_init_tmf() fails.
- [High] Interrupt state corruption in blogic_qcmd_lck due to mismatched spinlock APIs.
- [High] Device lifecycle violation causing memory leak in fc_remote_port_create and fc_vport_setup. --

commit 1fa27f7b3e85b7b53dfe21659957115715567c63
Author: John Garry <[email protected]>
Subject: scsi: core: Drop Scsi_Host.default_lock

This patch removes the default_lock from Scsi_Host and makes host_lock an actual lock instead of a pointer. This simplifies the locking mechanism and removes an unnecessary pointer dereference across the subsystem.

Quoted 4 lines
drivers/scsi/BusLogic.c +0 -0
index 5304d2febd63e..27b446c0c5d0f 100644

[ ... ]

drivers/scsi/BusLogic.c static enum scsi_qc_status blogic_qcmd_lck(struct scsi_cmnd *command) · line 2922

Quoted 11 lines
drivers/scsi/BusLogic.c +2 -2
@@ -2915,9 +2915,9 @@ static enum scsi_qc_status blogic_qcmd_lck(struct scsi_cmnd *command)
 	 */
 	ccb = blogic_alloc_ccb(adapter);
 	if (ccb == NULL) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
+		spin_unlock_irq(&adapter->scsi_host->host_lock);
 		blogic_delay(1);
-		spin_lock_irq(adapter->scsi_host->host_lock);
+		spin_lock_irq(&adapter->scsi_host->host_lock);
 		ccb = blogic_alloc_ccb(adapter);
 		if (ccb == NULL) {

[Severity: High]
This isn't a bug introduced by this patch, but does this code corrupt the hardware interrupt state?

The function blogic_qcmd_lck() is called under spin_lock_irqsave() via the DEF_SCSI_QCMD macro, but here it drops the lock using spin_unlock_irq() when blogic_alloc_ccb() fails. This unconditionally enables interrupts inside an irqsave context, which could lead to deadlocks or unexpected re-entrancy.

[ ... ]

drivers/scsi/BusLogic.c static enum scsi_qc_status blogic_qcmd_lck(struct scsi_cmnd *command) · line 3070

Quoted 12 lines
drivers/scsi/BusLogic.c +2 -2
@@ -3062,10 +3062,10 @@ static enum scsi_qc_status blogic_qcmd_lck(struct scsi_cmnd *command)
 		   be initiated soon.
 		 */
 		if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
-			spin_unlock_irq(adapter->scsi_host->host_lock);
+			spin_unlock_irq(&adapter->scsi_host->host_lock);
 			blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter);
 			blogic_delay(1);
-			spin_lock_irq(adapter->scsi_host->host_lock);
+			spin_lock_irq(&adapter->scsi_host->host_lock);
 			if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START,
 						ccb)) {

[Severity: High]
This is also a pre-existing issue, but similar to the above, is it safe to call spin_unlock_irq() here if blogic_write_outbox() fails? It unconditionally enables interrupts while the caller expects the context to remain protected by the original irq_flags from spin_lock_irqsave().

[ ... ]

Quoted 4 lines
drivers/scsi/ibmvscsi/ibmvfc-core.c +0 -0
index b3bc3ce872d6d..0b154e07299cc 100644

[ ... ]

drivers/scsi/ibmvscsi/ibmvfc-core.c static int ibmvfc_cancel_all_mq(struct scsi_device *sdev, int type) · line 2708

Quoted 9 lines
drivers/scsi/ibmvscsi/ibmvfc-core.c +1 -1
@@ -2702,7 +2702,7 @@ static int ibmvfc_cancel_all_mq(struct scsi_device *sdev, int type)
 			evt = ibmvfc_init_tmf(&queues[i], sdev, type);
 			if (!evt) {
 				spin_unlock(queues[i].q_lock);
-				spin_unlock_irqrestore(vhost->host->host_lock, flags);
+				spin_unlock_irqrestore(&vhost->host->host_lock, flags);
 				return -ENOMEM;
 			}
 			evt->sync_iu = &queues[i].cancel_rsp;

[Severity: High]
This isn't a bug introduced by this patch, but does this early return in ibmvfc_cancel_all_mq() leak the event pool?

If ibmvfc_init_tmf() fails to allocate an event, the function exits immediately with -ENOMEM. However, any events that were successfully sent in previous iterations of the loop and added to the local cancelq list are abandoned without being freed back to the pool.

[ ... ]

Quoted 10 lines
drivers/scsi/ibmvscsi/ibmvfc-core.c +1 -1
@@ -2776,7 +2776,7 @@ static int ibmvfc_cancel_all_sq(struct scsi_device *sdev, int type)
 	if (!found_evt) {
 		if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL)
 			sdev_printk(KERN_INFO, sdev, "No events found to cancel\n");
-		spin_unlock_irqrestore(vhost->host->host_lock, flags);
+		spin_unlock_irqrestore(&vhost->host->host_lock, flags);
 		return 0;
 	}
 

drivers/scsi/ibmvscsi/ibmvfc-core.c static int ibmvfc_cancel_all_sq(struct scsi_device *sdev, int type) · line 2789

Quoted 5 lines
drivers/scsi/ibmvscsi/ibmvfc-core.c +1 -1
@@ -2786,7 +2786,7 @@ static int ibmvfc_cancel_all_sq(struct scsi_device *sdev, int type)
 		rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout);
 	}
 
-	spin_unlock_irqrestore(vhost->host->host_lock, flags);
+	spin_unlock_irqrestore(&vhost->host->host_lock, flags);

[Severity: High]
This is a pre-existing issue, but could this result in a NULL pointer dereference?

Looking at ibmvfc_cancel_all_sq(), just before the spin_unlock_irqrestore, there is the following sequence:

    if (vhost->logged_in) {
        evt = ibmvfc_init_tmf(&vhost->crq, sdev, type);
        evt->sync_iu = &rsp;
        rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout);
    }

If ibmvfc_init_tmf() fails to allocate an event and returns NULL, evt->sync_iu = &rsp; will dereference a NULL pointer.

[ ... ]

Quoted 4 lines
drivers/scsi/scsi_transport_fc.c +0 -0
index 173ed6373f04b..be0efffab2fcc 100644

[ ... ]

drivers/scsi/scsi_transport_fc.c fc_remote_port_create(struct Scsi_Host *shost, int channel, · line 3190

Quoted 13 lines
drivers/scsi/scsi_transport_fc.c +2 -2
@@ -3181,10 +3181,10 @@ fc_remote_port_create(struct Scsi_Host *shost, int channel,
 
 delete_rport:
 	transport_destroy_device(dev);
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	list_del(&rport->peers);
 	scsi_host_put(shost);			/* for fc_host->rport list */
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 	put_device(dev->parent);
 	kfree(rport);
 	return NULL;

[Severity: High]
This isn't a bug introduced by this patch, but does this error path in fc_remote_port_create() leak core device resources?

After device_initialize(dev) is called earlier in the function, it seems the error path cleans up by calling kfree(rport) directly instead of using put_device(dev), which would properly free the device_private structure and other resources.

[ ... ]

Quoted 4 lines
drivers/scsi/scsi_transport_fc.c +0 -0
@@ -3982,11 +3982,11 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
 	device_del(dev);
 delete_vport:
 	transport_destroy_device(dev);

drivers/scsi/scsi_transport_fc.c fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev, · line 3992

Quoted 10 lines
drivers/scsi/scsi_transport_fc.c +2 -2
-	spin_lock_irqsave(shost->host_lock, flags);
+	spin_lock_irqsave(&shost->host_lock, flags);
 	list_del(&vport->peers);
 	scsi_host_put(shost);			/* for fc_host->vport list */
 	fc_host->npiv_vports_inuse--;
-	spin_unlock_irqrestore(shost->host_lock, flags);
+	spin_unlock_irqrestore(&shost->host_lock, flags);
 	put_device(dev->parent);
 	kfree(vport);
 

[Severity: High]
This is also a pre-existing issue, but does fc_vport_setup() suffer from the same device lifecycle violation?

It calls kfree(vport) directly on the error path after device_initialize(dev) has already been executed, which would also leave device resources leaked instead of properly cleaning them up with put_device(dev).

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
Quoted 1 line · On 8/31/26 3:21 AM, [email protected] wrote:

- [High] Interrupt state corruption in blogic_qcmd_lck due to mismatched spinlock APIs.

Since this is a pre-existing issue it should not block adoption of this patch. Anyway, I plan to post a patch soon that will fix this complaint.

Bart.

maintainer Applied
#3 lore raw
In reply to John Garry

John,

Quoted 3 lines

Back in the 2.6.xx days, it was possible to for low-level drivers to set the shost lock pointer. That is why there is a default lock and a pointer to the shost lock.

Applied to 7.4/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen