Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Sep 2017 18:39:55 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323370 - in head/sys/dev: mpr mps
Message-ID:  <201709091839.v89Idtcv058308@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottl
Date: Sat Sep  9 18:39:55 2017
New Revision: 323370
URL: https://svnweb.freebsd.org/changeset/base/323370

Log:
  Remove the unnecessary use of a temporary string buffer.
  
  Sponsored by:	Netflix

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mpr/mpr_sas.c
==============================================================================
--- head/sys/dev/mpr/mpr_sas.c	Sat Sep  9 18:03:40 2017	(r323369)
+++ head/sys/dev/mpr/mpr_sas.c	Sat Sep  9 18:39:55 2017	(r323370)
@@ -2257,7 +2257,7 @@ mpr_sc_failed_io_info(struct mpr_softc *sc, struct ccb
 	u8 scsi_status = mpi_reply->SCSIStatus;
 	char *desc_ioc_state = NULL;
 	char *desc_scsi_status = NULL;
-	char *desc_scsi_state = sc->tmp_string;
+	char *desc_scsi_state = NULL;
 	u32 log_info = le32toh(mpi_reply->IOCLogInfo);
 	
 	if (log_info == 0x31170000)
@@ -2362,19 +2362,19 @@ mpr_sc_failed_io_info(struct mpr_softc *sc, struct ccb
 		break;
 	}
 
-	desc_scsi_state[0] = '\0';
+	desc_scsi_state = "\0";
 	if (!scsi_state)
 		desc_scsi_state = " ";
 	if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID)
-		strcat(desc_scsi_state, "response info ");
+		desc_scsi_state = "response info ";
 	if (scsi_state & MPI2_SCSI_STATE_TERMINATED)
-		strcat(desc_scsi_state, "state terminated ");
+		desc_scsi_state = "state terminated ";
 	if (scsi_state & MPI2_SCSI_STATE_NO_SCSI_STATUS)
-		strcat(desc_scsi_state, "no status ");
+		desc_scsi_state = "no status ";
 	if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_FAILED)
-		strcat(desc_scsi_state, "autosense failed ");
+		desc_scsi_state = "autosense failed ";
 	if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)
-		strcat(desc_scsi_state, "autosense valid ");
+		desc_scsi_state = "autosense valid ";
 
 	mpr_dprint(sc, MPR_XINFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x)\n",
 	    le16toh(mpi_reply->DevHandle), desc_ioc_state, ioc_status);
@@ -2960,8 +2960,8 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp
 		 */
 		mprsas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
 		mpr_dprint(sc, MPR_INFO,
-		    "Controller reported %s status for target %u SMID %u, "
-		    "loginfo %x\n", ((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
+		    "Controller reported %s target %u SMID %u, loginfo %x\n",
+		    ((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
 		    MPI2_IOCSTATUS_SCSI_IOC_TERMINATED) ? "IOC_TERMINATED" :
 		    "EXT_TERMINATED", target_id, cm->cm_desc.Default.SMID,
 		    le32toh(rep->IOCLogInfo));

Modified: head/sys/dev/mpr/mprvar.h
==============================================================================
--- head/sys/dev/mpr/mprvar.h	Sat Sep  9 18:03:40 2017	(r323369)
+++ head/sys/dev/mpr/mprvar.h	Sat Sep  9 18:39:55 2017	(r323370)
@@ -74,7 +74,6 @@
 #define	IFAULT_IOP_OVER_TEMP_THRESHOLD_EXCEEDED	0x2810
 
 #define MPR_SCSI_RI_INVALID_FRAME	(0x00000002)
-#define MPR_STRING_LENGTH               64
 
 #define DEFAULT_SPINUP_WAIT	3	/* seconds to wait for spinup */
 
@@ -330,7 +329,6 @@ struct mpr_softc {
 	struct mpr_queue		*queues;
 
 	struct mprsas_softc		*sassc;
-	char            tmp_string[MPR_STRING_LENGTH];
 	TAILQ_HEAD(, mpr_command)	req_list;
 	TAILQ_HEAD(, mpr_command)	high_priority_req_list;
 	TAILQ_HEAD(, mpr_chain)		chain_list;

Modified: head/sys/dev/mps/mps_sas.c
==============================================================================
--- head/sys/dev/mps/mps_sas.c	Sat Sep  9 18:03:40 2017	(r323369)
+++ head/sys/dev/mps/mps_sas.c	Sat Sep  9 18:39:55 2017	(r323370)
@@ -1987,7 +1987,7 @@ mps_sc_failed_io_info(struct mps_softc *sc, struct ccb
 	u8 scsi_status = mpi_reply->SCSIStatus;
 	char *desc_ioc_state = NULL;
 	char *desc_scsi_status = NULL;
-	char *desc_scsi_state = sc->tmp_string;
+	char *desc_scsi_state = NULL;
 	u32 log_info = le32toh(mpi_reply->IOCLogInfo);
 	
 	if (log_info == 0x31170000)
@@ -2089,19 +2089,19 @@ mps_sc_failed_io_info(struct mps_softc *sc, struct ccb
 		break;
 	}
 
-	desc_scsi_state[0] = '\0';
+	desc_scsi_state = "\0";
 	if (!scsi_state)
 		desc_scsi_state = " ";
 	if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID)
-		strcat(desc_scsi_state, "response info ");
+		desc_scsi_state = "response info ";
 	if (scsi_state & MPI2_SCSI_STATE_TERMINATED)
-		strcat(desc_scsi_state, "state terminated ");
+		desc_scsi_state = "state terminated ";
 	if (scsi_state & MPI2_SCSI_STATE_NO_SCSI_STATUS)
-		strcat(desc_scsi_state, "no status ");
+		desc_scsi_state = "no status ";
 	if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_FAILED)
-		strcat(desc_scsi_state, "autosense failed ");
+		desc_scsi_state = "autosense failed ";
 	if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)
-		strcat(desc_scsi_state, "autosense valid ");
+		desc_scsi_state = "autosense valid ";
 
 	mps_dprint(sc, MPS_XINFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x)\n",
 	    le16toh(mpi_reply->DevHandle), desc_ioc_state, ioc_status);
@@ -2490,8 +2490,8 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp
 		 */
 		mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
 		mps_dprint(sc, MPS_INFO,
-		    "Controller reported %s status for target %u SMID %u, "
-		    "loginfo %x\n", ((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
+		    "Controller reported %s target %u SMID %u, loginfo %x\n",
+		    ((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
 		    MPI2_IOCSTATUS_SCSI_IOC_TERMINATED) ? "IOC_TERMINATED" :
 		    "EXT_TERMINATED", target_id, cm->cm_desc.Default.SMID,
 		    le32toh(rep->IOCLogInfo));

Modified: head/sys/dev/mps/mpsvar.h
==============================================================================
--- head/sys/dev/mps/mpsvar.h	Sat Sep  9 18:03:40 2017	(r323369)
+++ head/sys/dev/mps/mpsvar.h	Sat Sep  9 18:39:55 2017	(r323370)
@@ -56,7 +56,6 @@
 #define MPS_MISSING_CHECK_DELAY	10	/* 10 seconds between missing check */
 
 #define MPS_SCSI_RI_INVALID_FRAME	(0x00000002)
-#define MPS_STRING_LENGTH               64
 
 #define DEFAULT_SPINUP_WAIT	3	/* seconds to wait for spinup */
 
@@ -317,7 +316,6 @@ struct mps_softc {
 	struct mps_queue		*queues;
 
 	struct mpssas_softc		*sassc;
-	char            tmp_string[MPS_STRING_LENGTH];
 	TAILQ_HEAD(, mps_command)	req_list;
 	TAILQ_HEAD(, mps_command)	high_priority_req_list;
 	TAILQ_HEAD(, mps_chain)		chain_list;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709091839.v89Idtcv058308>