lkml.org 
[lkml]   [2012]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] remoteproc: s/big switch/lookup table/
On 31/01/12 16:52, Ohad Ben-Cohen wrote:
> +/*
> + * A lookup table for resource handlers. Always keep in sync with
> + * enum fw_resource_type.
> + */
> +static rproc_handle_resource_t rproc_handle_rsc[] = {
> + rproc_handle_carveout, /* RSC_CARVEOUT */
> + rproc_handle_devmem, /* RSC_DEVMEM */
> + rproc_handle_trace, /* RSC_TRACE */
> + rproc_handle_vring, /* RSC_VRING */
> + NULL, /* RSC_VIRTIO_DEV is handled early upon registration */
> +};
> +

You could change this to

[RSC_CARVEOUT] = rproc_handle_carveout,

Then you would be safe against renumbering and would only need to worry
about addition (which your RSC_LAST check copes with).

Thanks,

Jack


\
 
 \ /
  Last update: 2012-01-31 19:01    [W:0.047 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site