summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-21 15:38:28 +0000
committerpfg <pfg@FreeBSD.org>2016-04-21 15:38:28 +0000
commitfc65edc1cd05de15ef17e14dc54c2bf6c41ccab8 (patch)
tree45622d9ce5a6c394316a37f672cfd0a033c48374 /sys/cam
parentfdf39652a42767663d4a74a1a367d193185c51e9 (diff)
downloadFreeBSD-src-fc65edc1cd05de15ef17e14dc54c2bf6c41ccab8.zip
FreeBSD-src-fc65edc1cd05de15ef17e14dc54c2bf6c41ccab8.tar.gz
Remove slightly used const values that can be replaced with nitems().
Suggested by: jhb
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/ata/ata_xpt.c7
-rw-r--r--sys/cam/cam.c5
-rw-r--r--sys/cam/scsi/scsi_all.c7
3 files changed, 5 insertions, 14 deletions
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index 3429bb29a6..3dab055 100644
--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -160,9 +160,6 @@ static struct ata_quirk_entry ata_quirk_table[] =
},
};
-static const int ata_quirk_table_size =
- sizeof(ata_quirk_table) / sizeof(*ata_quirk_table);
-
static cam_status proberegister(struct cam_periph *periph,
void *arg);
static void probeschedule(struct cam_periph *probe_periph);
@@ -1284,7 +1281,7 @@ ata_find_quirk(struct cam_ed *device)
match = cam_quirkmatch((caddr_t)&device->ident_data,
(caddr_t)ata_quirk_table,
- ata_quirk_table_size,
+ nitems(ata_quirk_table),
sizeof(*ata_quirk_table), ata_identify_match);
if (match == NULL)
@@ -1579,7 +1576,7 @@ ata_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
* Take the default quirk entry until we have inquiry
* data and can determine a better quirk to use.
*/
- quirk = &ata_quirk_table[ata_quirk_table_size - 1];
+ quirk = &ata_quirk_table[nitems(ata_quirk_table) - 1];
device->quirk = (void *)quirk;
device->mintags = 0;
device->maxtags = 0;
diff --git a/sys/cam/cam.c b/sys/cam/cam.c
index 5061dd6..7105a41 100644
--- a/sys/cam/cam.c
+++ b/sys/cam/cam.c
@@ -105,9 +105,6 @@ const struct cam_status_entry cam_status_table[] = {
{ CAM_SCSI_BUSY, "SCSI Bus Busy" },
};
-const int num_cam_status_entries =
- sizeof(cam_status_table)/sizeof(*cam_status_table);
-
#ifdef _KERNEL
SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem");
@@ -256,7 +253,7 @@ cam_fetch_status_entry(cam_status status)
{
status &= CAM_STATUS_MASK;
return (bsearch(&status, &cam_status_table,
- num_cam_status_entries,
+ nitems(cam_status_table),
sizeof(*cam_status_table),
camstatusentrycomp));
}
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 12be402..40b6db5 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -737,9 +737,6 @@ const struct sense_key_table_entry sense_key_table[] =
{ SSD_KEY_COMPLETED, SS_NOP, "COMPLETED" }
};
-const int sense_key_table_size =
- sizeof(sense_key_table)/sizeof(sense_key_table[0]);
-
static struct asc_table_entry quantum_fireball_entries[] = {
{ SST(0x04, 0x0b, SS_START | SSQ_DECREMENT_COUNT | ENXIO,
"Logical unit not ready, initializing cmd. required") }
@@ -3291,14 +3288,14 @@ fetchtableentries(int sense_key, int asc, int ascq,
sense_tables[0] = quirk->sense_key_info;
sense_tables_size[0] = quirk->num_sense_keys;
sense_tables[1] = sense_key_table;
- sense_tables_size[1] = sense_key_table_size;
+ sense_tables_size[1] = nitems(sense_key_table);
num_sense_tables = 2;
} else {
asc_tables[0] = asc_table;
asc_tables_size[0] = asc_table_size;
num_asc_tables = 1;
sense_tables[0] = sense_key_table;
- sense_tables_size[0] = sense_key_table_size;
+ sense_tables_size[0] = nitems(sense_key_table);
num_sense_tables = 1;
}
OpenPOWER on IntegriCloud