* [PATCH 1/1] scsi: storvsc: Use ARRAY_SIZE() to compute the elements in the protocol array
@ 2015-08-14 20:50 K. Y. Srinivasan
0 siblings, 0 replies; only message in thread
From: K. Y. Srinivasan @ 2015-08-14 20:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, ohering, jbottomley, hch,
linux-scsi, apw, vkuznets, jasowang, jthumshirn
Cc: K. Y. Srinivasan
Rather than hard coding the number of elements in the array, use the ARRAY_SIZE()
macro to compute the number of elements in the array. This would minimize the
changes needed when we have to extend the protocols supported.
This was suggested by Johannes Thumshirn <jthumshirn@suse.de>.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/scsi/storvsc_drv.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 64fa305..4dffc3b 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -226,9 +226,8 @@ struct vmstor_protocol {
int vmscsi_size_delta;
};
-#define VMSTOR_NUM_PROTOCOLS 5
-const struct vmstor_protocol vmstor_protocols[VMSTOR_NUM_PROTOCOLS] = {
+const struct vmstor_protocol vmstor_protocols[] = {
{
VMSTOR_PROTO_VERSION_WIN10,
POST_WIN7_STORVSC_SENSE_BUFFER_SIZE,
@@ -959,7 +958,7 @@ static int storvsc_channel_init(struct hv_device *device)
}
- for (i = 0; i < VMSTOR_NUM_PROTOCOLS; i++) {
+ for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) {
/* reuse the packet for version range supported */
memset(vstor_packet, 0, sizeof(struct vstor_packet));
vstor_packet->operation =
--
1.7.4.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-14 19:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14 20:50 [PATCH 1/1] scsi: storvsc: Use ARRAY_SIZE() to compute the elements in the protocol array K. Y. Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome