public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Seo <james@equiv.tech>
To: Sathya Prakash <sathya.prakash@broadcom.com>,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Suganath Prabu Subramani  <suganath-prabu.subramani@broadcom.com>
Cc: James Seo <james@equiv.tech>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Kees Cook <keescook@chromium.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 08/12] scsi: mpt3sas: Remove the iounit_pg8 member of the per-adapter struct
Date: Sun,  6 Aug 2023 10:06:00 -0700	[thread overview]
Message-ID: <20230806170604.16143-9-james@equiv.tech> (raw)
In-Reply-To: <20230806170604.16143-1-james@equiv.tech>

The per-adapter struct (struct MPT3SAS_ADAPTER) contains a
MPI2_CONFIG_PAGE_IO_UNIT_8 (Mpi2IOUnitPage8_t) iounit_pg8 member that
is populated by mpt3sas_base.c:_base_static_config_pages().

As the name of that function indicates, the iounit_pg8 member
represents a static configuration page data structure that rarely
changes, and is among several such static config pages that are
currently being fetched once per adapter per init (or reset) and
copied to the per-adapter struct for later use.

However, unlike the other static config pages, the iounit_pg8 member
is never actually used outside of _base_static_config_pages(). Also,
Mpi2IOUnitPage8_t has a flexible array member, making its presence in
the _middle_ of the per-adapter struct rather strange.

Remove this member from the per-adapter struct and fix up the portion
of _base_static_config_pages() that uses it.

Signed-off-by: James Seo <james@equiv.tech>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 7 ++++---
 drivers/scsi/mpt3sas/mpt3sas_base.h | 2 --
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 2ae0185938f3..f76a546d949f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -5570,6 +5570,7 @@ mpt3sas_atto_init(struct MPT3SAS_ADAPTER *ioc)
 static int
 _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)
 {
+	Mpi2IOUnitPage8_t iounit_pg8;
 	Mpi2ConfigReply_t mpi_reply;
 	u32 iounit_pg1_flags;
 	int tg_flags = 0;
@@ -5666,7 +5667,7 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)
 	rc = mpt3sas_config_get_iounit_pg1(ioc, &mpi_reply, &ioc->iounit_pg1);
 	if (rc)
 		return rc;
-	rc = mpt3sas_config_get_iounit_pg8(ioc, &mpi_reply, &ioc->iounit_pg8);
+	rc = mpt3sas_config_get_iounit_pg8(ioc, &mpi_reply, &iounit_pg8);
 	if (rc)
 		return rc;
 	_base_display_ioc_capabilities(ioc);
@@ -5688,8 +5689,8 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)
 	if (rc)
 		return rc;
 
-	if (ioc->iounit_pg8.NumSensors)
-		ioc->temp_sensors_count = ioc->iounit_pg8.NumSensors;
+	if (iounit_pg8.NumSensors)
+		ioc->temp_sensors_count = iounit_pg8.NumSensors;
 	if (ioc->is_aero_ioc) {
 		rc = _base_update_ioc_page1_inlinewith_perf_mode(ioc);
 		if (rc)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 05364aa15ecd..879f0dcb530e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1237,7 +1237,6 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
  * @ioc_pg8: static ioc page 8
  * @iounit_pg0: static iounit page 0
  * @iounit_pg1: static iounit page 1
- * @iounit_pg8: static iounit page 8
  * @sas_hba: sas host object
  * @sas_expander_list: expander object list
  * @enclosure_list: enclosure object list
@@ -1465,7 +1464,6 @@ struct MPT3SAS_ADAPTER {
 	Mpi2IOCPage8_t ioc_pg8;
 	Mpi2IOUnitPage0_t iounit_pg0;
 	Mpi2IOUnitPage1_t iounit_pg1;
-	Mpi2IOUnitPage8_t iounit_pg8;
 	Mpi2IOCPage1_t	ioc_pg1_copy;
 
 	struct _boot_device req_boot_device;
-- 
2.39.2


  parent reply	other threads:[~2023-08-06 17:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-06 17:05 [PATCH v2 00/12] scsi: mpt3sas: Use flexible arrays and do a few cleanups James Seo
2023-08-06 17:05 ` [PATCH v2 01/12] scsi: mpt3sas: Use flexible arrays when obviously possible James Seo
2023-08-06 17:05 ` [PATCH v2 02/12] scsi: mpt3sas: Make MPI2_CONFIG_PAGE_IO_UNIT_8::Sensor[] a flexible array James Seo
2023-08-25 20:37   ` Kees Cook
2023-08-27  7:05     ` James Seo
2023-08-06 17:05 ` [PATCH v2 03/12] scsi: mpt3sas: Make MPI2_CONFIG_PAGE_RAID_VOL_0::PhysDisk[] " James Seo
2023-08-25 21:03   ` Kees Cook
2023-08-27  7:06     ` James Seo
2023-08-06 17:05 ` [PATCH v2 04/12] scsi: mpt3sas: Make MPI2_CONFIG_PAGE_SASIOUNIT_0::PhyData[] " James Seo
2023-08-06 17:05 ` [PATCH v2 05/12] scsi: mpt3sas: Make MPI2_CONFIG_PAGE_SASIOUNIT_1::PhyData[] " James Seo
2023-08-06 17:05 ` [PATCH v2 06/12] scsi: mpt3sas: Make MPI26_CONFIG_PAGE_PIOUNIT_1::PhyData[] " James Seo
2023-08-06 17:05 ` [PATCH v2 07/12] scsi: mpt3sas: Use struct_size() for struct size calculations James Seo
2023-08-06 17:06 ` James Seo [this message]
2023-08-06 17:06 ` [PATCH v2 09/12] scsi: mpt3sas: Fix an outdated comment James Seo
2023-08-06 17:06 ` [PATCH v2 10/12] scsi: mpt3sas: Fix typo of "TRIGGER" James Seo
2023-08-06 17:06 ` [PATCH v2 11/12] scsi: mpt3sas: Replace a dynamic allocation with a local variable James Seo
2023-08-06 17:06 ` [PATCH v2 12/12] scsi: mpt3sas: Replace dynamic allocations with local variables James Seo
2023-08-25  3:00 ` [PATCH v2 00/12] scsi: mpt3sas: Use flexible arrays and do a few cleanups Martin K. Petersen
2023-10-11  0:49   ` Kees Cook
2023-10-28 19:32     ` James Seo
2023-10-23 16:30 ` Kees Cook
2023-10-25  2:05   ` Martin K. Petersen
2023-10-25 22:33     ` Kees Cook
2023-11-15 13:54       ` Martin K. Petersen
2023-11-15 14:38         ` Kees Cook
2023-11-25  2:54 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230806170604.16143-9-james@equiv.tech \
    --to=james@equiv.tech \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=gustavoars@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox