[alsa-devel] [PATCH] ASoC: core: Only kmemdup binary control buffer if masking

Mark Brown broonie at kernel.org
Wed Apr 2 16:41:03 CEST 2014


On Wed, Apr 02, 2014 at 03:17:05PM +0100, Charles Keepax wrote:

> When writing a binary control we may apply a mask to the first register,
> as this requires modifying the data the buffer is duplicated, currently
> this is done for all binary control writes. As most binary controls
> don't use the mask facility and thus can freely use the original buffer,
> avoid the kmemdup for these cases.

No, that's not why we're duplicating...

> -	data = kmemdup(ucontrol->value.bytes.data, len, GFP_KERNEL | GFP_DMA);

...note the GFP_DMA there, it's about ensuring that the buffer is
DMAable since the underlying APIs end up wanting that (or will for
larger coefficient blocks anyway).  What would be slightly more
efficient in the success case would be to do a kmalloc() then
copy_from_user() into that block allowing us to bypass the copy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140402/8ae6484d/attachment.sig>


More information about the Alsa-devel mailing list