linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] remoteproc: s/big switch/lookup table/
Date: Tue, 31 Jan 2012 13:08:52 -0700	[thread overview]
Message-ID: <20120131200852.GC22611@ponder.secretlab.ca> (raw)
In-Reply-To: <4F282BB2.6080604@fastmail.fm>

On Tue, Jan 31, 2012 at 05:58:10PM +0000, Jack Stone wrote:
> 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).

Yes, that is the right thing to do.  Then the compiler can catch ordering
issues for you.

g.

  reply	other threads:[~2012-01-31 20:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 16:52 [PATCH 1/2] remoteproc: bail out if firmware has different endianess Ohad Ben-Cohen
2012-01-31 16:52 ` [PATCH 2/2] remoteproc: s/big switch/lookup table/ Ohad Ben-Cohen
2012-01-31 17:58   ` Jack Stone
2012-01-31 20:08     ` Grant Likely [this message]
2012-01-31 20:21       ` Ohad Ben-Cohen
2012-01-31 20:09 ` [PATCH 1/2] remoteproc: bail out if firmware has different endianess Grant Likely
2012-02-08 21:01   ` Ohad Ben-Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120131200852.GC22611@ponder.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).