Skip to contentSkip to conversation

ata: libata: Remove unused parameter in function ata_sas_port_alloc()

PATCH In review chenxiang 2 participants 3 messages May 21, 2020 – May 22, 2020

Subsystems (4)
lore
Share & tools
lore

chenxiang

author
#0 lore raw

PATCH v2 1/1 ata: libata: Remove unused parameter in function ata_sas_port_alloc()

From: Xiang Chen <[email protected]>

Input Parameter shost in function ata_sas_port_alloc() is not used, so remove it.

---
 drivers/ata/libata-sata.c     | 4 +---
 drivers/scsi/ipr.c            | 2 +-
 drivers/scsi/libsas/sas_ata.c | 2 +-
 include/linux/libata.h        | 2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)
drivers/ata/libata-sata.c +1 -3
index c16423e..a3c83fe 100644
@@ -1070,7 +1070,6 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
  *	port_alloc - Allocate port for a SAS attached SATA device
  *	@host: ATA host container for all SAS ports
  *	@port_info: Information from low-level host driver
- *	@shost: SCSI host that the scsi device is attached to
  *
  *	LOCKING:
  *	PCI/etc. bus probe sem.
@@ -1080,8 +1079,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
  */
 
 struct ata_port *ata_sas_port_alloc(struct ata_host *host,
-				    struct ata_port_info *port_info,
-				    struct Scsi_Host *shost)
+				    struct ata_port_info *port_info)
 {
 	struct ata_port *ap;
 
drivers/scsi/ipr.c +1 -1
index 7d77997..331c41c 100644
@@ -4816,7 +4816,7 @@ static int ipr_target_alloc(struct scsi_target *starget)
 		if (!sata_port)
 			return -ENOMEM;
 
-		ap = ata_sas_port_alloc(&ioa_cfg->ata_host, &sata_port_info, shost);
+		ap = ata_sas_port_alloc(&ioa_cfg->ata_host, &sata_port_info);
 		if (ap) {
 			spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
 			sata_port->ioa_cfg = ioa_cfg;
drivers/scsi/libsas/sas_ata.c +1 -1
index 5d716d3..0cdfae9 100644
@@ -549,7 +549,7 @@ int sas_ata_init(struct domain_device *found_dev)
 
 	ata_host_init(ata_host, ha->dev, &sas_sata_ops);
 
-	ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost);
+	ap = ata_sas_port_alloc(ata_host, &sata_port_info);
 	if (!ap) {
 		pr_err("ata_sas_port_alloc failed.\n");
 		rc = -ENODEV;
include/linux/libata.h +1 -1
index 8bf5e59..5a6fb80 100644
@@ -1228,7 +1228,7 @@ extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
 extern int ata_slave_link_init(struct ata_port *ap);
 extern void ata_sas_port_destroy(struct ata_port *);
 extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
-					   struct ata_port_info *, struct Scsi_Host *);
+					   struct ata_port_info *);
 extern void ata_sas_async_probe(struct ata_port *ap);
 extern int ata_sas_sync_probe(struct ata_port *ap);
 extern int ata_sas_port_init(struct ata_port *);
Signature · 1 line
2.8.1
#1 lore raw
Quoted 26 lines · chenxiang

From: Xiang Chen <[email protected]>

Input Parameter shost in function ata_sas_port_alloc() is not used, so remove it.

---
  drivers/ata/libata-sata.c     | 4 +---
  drivers/scsi/ipr.c            | 2 +-
  drivers/scsi/libsas/sas_ata.c | 2 +-
  include/linux/libata.h        | 2 +-
  4 files changed, 4 insertions(+), 6 deletions(-)
drivers/ata/libata-sata.c +0 -1
index c16423e..a3c83fe 100644
@@ -1070,7 +1070,6 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
   *	port_alloc - Allocate port for a SAS attached SATA device
   *	@host: ATA host container for all SAS ports
   *	@port_info: Information from low-level host driver
- *	@shost: SCSI host that the scsi device is attached to
   *
   *	LOCKING:
   *	PCI/etc. bus probe sem.

drivers/ata/libata-sata.c EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth); · line 1084

Quoted 8 lines
drivers/ata/libata-sata.c +1 -2
@@ -1080,8 +1079,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
   */
 
  struct ata_port *ata_sas_port_alloc(struct ata_host *host,
-				    struct ata_port_info *port_info,
-				    struct Scsi_Host *shost)
+				    struct ata_port_info *port_info)
  {
  	struct ata_port *ap;

A better change could be to add the following, instead of removing the argument:

	ap->scsi_host = shost;

And remove the setting from the callsites, upon successful return. But then we would need to pass shost=NULL for ipr, as it does not seem to set ap->shost - but that may be an oversight.

Thanks,
John

Quoted 41 lines
drivers/scsi/ipr.c +1 -1
index 7d77997..331c41c 100644
@@ -4816,7 +4816,7 @@ static int ipr_target_alloc(struct scsi_target *starget)
  		if (!sata_port)
  			return -ENOMEM;
 
-		ap = ata_sas_port_alloc(&ioa_cfg->ata_host, &sata_port_info, shost);
+		ap = ata_sas_port_alloc(&ioa_cfg->ata_host, &sata_port_info);
  		if (ap) {
  			spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
  			sata_port->ioa_cfg = ioa_cfg;
drivers/scsi/libsas/sas_ata.c +1 -1
index 5d716d3..0cdfae9 100644
@@ -549,7 +549,7 @@ int sas_ata_init(struct domain_device *found_dev)
 
  	ata_host_init(ata_host, ha->dev, &sas_sata_ops);
 
-	ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost);
+	ap = ata_sas_port_alloc(ata_host, &sata_port_info);
  	if (!ap) {
  		pr_err("ata_sas_port_alloc failed.\n");
  		rc = -ENODEV;
include/linux/libata.h +1 -1
index 8bf5e59..5a6fb80 100644
@@ -1228,7 +1228,7 @@ extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
  extern int ata_slave_link_init(struct ata_port *ap);
  extern void ata_sas_port_destroy(struct ata_port *);
  extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
-					   struct ata_port_info *, struct Scsi_Host *);
+					   struct ata_port_info *);
  extern void ata_sas_async_probe(struct ata_port *ap);
  extern int ata_sas_sync_probe(struct ata_port *ap);
  extern int ata_sas_port_init(struct ata_port *);
#2 lore raw
Quoted 37 lines · John Garry
Quoted 26 lines · chenxiang

From: Xiang Chen <[email protected]>

Input Parameter shost in function ata_sas_port_alloc() is not used, so remove it.

---
  drivers/ata/libata-sata.c     | 4 +---
  drivers/scsi/ipr.c            | 2 +-
  drivers/scsi/libsas/sas_ata.c | 2 +-
  include/linux/libata.h        | 2 +-
  4 files changed, 4 insertions(+), 6 deletions(-)
drivers/ata/libata-sata.c +0 -1
index c16423e..a3c83fe 100644
@@ -1070,7 +1070,6 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
   *    port_alloc - Allocate port for a SAS attached SATA device
   *    @host: ATA host container for all SAS ports
   *    @port_info: Information from low-level host driver
- *    @shost: SCSI host that the scsi device is attached to
   *
   *    LOCKING:
   *    PCI/etc. bus probe sem.

drivers/ata/libata-sata.c EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth); · line 1083

Quoted 7 lines
drivers/ata/libata-sata.c +1 -2
@@ -1080,8 +1079,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
   */
    struct ata_port *ata_sas_port_alloc(struct ata_host *host,
-                    struct ata_port_info *port_info,
-                    struct Scsi_Host *shost)
+                    struct ata_port_info *port_info)
  {
      struct ata_port *ap;

A better change could be to add the following, instead of removing the argument:

Quoted 3 lines
    ap->scsi_host = shost;

And remove the setting from the callsites, upon successful return. But then we would need to pass shost=NULL for ipr, as it does not seem to set ap->shost - but that may be an oversight.

OK, i will update it in next version.

Quoted 48 lines

Thanks,
John

Quoted 38 lines
drivers/ata/libata-sata.c +0 -0
  diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c

index 7d77997..331c41c 100644

drivers/scsi/ipr.c +1 -0
@@ -4816,7 +4816,7 @@ static int ipr_target_alloc(struct scsi_target 
 *starget)
          if (!sata_port)
              return -ENOMEM;
  -        ap = ata_sas_port_alloc(&ioa_cfg->ata_host, 
 &sata_port_info, shost);
+        ap = ata_sas_port_alloc(&ioa_cfg->ata_host, &sata_port_info);
          if (ap) {
              spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
              sata_port->ioa_cfg = ioa_cfg;
drivers/scsi/libsas/sas_ata.c +1 -0
index 5d716d3..0cdfae9 100644
@@ -549,7 +549,7 @@ int sas_ata_init(struct domain_device *found_dev)
        ata_host_init(ata_host, ha->dev, &sas_sata_ops);
  -    ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost);
+    ap = ata_sas_port_alloc(ata_host, &sata_port_info);
      if (!ap) {
          pr_err("ata_sas_port_alloc failed.\n");
          rc = -ENODEV;
include/linux/libata.h +1 -1
index 8bf5e59..5a6fb80 100644
@@ -1228,7 +1228,7 @@ extern int sata_link_scr_lpm(struct ata_link 
 *link, enum ata_lpm_policy policy,
  extern int ata_slave_link_init(struct ata_port *ap);
  extern void ata_sas_port_destroy(struct ata_port *);
  extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
-                       struct ata_port_info *, struct Scsi_Host *);
+                       struct ata_port_info *);
  extern void ata_sas_async_probe(struct ata_port *ap);
  extern int ata_sas_sync_probe(struct ata_port *ap);
Quoted 2 lines
  extern int ata_sas_port_init(struct ata_port *);

.