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 <grant.likely@secretlab.ca>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index b52f784..ada4cb0 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -103,6 +103,7 @@
  *		    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 @@
  * 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 @@
 	RSC_TRACE	= 2,
 	RSC_VRING	= 3,
 	RSC_VIRTIO_DEV	= 4,
+	RSC_LAST	= 5,
 };
 
 /**