[alsa-devel] [PATCH] ALSA: pcm: Mostly constify constraints

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Jul 5 11:28:42 CEST 2012


On Thu, Jul 05, 2012 at 09:06:30AM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > There is no need for the constraints to be modified while being
> > applied

> Many drivers pass the local instance to rule->private, and it's not
> always guaranteed to be const.  For example, you can imagine some
> state modified kept in the struct while it's modified via rules.

> In short: you'd have seen many compile warnings for non-ASoC drivers
> if you run make once with this patch ;)

Well, that's trivial to fix.

> As a safe side fix, how about just adding const to
> snd_pcm_hw_constraint_list() & co, and expclitly cast to non-const
> later?

My inclination for something like this is to put the casts with the
users since that way we get the type safety through most of the code and
we can see that dropping the const is safe since we're just getting back
our own data.  If we can see the APIs immediately dropping the const I'd
expect we'd get people spending time on code review trying to figure out
if it's safe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20120705/ae266e1a/attachment.sig 


More information about the Alsa-devel mailing list