From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 01/05] dmaengine: shdma: Remove sh_dmae_slave_chan_id enum
Date: Fri, 19 Mar 2010 08:23:29 +0000 [thread overview]
Message-ID: <20100319082329.GD10003@linux-sh.org> (raw)
In-Reply-To: <20100319044638.17051.97049.sendpatchset@t400s>
On Fri, Mar 19, 2010 at 09:16:46AM +0100, Guennadi Liakhovetski wrote:
> On Fri, 19 Mar 2010, Magnus Damm wrote:
> > Reserving some number sounds like a good plan, but exactly what is the
> > best is a different question. If I'm allowed to nitpick then I think
> > its wasteful to use one bit for the sign when only needing one value
> > to mark unused. So I'd prefer to go with unsigned and 0 as unused mark
> > and the rest as valid ids.
>
> Well, personally I somewhat dislike using 0 as an invalid ID (or invalid
> IRQ...). Then you have to remember to use an offset:
>
> if ((unsigned)slave_id >= SHDMA_SLAVE_NUMBER)
>
> gets an oddition of "|| !slave_id", and you're wasting one bit in
> sh_dmae_slave_used[];) And, as I said - extra typing:)
>
I don't have any strong opinions on this one way or the other. If 0 =
disabled then this is the default behaviour people will end up with when
just sticking with default initialization, explicit slave ID setting will
trump this regardless.
I do generally prefer a -1 for explicitly disabling something since it
means someone has thought about it and wants that behaviour as opposed to
simply defaulting to it after clearing memory. However, there are also
many places in the kernel where 0 = invalid assumptions are hardcoded,
as with the IRQ case.
The difference between INT_MAX vs UINT_MAX is a pretty academic one in
terms of suitability for slave IDs, no CPU is going to approach either
one of those limits regardless.
prev parent reply other threads:[~2010-03-19 8:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-19 4:46 [PATCH 01/05] dmaengine: shdma: Remove sh_dmae_slave_chan_id enum Magnus Damm
2010-03-19 7:30 ` [PATCH 01/05] dmaengine: shdma: Remove sh_dmae_slave_chan_id Guennadi Liakhovetski
2010-03-19 8:02 ` [PATCH 01/05] dmaengine: shdma: Remove sh_dmae_slave_chan_id enum Magnus Damm
2010-03-19 8:16 ` [PATCH 01/05] dmaengine: shdma: Remove sh_dmae_slave_chan_id Guennadi Liakhovetski
2010-03-19 8:23 ` Paul Mundt [this message]
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=20100319082329.GD10003@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=linux-sh@vger.kernel.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).