/* * generic arrays */ #include #include #include /** * snd_array_new - get a new element from the given array * @array: the array object * * Get a new element from the given array. If it exceeds the * pre-allocated array size, re-allocate the array. * * Returns NULL if allocation failed. */ void *snd_array_new(struct snd_array *array) { if (snd_BUG_ON(!array->elem_size)) return NULL; if (array->used >= array->alloced) { int num = array->alloced + array->alloc_align; int oldsize = array->alloced * array->elem_size; int size = (num + 1) * array->elem_size; void *nlist; if (snd_BUG_ON(num >= 4096)) return NULL; nlist = krealloc(array->list, size, GFP_KERNEL); if (!nlist) return NULL; memset(nlist + oldsize, 0, size - oldsize); array->list = nlist; array->alloced = num; } return snd_array_elem(array, array->used++); } EXPORT_SYMBOL_GPL(snd_array_new); /** * snd_array_free - free the given array elements * @array: the array object */ void snd_array_free(struct snd_array *array) { kfree(array->list); array->used = 0; array->alloced = 0; array->list = NULL; } EXPORT_SYMBOL_GPL(snd_array_free); ter'>master net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-01 08:34:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-01 08:34:13 -0800
commitc325b3533730016ca5cdaf902d62550b4243fe43 (patch)
tree03d2690d6df1c449b1f8db597d3e574d894e3ddc /drivers/usb/host/pci-quirks.h
parenta2ca3d617944417e9dd5f09fc8a4549cda115f4f (diff)
parentcdca06e4e85974d8a3503ab15709dbbaf90d3dd1 (diff)
Merge tag 'pinctrl-v4.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "Another week, another set of pin control fixes. The subsystem has seen high patch-spot activity recently. The majority of the patches are for Intel, I vaguely think it mostly concern phones, tablets and maybe chromebooks and even laptops with this Intel Atom family chips. Driver fixes only: - one fix to the Berlin driver making the SD card work fully again. - one fix to the Allwinner/sunxi bias function: one premature change needs to be partially reverted. - the remaining four patches are to Intel embedded SoCs: baytrail (three patches) and merrifield (one patch): register access debounce fixes and a missing spinlock" * tag 'pinctrl-v4.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler pinctrl: baytrail: Debounce register is one per community pinctrl: baytrail: Rectify debounce support (part 2) pinctrl: intel: merrifield: Add missed check in mrfld_config_set() pinctrl: sunxi: Don't enforce bias disable (for now) pinctrl: berlin-bg4ct: fix the value for "sd1a" of pin SCRD0_CRD_PRES
Diffstat (limited to 'drivers/usb/host/pci-quirks.h')