From e12bc14b88d44e5c1456dccb59ff58103f6c6edc Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen Date: Tue, 31 Jan 2012 16:07:27 +0200 Subject: remoteproc: s/big switch/lookup table/ A lookup table would be easier to extend, and the resulting code is a bit cleaner. Reported-by: Grant Likely Signed-off-by: Ohad Ben-Cohen --- include/linux/remoteproc.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux/remoteproc.h') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index b52f78413c5c..ada4cb063dfe 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -103,6 +103,7 @@ struct fw_resource { * the virtio device features, 'pa' holds the virtio guest * features, 'len' holds the virtio status, and 'flags' holds * the virtio id (currently only VIRTIO_ID_RPMSG is supported). + * @RSC_LAST: just keep this one at the end * * Most of the resource entries share the basic idea of address/length * negotiation with the host: the firmware usually asks (on behalf of the @@ -115,6 +116,11 @@ struct fw_resource { * will contain the expected device addresses (today we actually only support * this scheme, as there aren't yet any use cases for dynamically allocated * device addresses). + * + * Please note that these values are used as indices to the rproc_handle_rsc + * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to + * check the validity of an index before the lookup table is accessed, so + * please update it as needed. */ enum fw_resource_type { RSC_CARVEOUT = 0, @@ -122,6 +128,7 @@ enum fw_resource_type { RSC_TRACE = 2, RSC_VRING = 3, RSC_VIRTIO_DEV = 4, + RSC_LAST = 5, }; /** -- cgit v1.2.3