Skip to contentSkip to conversation

Minor cleanups

PATCH Superseded Damien Le Moal 2 participants 6 messages Sep 12, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Minor cleanups

3 patches to cleanup libsas functions declarations. No functional changes.

Changes from v1:
* Added sas_init_dev() declaration change to patch 1
* Added John's review tag

Damien Le Moal (3):
scsi: libsas: Move local functions declarations to sas_internal.h
scsi: libsas: Declare sas_set_phy_speed() static
scsi: libsas: Declare sas_discover_end_dev() static

 drivers/scsi/libsas/sas_discover.c |  2 +-
 drivers/scsi/libsas/sas_init.c     |  4 ++--
 drivers/scsi/libsas/sas_internal.h | 12 ++++++++++++
 include/scsi/libsas.h              | 17 -----------------
 4 files changed, 15 insertions(+), 20 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH v2 1/3 scsi: libsas: Move local functions declarations to sas_internal.h

Move the declarations of functions used only within libsas from include/scsi/libsas.h to drivers/scsi/libsas/sas_internal.h

---
 drivers/scsi/libsas/sas_internal.h | 12 ++++++++++++
 include/scsi/libsas.h              | 14 --------------
 2 files changed, 12 insertions(+), 14 deletions(-)
drivers/scsi/libsas/sas_internal.h +12 -0
index a6dc7dc07fce..cfc921e2765c 100644
@@ -39,6 +39,18 @@ struct sas_phy_data {
 	struct sas_work enable_work;
 };
 
+void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
+
+int sas_discover_root_expander(struct domain_device *dev);
+
+int sas_ex_revalidate_domain(struct domain_device *dev);
+void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
+void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port);
+void sas_discover_event(struct asd_sas_port *, enum discover_event ev);
+
+void sas_init_dev(struct domain_device *dev);
+void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev);
+
 void sas_scsi_recover_host(struct Scsi_Host *shost);
 
 int  sas_register_phys(struct sas_ha_struct *sas_ha);
include/scsi/libsas.h +0 -14
index 8a43534eea5c..2e800690b127 100644
@@ -404,8 +404,6 @@ cmd_to_domain_dev(struct scsi_cmnd *cmd)
 	return sdev_to_domain_dev(cmd->device);
 }
 
-void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
-
 /* Before calling a notify event, LLDD should use this function
  * when the link is severed (possibly from its tasklet).
  * The idea is that the Class only reads those, while the LLDD,
@@ -699,20 +697,8 @@ extern struct scsi_transport_template *
 sas_domain_attach_transport(struct sas_domain_function_template *);
 extern struct device_attribute dev_attr_phy_event_threshold;
 
-int  sas_discover_root_expander(struct domain_device *);
-
-int  sas_ex_revalidate_domain(struct domain_device *);
-
-void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
-void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
-void sas_discover_event(struct asd_sas_port *, enum discover_event ev);
-
 int  sas_discover_end_dev(struct domain_device *);
 
-void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
-
-void sas_init_dev(struct domain_device *);
-
 void sas_task_abort(struct sas_task *);
 int sas_eh_abort_handler(struct scsi_cmnd *cmd);
 int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
Signature · 1 line
2.41.0
#2 lore raw

PATCH v2 2/3 scsi: libsas: Declare sas_set_phy_speed() static

In reply to Damien Le Moal

sas_set_phy_speed() is used only within sas_init.c. Declare this function as static.

---
 drivers/scsi/libsas/sas_init.c | 4 ++--
 include/scsi/libsas.h          | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/libsas/sas_init.c +2 -2
index 8586dc79f2a0..9c8cc723170d 100644
@@ -315,8 +315,8 @@ int sas_phy_reset(struct sas_phy *phy, int hard_reset)
 }
 EXPORT_SYMBOL_GPL(sas_phy_reset);
 
-int sas_set_phy_speed(struct sas_phy *phy,
-		      struct sas_phy_linkrates *rates)
+static int sas_set_phy_speed(struct sas_phy *phy,
+			     struct sas_phy_linkrates *rates)
 {
 	int ret;
 
include/scsi/libsas.h +0 -1
index 2e800690b127..d3ace28ee41f 100644
@@ -679,7 +679,6 @@ extern void sas_resume_ha(struct sas_ha_struct *sas_ha);
 extern void sas_resume_ha_no_sync(struct sas_ha_struct *sas_ha);
 extern void sas_suspend_ha(struct sas_ha_struct *sas_ha);
 
-int sas_set_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates);
 int sas_phy_reset(struct sas_phy *phy, int hard_reset);
 int sas_phy_enable(struct sas_phy *phy, int enable);
 extern int sas_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
Signature · 1 line
2.41.0
#3 lore raw

PATCH v2 3/3 scsi: libsas: Declare sas_discover_end_dev() static

In reply to Damien Le Moal

sas_discover_end_dev() is defined and used used only in sas_discover.c. Define this function as static.

---
 drivers/scsi/libsas/sas_discover.c | 2 +-
 include/scsi/libsas.h              | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/libsas/sas_discover.c +1 -1
index ff7b63b10aeb..8fb7c41c0962 100644
@@ -275,7 +275,7 @@ static void sas_resume_devices(struct work_struct *work)
  *
  * See comment in sas_discover_sata().
  */
-int sas_discover_end_dev(struct domain_device *dev)
+static int sas_discover_end_dev(struct domain_device *dev)
 {
 	return sas_notify_lldd_dev_found(dev);
 }
include/scsi/libsas.h +0 -2
index d3ace28ee41f..f5257103fdb6 100644
@@ -696,8 +696,6 @@ extern struct scsi_transport_template *
 sas_domain_attach_transport(struct sas_domain_function_template *);
 extern struct device_attribute dev_attr_phy_event_threshold;
 
-int  sas_discover_end_dev(struct domain_device *);
-
 void sas_task_abort(struct sas_task *);
 int sas_eh_abort_handler(struct scsi_cmnd *cmd);
 int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
Signature · 1 line
2.41.0
Reviewed-by on the v2 series
#4 lore raw
In reply to Damien Le Moal
Quoted 12 lines · Damien Le Moal

3 patches to cleanup libsas functions declarations. No functional changes.

Changes from v1:
* Added sas_init_dev() declaration change to patch 1
* Added John's review tag

Damien Le Moal (3):
scsi: libsas: Move local functions declarations to sas_internal.h
scsi: libsas: Declare sas_set_phy_speed() static
scsi: libsas: Declare sas_discover_end_dev() static

Quoted 6 lines
  drivers/scsi/libsas/sas_discover.c |  2 +-
  drivers/scsi/libsas/sas_init.c     |  4 ++--
  drivers/scsi/libsas/sas_internal.h | 12 ++++++++++++
  include/scsi/libsas.h              | 17 -----------------
  4 files changed, 15 insertions(+), 20 deletions(-)

When applying the patches checkpatch.pl spits out this warning:

Applying: scsi: libsas: Move local functions declarations to sas_internal.h WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct asd_sas_port *' should also have an identifier name
#16: FILE: drivers/scsi/libsas/sas_internal.h:49:
+void sas_discover_event(struct asd_sas_port *, enum discover_event ev);

total: 0 errors, 1 warnings, 46 lines checked

Other than the above nit:

#5 lore raw
Quoted 28 lines · Johannes Thumshirn
Quoted 12 lines · Damien Le Moal

3 patches to cleanup libsas functions declarations. No functional changes.

Changes from v1:
* Added sas_init_dev() declaration change to patch 1
* Added John's review tag

Damien Le Moal (3):
scsi: libsas: Move local functions declarations to sas_internal.h
scsi: libsas: Declare sas_set_phy_speed() static
scsi: libsas: Declare sas_discover_end_dev() static

Quoted 6 lines
  drivers/scsi/libsas/sas_discover.c |  2 +-
  drivers/scsi/libsas/sas_init.c     |  4 ++--
  drivers/scsi/libsas/sas_internal.h | 12 ++++++++++++
  include/scsi/libsas.h              | 17 -----------------
  4 files changed, 15 insertions(+), 20 deletions(-)

When applying the patches checkpatch.pl spits out this warning:

Applying: scsi: libsas: Move local functions declarations to sas_internal.h WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct asd_sas_port *' should also have an identifier name
#16: FILE: drivers/scsi/libsas/sas_internal.h:49:
+void sas_discover_event(struct asd_sas_port *, enum discover_event ev);

Quoted 4 lines

total: 0 errors, 1 warnings, 46 lines checked

Other than the above nit:

Thanks. Sent v3 to fix that, and also a repeated word in the commit message of patch 3 that checkpatch complains about.

Signature · 2 lines
Damien Le Moal
Western Digital Research