Skip to contentSkip to conversation

aic7xxx: Remove ahd_acquire_seeprom and ahd_release_seeprom due to redundant implementation

PATCH New Rand Deeb 1 participant 1 message Dec 19, 2023

Subsystems (2)
lore
Share & tools
lore

Rand Deeb

author
#0 lore raw

PATCH 1/1 aic7xxx: Remove ahd_acquire_seeprom and ahd_release_seeprom due to redundant implementation

We removed the ahd_acquire_seeprom and ahd_release_seeprom functions because both lacked meaningful implementations. The SEEPROM acquisition and release logic they provided were unused and had been commented out, making them redundant and non-functional. In addition to some style fixes.
This change simplifies the codebase and improves code clarity by eliminating unnecessary code.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/scsi/aic7xxx/aic79xx.h      |  2 -
 drivers/scsi/aic7xxx/aic79xx_core.c | 29 ----------
 drivers/scsi/aic7xxx/aic79xx_pci.c  | 89 ++++++++++++++---------------
 drivers/scsi/aic7xxx/aic79xx_proc.c | 36 +++++-------
 4 files changed, 56 insertions(+), 100 deletions(-)
drivers/scsi/aic7xxx/aic79xx.h +0 -2
index 9a515551641c..e8a7b16a6861 100644
@@ -962,8 +962,6 @@ int		ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,
 int		ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
 				  u_int start_addr, u_int count);
 int		ahd_verify_cksum(struct seeprom_config *sc);
-int		ahd_acquire_seeprom(struct ahd_softc *ahd);
-void		ahd_release_seeprom(struct ahd_softc *ahd);
 
 /****************************  Message Buffer *********************************/
 typedef enum {
drivers/scsi/aic7xxx/aic79xx_core.c +0 -29
index 4c790fe28f73..7d639b98e9aa 100644
@@ -10089,35 +10089,6 @@ ahd_verify_cksum(struct seeprom_config *sc)
 	}
 }
 
-int
-ahd_acquire_seeprom(struct ahd_softc *ahd)
-{
-	/*
-	 * We should be able to determine the SEEPROM type
-	 * from the flexport logic, but unfortunately not
-	 * all implementations have this logic and there is
-	 * no programatic method for determining if the logic
-	 * is present.
-	 */
-	return (1);
-#if 0
-	uint8_t	seetype;
-	int	error;
-
-	error = ahd_read_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, &seetype);
-	if (error != 0
-         || ((seetype & FLX_ROMSTAT_SEECFG) == FLX_ROMSTAT_SEE_NONE))
-		return (0);
-	return (1);
-#endif
-}
-
-void
-ahd_release_seeprom(struct ahd_softc *ahd)
-{
-	/* Currently a no-op */
-}
-
 /*
  * Wait at most 2 seconds for flexport arbitration to succeed.
  */
drivers/scsi/aic7xxx/aic79xx_pci.c +42 -47

102 lines not on this page · raw message

drivers/scsi/aic7xxx/aic79xx_proc.c +14 -22
index add2da581d66..8a4a1c5601d1 100644
@@ -213,6 +213,7 @@ ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)
 	u_long s;
 	int paused;
 	int written;
+	u_int start_addr;
 
 	/* Default to failure. */
 	written = -EINVAL;
@@ -234,31 +235,22 @@ ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)
 		goto done;
 	}
 
-	have_seeprom = ahd_acquire_seeprom(ahd);
-	if (!have_seeprom) {
-		printk("ahd_proc_write_seeprom: No Serial EEPROM\n");
-		goto done;
-	} else {
-		u_int start_addr;
-
+	if (ahd->seep_config == NULL) {
+		ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC);
 		if (ahd->seep_config == NULL) {
-			ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC);
-			if (ahd->seep_config == NULL) {
-				printk("aic79xx: Unable to allocate serial "
-				       "eeprom buffer.  Write failing\n");
-				goto done;
-			}
+			printk("aic79xx: Unable to allocate serial "
+			       "eeprom buffer.  Write failing\n");
+			goto done;
 		}
-		printk("aic79xx: Writing Serial EEPROM\n");
-		start_addr = 32 * (ahd->channel - 'A');
-		ahd_write_seeprom(ahd, (u_int16_t *)buffer, start_addr,
-				  sizeof(struct seeprom_config)/2);
-		ahd_read_seeprom(ahd, (uint16_t *)ahd->seep_config,
-				 start_addr, sizeof(struct seeprom_config)/2,
-				 /*ByteStream*/FALSE);
-		ahd_release_seeprom(ahd);
-		written = length;
 	}
+	printk("aic79xx: Writing Serial EEPROM\n");
+	start_addr = 32 * (ahd->channel - 'A');
+	ahd_write_seeprom(ahd, (u_int16_t *)buffer, start_addr,
+			  sizeof(struct seeprom_config)/2);
+	ahd_read_seeprom(ahd, (uint16_t *)ahd->seep_config,
+			 start_addr, sizeof(struct seeprom_config)/2,
+			 /*ByteStream*/FALSE);
+	written = length;
 
 done:
 	ahd_restore_modes(ahd, saved_modes);
Signature · 1 line
2.34.1