diff options
| author | Ohad Ben-Cohen <ohad@wizery.com> | 2012-01-31 09:07:27 -0500 |
|---|---|---|
| committer | Ohad Ben-Cohen <ohad@wizery.com> | 2012-02-22 11:28:49 -0500 |
| commit | e12bc14b88d44e5c1456dccb59ff58103f6c6edc (patch) | |
| tree | c7df21efc8f6f3649a35c16b01e90c16ce51d49a /include/linux | |
| parent | cf59d3e9a715fd2b6ff96e4a3a130fceded09a64 (diff) | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/remoteproc.h | 7 |
1 files changed, 7 insertions, 0 deletions
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 { | |||
| 103 | * the virtio device features, 'pa' holds the virtio guest | 103 | * the virtio device features, 'pa' holds the virtio guest |
| 104 | * features, 'len' holds the virtio status, and 'flags' holds | 104 | * features, 'len' holds the virtio status, and 'flags' holds |
| 105 | * the virtio id (currently only VIRTIO_ID_RPMSG is supported). | 105 | * the virtio id (currently only VIRTIO_ID_RPMSG is supported). |
| 106 | * @RSC_LAST: just keep this one at the end | ||
| 106 | * | 107 | * |
| 107 | * Most of the resource entries share the basic idea of address/length | 108 | * Most of the resource entries share the basic idea of address/length |
| 108 | * negotiation with the host: the firmware usually asks (on behalf of the | 109 | * negotiation with the host: the firmware usually asks (on behalf of the |
| @@ -115,6 +116,11 @@ struct fw_resource { | |||
| 115 | * will contain the expected device addresses (today we actually only support | 116 | * will contain the expected device addresses (today we actually only support |
| 116 | * this scheme, as there aren't yet any use cases for dynamically allocated | 117 | * this scheme, as there aren't yet any use cases for dynamically allocated |
| 117 | * device addresses). | 118 | * device addresses). |
| 119 | * | ||
| 120 | * Please note that these values are used as indices to the rproc_handle_rsc | ||
| 121 | * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to | ||
| 122 | * check the validity of an index before the lookup table is accessed, so | ||
| 123 | * please update it as needed. | ||
| 118 | */ | 124 | */ |
| 119 | enum fw_resource_type { | 125 | enum fw_resource_type { |
| 120 | RSC_CARVEOUT = 0, | 126 | RSC_CARVEOUT = 0, |
| @@ -122,6 +128,7 @@ enum fw_resource_type { | |||
| 122 | RSC_TRACE = 2, | 128 | RSC_TRACE = 2, |
| 123 | RSC_VRING = 3, | 129 | RSC_VRING = 3, |
| 124 | RSC_VIRTIO_DEV = 4, | 130 | RSC_VIRTIO_DEV = 4, |
| 131 | RSC_LAST = 5, | ||
| 125 | }; | 132 | }; |
| 126 | 133 | ||
| 127 | /** | 134 | /** |
