On 3/1/22 21:35, Martin K. Petersen wrote:
+static unsigned int sd_sbc_version(struct scsi_device *sdp) +{ + unsigned int i; + unsigned int max; + + if (sdp->inquiry_len < INQUIRY_DESC_START + INQUIRY_DESC_SIZE) + return 0; + + max = min_t(unsigned int, sdp->inquiry_len, INQUIRY_DESC_END); + max = rounddown(max, INQUIRY_DESC_SIZE); + + for (i = INQUIRY_DESC_START ; i < max ; i += INQUIRY_DESC_SIZE) { + u16 desc = get_unaligned_be16(&sdp->inquiry[i]); + + switch (desc) { + case 0x0600: + return 4; + case 0x04c0: case 0x04c3: case 0x04c5: case 0x04c8: + return 3; + case 0x0320: case 0x0322: case 0x0324: case 0x033B: + case 0x033D: case 0x033E: + return 2; + case 0x0180: case 0x019b: case 0x019c: + return 1; + } + }
Please add a comment that explains where these constants come from (the SPC Version descriptor values table?). Anyway:
Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>