https://github.com/torvalds/linux
Revision 7ad222b3aed350adfc27ee7eec4587ffe55dfdce authored by Mauro Ciancio on 14 January 2019, 13:24:53 UTC, committed by Dmitry Torokhov on 17 February 2019, 06:49:46 UTC
This adds ELAN0617 to the ACPI table to support Elan touchpad found in
Lenovo V330-15ISK.

Signed-off-by: Mauro Ciancio <mauro@acadeu.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 2439d37
Raw File
Tip revision: 7ad222b3aed350adfc27ee7eec4587ffe55dfdce authored by Mauro Ciancio on 14 January 2019, 13:24:53 UTC
Input: elan_i2c - add ACPI ID for touchpad in Lenovo V330-15ISK
Tip revision: 7ad222b
memcat_p.c
// SPDX-License-Identifier: GPL-2.0

#include <linux/slab.h>

/*
 * Merge two NULL-terminated pointer arrays into a newly allocated
 * array, which is also NULL-terminated. Nomenclature is inspired by
 * memset_p() and memcat() found elsewhere in the kernel source tree.
 */
void **__memcat_p(void **a, void **b)
{
	void **p = a, **new;
	int nr;

	/* count the elements in both arrays */
	for (nr = 0, p = a; *p; nr++, p++)
		;
	for (p = b; *p; nr++, p++)
		;
	/* one for the NULL-terminator */
	nr++;

	new = kmalloc_array(nr, sizeof(void *), GFP_KERNEL);
	if (!new)
		return NULL;

	/* nr -> last index; p points to NULL in b[] */
	for (nr--; nr >= 0; nr--, p = p == b ? &a[nr] : p - 1)
		new[nr] = *p;

	return new;
}
EXPORT_SYMBOL_GPL(__memcat_p);

back to top