/*
 * Copyright © 2008 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 *
 * Authors:
 *     Jesse Barnes <jbarnes@virtuousgeek.org>
 *
 */
#ifndef _DRM_MEM_UTIL_H_
#define _DRM_MEM_UTIL_H_

#include <linux/vmalloc.h>

static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
{
	if (size != 0 && nmemb > SIZE_MAX / size)
		return NULL;

	if (size * nmemb <= PAGE_SIZE)
	    return kcalloc(nmemb, size, GFP_KERNEL);

	return __vmalloc(size * nmemb,
			 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
}

/* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */
static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
{
	if (size != 0 && nmemb > SIZE_MAX / size)
		return NULL;

	if (size * nmemb <= PAGE_SIZE)
	    return kmalloc(nmemb * size, GFP_KERNEL);

	return __vmalloc(size * nmemb,
			 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
}

static __inline__ void *drm_malloc_gfp(size_t nmemb, size_t size, gfp_t gfp)
{
	if (size != 0 && nmemb > SIZE_MAX / size)
		return NULL;

	if (size * nmemb <= PAGE_SIZE)
		return kmalloc(nmemb * size, gfp);

	if (gfp & __GFP_RECLAIMABLE) {
		void *ptr = kmalloc(nmemb * size,
				    gfp | __GFP_NOWARN | __GFP_NORETRY);
		if (ptr)
			return ptr;
	}

	return __vmalloc(size * nmemb,
			 gfp | __GFP_HIGHMEM, PAGE_KERNEL);
}

static __inline void drm_free_large(void *ptr)
{
	kvfree(ptr);
}

#endif
Build'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools/perf?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>perf</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/pmu-events?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>pmu-events</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>Build</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>Linus Torvalds &lt;torvalds@linux-foundation.org&gt;</td><td class='right'>2016-12-20 15:48:34 -0800</td></tr>
<tr><th>committer</th><td>Linus Torvalds &lt;torvalds@linux-foundation.org&gt;</td><td class='right'>2016-12-20 15:48:34 -0800</td></tr>
<tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22</a> (<a href='/cgit.cgi/linux/net-next.git/patch/tools/perf/pmu-events/Build?id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>81b4e19de7308ce46ac7d0f670302906a906f0d0</a> /<a href='/cgit.cgi/linux/net-next.git/tree/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>tools/perf/pmu-events/Build</a></td></tr>
<tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=3eb86259eca6a363ed7bb13ecea5cda809f7b97d'>3eb86259eca6a363ed7bb13ecea5cda809f7b97d</a> (<a href='/cgit.cgi/linux/net-next.git/diff/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22&amp;id2=3eb86259eca6a363ed7bb13ecea5cda809f7b97d'>diff</a>)</td></tr><tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=a763f78cea845c91b8d91f93dabf70c407635dc5'>a763f78cea845c91b8d91f93dabf70c407635dc5</a> (<a href='/cgit.cgi/linux/net-next.git/diff/tools/perf/pmu-events/Build?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22&amp;id2=a763f78cea845c91b8d91f93dabf70c407635dc5'>diff</a>)</td></tr></table>
<div class='commit-subject'>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</div><div class='commit-msg'>Pull networking fixes and cleanups from David Miller:

 1) Use rb_entry() instead of hardcoded container_of(), from Geliang
    Tang.

 2) Use correct memory barriers in stammac driver, from Pavel Machek.

 3) Fix assoc bind address handling in SCTP, from Xin Long.

 4) Make the length check for UFO handling consistent between
    __ip_append_data() and ip_finish_output(), from Zheng Li.

 5) HSI driver compatible strings were busted fro hix5hd2, from Dongpo
    Li.

 6) Handle devm_ioremap() errors properly in cavium driver, from Arvind
    Yadav.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (22 commits)
  RDS: use rb_entry()
  net_sched: sch_netem: use rb_entry()
  net_sched: sch_fq: use rb_entry()
  net/mlx5: use rb_entry()
  ethernet: sfc: Add Kconfig entry for vendor Solarflare
  sctp: not copying duplicate addrs to the assoc's bind address list
  sctp: reduce indent level in sctp_copy_local_addr_list
  ARM: dts: hix5hd2: don't change the existing compatible string
  net: hix5hd2_gmac: fix compatible strings name
  openvswitch: Add a missing break statement.
  net: netcp: ethss: fix 10gbe host port tx pri map configuration
  net: netcp: ethss: fix errors in ethtool ops
  fsl/fman: enable compilation on ARM64
  fsl/fman: A007273 only applies to PPC SoCs
  powerpc: fsl/fman: remove fsl,fman from of_device_ids[]
  fsl/fman: fix 1G support for QSGMII interfaces
  dt: bindings: net: use boolean dt properties for eee broken modes
  net: phy: use boolean dt properties for eee broken modes
  net: phy: fix sign type error in genphy_config_eee_advert
  ipv4: Should use consistent conditional judgement for ip fragment in __ip_append_data and ip_finish_output
  ...
</div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove&amp;id=ba6d973f78eb62ffebb32f6ef3334fc9a3b33d22'>Diffstat</a> (limited to 'tools/perf/pmu-events/Build')</div><table summary='diffstat' class='diffstat'>