mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
scsi: core: constants: Rename internal struct field names
To make the code more clear, rename the code12 field of struct error_info to the more natural name "code" and the fields code1, code2_min and code2_max of struct error_info2 to the more explicit asc, ascq_min and ascq_max. No functional change intended. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Hannes Reinecke <hare@kernel.org> Link: https://patch.msgid.link/20260908090308.1085097-4-dlemoal@kernel.org Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
parent
84517868c1
commit
c5c4382c2a
|
|
@ -292,7 +292,7 @@ bool scsi_opcode_sa_name(int opcode, int service_action,
|
|||
}
|
||||
|
||||
struct error_info {
|
||||
unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */
|
||||
unsigned short code; /* 0x0302 looks better than 0x03,0x02 */
|
||||
unsigned short size;
|
||||
};
|
||||
|
||||
|
|
@ -318,9 +318,11 @@ static const char *additional_text =
|
|||
;
|
||||
|
||||
struct error_info2 {
|
||||
unsigned char code1, code2_min, code2_max;
|
||||
const char * str;
|
||||
const char * fmt;
|
||||
u8 asc;
|
||||
u8 ascq_min;
|
||||
u8 ascq_max;
|
||||
const char *str;
|
||||
const char *fmt;
|
||||
};
|
||||
|
||||
static const struct error_info2 additional2[] =
|
||||
|
|
@ -377,20 +379,20 @@ EXPORT_SYMBOL(scsi_sense_key_string);
|
|||
const char *
|
||||
scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
|
||||
{
|
||||
int i;
|
||||
unsigned short code = ((asc << 8) | ascq);
|
||||
u16 code = scsi_sense_code(asc, ascq);
|
||||
unsigned offset = 0;
|
||||
int i;
|
||||
|
||||
*fmt = NULL;
|
||||
for (i = 0; i < ARRAY_SIZE(additional); i++) {
|
||||
if (additional[i].code12 == code)
|
||||
if (additional[i].code == code)
|
||||
return additional_text + offset;
|
||||
offset += additional[i].size;
|
||||
}
|
||||
for (i = 0; additional2[i].fmt; i++) {
|
||||
if (additional2[i].code1 == asc &&
|
||||
ascq >= additional2[i].code2_min &&
|
||||
ascq <= additional2[i].code2_max) {
|
||||
if (additional2[i].asc == asc &&
|
||||
ascq >= additional2[i].ascq_min &&
|
||||
ascq <= additional2[i].ascq_max) {
|
||||
*fmt = additional2[i].fmt;
|
||||
return additional2[i].str;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user