On Wed, Apr 02, 2014 at 03:41:03PM +0100, Mark Brown wrote:
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.
Ah... thanks sorry about the noise.
Thanks, Charles