Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: esp_scsi: Correct ordering of PCSCSI definition in esp_rev enum

The order of the definitions in the esp_rev enum is important. The values
are used in comparisons for chip features.

Add a comment to the enum explaining this.

Also, the actual values for the enum fields are irrelevant, so remove the
explicit values (suggested by Geert Uytterhoeven). This makes adding a new
field in the middle of the enum easier.

Finally, move the PCSCSI definition to the right place in the enum. In its
previous location, at the end of the enum, the wrong values are written to
the CONFIG3 register when used with FAST-SCSI targets.

Link: https://lore.kernel.org/r/20191119202021.28720-2-jongk@linux-m68k.org
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Kars de Jong and committed by
Martin K. Petersen
2086faae d1eef1c6

+10 -9
+1 -1
drivers/scsi/esp_scsi.c
··· 2373 2373 "ESP100A", 2374 2374 "ESP236", 2375 2375 "FAS236", 2376 + "AM53C974", 2376 2377 "FAS100A", 2377 2378 "FAST", 2378 2379 "FASHME", 2379 - "AM53C974", 2380 2380 }; 2381 2381 2382 2382 static struct scsi_transport_template *esp_transport_template;
+9 -8
drivers/scsi/esp_scsi.h
··· 257 257 }; 258 258 #define ESP_CMD_PRIV(CMD) ((struct esp_cmd_priv *)(&(CMD)->SCp)) 259 259 260 + /* NOTE: this enum is ordered based on chip features! */ 260 261 enum esp_rev { 261 - ESP100 = 0x00, /* NCR53C90 - very broken */ 262 - ESP100A = 0x01, /* NCR53C90A */ 263 - ESP236 = 0x02, 264 - FAS236 = 0x03, 265 - FAS100A = 0x04, 266 - FAST = 0x05, 267 - FASHME = 0x06, 268 - PCSCSI = 0x07, /* AM53c974 */ 262 + ESP100, /* NCR53C90 - very broken */ 263 + ESP100A, /* NCR53C90A */ 264 + ESP236, 265 + FAS236, 266 + PCSCSI, /* AM53c974 */ 267 + FAS100A, 268 + FAST, 269 + FASHME, 269 270 }; 270 271 271 272 struct esp_cmd_entry {