diff options
Diffstat (limited to 'sys/dev')
26 files changed, 174 insertions, 200 deletions
diff --git a/sys/dev/pci/drm/i915/dvo_ch7017.c b/sys/dev/pci/drm/i915/dvo_ch7017.c index 53954d19391..3a74b021165 100644 --- a/sys/dev/pci/drm/i915/dvo_ch7017.c +++ b/sys/dev/pci/drm/i915/dvo_ch7017.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvo_ch7017.c,v 1.3 2013/08/13 10:23:48 jsg Exp $ */ +/* $OpenBSD: dvo_ch7017.c,v 1.4 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006 Intel Corporation * @@ -205,7 +205,7 @@ static bool ch7017_init(struct intel_dvo_device *dvo, const char *str; u8 val; - priv = malloc(sizeof(struct ch7017_priv), M_DRM, M_WAITOK | M_ZERO); + priv = kzalloc(sizeof(struct ch7017_priv), GFP_KERNEL); if (priv == NULL) return false; @@ -237,7 +237,7 @@ static bool ch7017_init(struct intel_dvo_device *dvo, return true; fail: - free(priv, M_DRM); + kfree(priv); return false; } @@ -398,7 +398,7 @@ static void ch7017_destroy(struct intel_dvo_device *dvo) struct ch7017_priv *priv = dvo->dev_priv; if (priv) { - free(priv, M_DRM); + kfree(priv); dvo->dev_priv = NULL; } } diff --git a/sys/dev/pci/drm/i915/dvo_ch7xxx.c b/sys/dev/pci/drm/i915/dvo_ch7xxx.c index fb4a1e609c1..e3030be098a 100644 --- a/sys/dev/pci/drm/i915/dvo_ch7xxx.c +++ b/sys/dev/pci/drm/i915/dvo_ch7xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvo_ch7xxx.c,v 1.3 2013/08/13 10:23:48 jsg Exp $ */ +/* $OpenBSD: dvo_ch7xxx.c,v 1.4 2014/01/21 08:57:22 kettenis Exp $ */ /************************************************************************** Copyright © 2006 Dave Airlie @@ -177,7 +177,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo, uint8_t vendor, device; char *name; - ch7xxx = malloc(sizeof(struct ch7xxx_priv), M_DRM, M_WAITOK | M_ZERO); + ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); if (ch7xxx == NULL) return false; @@ -212,7 +212,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo, name, vendor, device); return true; out: - free(ch7xxx, M_DRM); + kfree(ch7xxx); return false; } @@ -323,7 +323,7 @@ static void ch7xxx_destroy(struct intel_dvo_device *dvo) struct ch7xxx_priv *ch7xxx = dvo->dev_priv; if (ch7xxx) { - free(ch7xxx, M_DRM); + kfree(ch7xxx); dvo->dev_priv = NULL; } } diff --git a/sys/dev/pci/drm/i915/dvo_ivch.c b/sys/dev/pci/drm/i915/dvo_ivch.c index 7e1e33b8868..b2c0bf9e867 100644 --- a/sys/dev/pci/drm/i915/dvo_ivch.c +++ b/sys/dev/pci/drm/i915/dvo_ivch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvo_ivch.c,v 1.4 2013/08/13 10:23:48 jsg Exp $ */ +/* $OpenBSD: dvo_ivch.c,v 1.5 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006 Intel Corporation * @@ -239,7 +239,7 @@ static bool ivch_init(struct intel_dvo_device *dvo, struct ivch_priv *priv; uint16_t temp; - priv = malloc(sizeof(struct ivch_priv), M_DRM, M_WAITOK | M_ZERO); + priv = kzalloc(sizeof(struct ivch_priv), GFP_KERNEL); if (priv == NULL) return false; @@ -268,7 +268,7 @@ static bool ivch_init(struct intel_dvo_device *dvo, return true; out: - free(priv, M_DRM); + kfree(priv); return false; } @@ -418,7 +418,7 @@ static void ivch_destroy(struct intel_dvo_device *dvo) struct ivch_priv *priv = dvo->dev_priv; if (priv) { - free(priv, M_DRM); + kfree(priv); dvo->dev_priv = NULL; } } diff --git a/sys/dev/pci/drm/i915/dvo_ns2501.c b/sys/dev/pci/drm/i915/dvo_ns2501.c index 474e8005b96..c37b1a9a81f 100644 --- a/sys/dev/pci/drm/i915/dvo_ns2501.c +++ b/sys/dev/pci/drm/i915/dvo_ns2501.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvo_ns2501.c,v 1.5 2013/08/13 10:23:49 jsg Exp $ */ +/* $OpenBSD: dvo_ns2501.c,v 1.6 2014/01/21 08:57:22 kettenis Exp $ */ /* * * Copyright (c) 2012 Gilles Dartiguelongue, Thomas Richter @@ -216,7 +216,7 @@ static bool ns2501_init(struct intel_dvo_device *dvo, struct ns2501_priv *ns; unsigned char ch; - ns = malloc(sizeof(struct ns2501_priv), M_DRM, M_WAITOK | M_ZERO); + ns = kzalloc(sizeof(struct ns2501_priv), GFP_KERNEL); if (ns == NULL) return false; @@ -250,7 +250,7 @@ static bool ns2501_init(struct intel_dvo_device *dvo, return true; out: - free(ns, M_DRM); + kfree(ns); return false; } @@ -565,7 +565,7 @@ static void ns2501_destroy(struct intel_dvo_device *dvo) struct ns2501_priv *ns = dvo->dev_priv; if (ns) { - free(ns, M_DRM); + kfree(ns); dvo->dev_priv = NULL; } } diff --git a/sys/dev/pci/drm/i915/dvo_sil164.c b/sys/dev/pci/drm/i915/dvo_sil164.c index d3c633ef9a0..5ccb5760950 100644 --- a/sys/dev/pci/drm/i915/dvo_sil164.c +++ b/sys/dev/pci/drm/i915/dvo_sil164.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvo_sil164.c,v 1.3 2013/08/13 10:23:49 jsg Exp $ */ +/* $OpenBSD: dvo_sil164.c,v 1.4 2014/01/21 08:57:22 kettenis Exp $ */ /************************************************************************** Copyright © 2006 Dave Airlie @@ -132,7 +132,7 @@ static bool sil164_init(struct intel_dvo_device *dvo, struct sil164_priv *sil; unsigned char ch; - sil = malloc(sizeof(struct sil164_priv), M_DRM, M_WAITOK | M_ZERO); + sil = kzalloc(sizeof(struct sil164_priv), GFP_KERNEL); if (sil == NULL) return false; @@ -163,7 +163,7 @@ static bool sil164_init(struct intel_dvo_device *dvo, return true; out: - free(sil, M_DRM); + kfree(sil); return false; } @@ -258,7 +258,7 @@ static void sil164_destroy(struct intel_dvo_device *dvo) struct sil164_priv *sil = dvo->dev_priv; if (sil) { - free(sil, M_DRM); + kfree(sil); dvo->dev_priv = NULL; } } diff --git a/sys/dev/pci/drm/i915/dvo_tfp410.c b/sys/dev/pci/drm/i915/dvo_tfp410.c index 084c237ba15..46c69a4e22b 100644 --- a/sys/dev/pci/drm/i915/dvo_tfp410.c +++ b/sys/dev/pci/drm/i915/dvo_tfp410.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvo_tfp410.c,v 1.3 2013/08/13 10:23:49 jsg Exp $ */ +/* $OpenBSD: dvo_tfp410.c,v 1.4 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2007 Dave Mueller * @@ -168,7 +168,7 @@ static bool tfp410_init(struct intel_dvo_device *dvo, struct tfp410_priv *tfp; int id; - tfp = malloc(sizeof(struct tfp410_priv), M_DRM, M_WAITOK | M_ZERO); + tfp = kzalloc(sizeof(struct tfp410_priv), GFP_KERNEL); if (tfp == NULL) return false; @@ -192,7 +192,7 @@ static bool tfp410_init(struct intel_dvo_device *dvo, tfp->quiet = false; return true; out: - free(tfp, M_DRM); + kfree(tfp); return false; } @@ -297,7 +297,7 @@ static void tfp410_destroy(struct intel_dvo_device *dvo) struct tfp410_priv *tfp = dvo->dev_priv; if (tfp) { - free(tfp, M_DRM); + kfree(tfp); dvo->dev_priv = NULL; } } diff --git a/sys/dev/pci/drm/i915/i915_dma.c b/sys/dev/pci/drm/i915/i915_dma.c index ad2a79e6db8..57072b58acd 100644 --- a/sys/dev/pci/drm/i915/i915_dma.c +++ b/sys/dev/pci/drm/i915/i915_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_dma.c,v 1.14 2013/12/01 11:47:13 kettenis Exp $ */ +/* $OpenBSD: i915_dma.c,v 1.15 2014/01/21 08:57:22 kettenis Exp $ */ /* i915_dma.c -- DMA support for the I915 -*- linux-c -*- */ /* @@ -388,7 +388,7 @@ i915_driver_open(struct drm_device *dev, struct drm_file *file) { struct drm_i915_file_private *file_priv; - file_priv = malloc(sizeof(*file_priv), M_DRM, M_WAITOK); + file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL); if (!file_priv) return ENOMEM; @@ -409,5 +409,5 @@ i915_driver_close(struct drm_device *dev, struct drm_file *file) i915_gem_context_close(dev, file); i915_gem_release(dev, file); - free(file_priv, M_DRM); + kfree(file_priv); } diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c index dc24f6bac43..baa7f56795e 100644 --- a/sys/dev/pci/drm/i915/i915_gem.c +++ b/sys/dev/pci/drm/i915/i915_gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem.c,v 1.65 2014/01/21 08:29:32 kettenis Exp $ */ +/* $OpenBSD: i915_gem.c,v 1.66 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org> * @@ -1851,10 +1851,8 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj) #ifdef __linux__ sg_free_table(obj->pages); - kfree(obj->pages); -#else - drm_free(obj->pages); #endif + kfree(obj->pages); } static int @@ -2042,7 +2040,7 @@ err_pages: return PTR_ERR(page); #else err_pages: - drm_free(st); + free(st, M_DRM); return -ENOMEM; #endif } @@ -2214,7 +2212,7 @@ i915_add_request(struct intel_ring_buffer *ring, if (ret) return ret; - request = drm_alloc(sizeof(*request)); + request = kmalloc(sizeof(*request), GFP_KERNEL); if (request == NULL) return -ENOMEM; @@ -2228,7 +2226,7 @@ i915_add_request(struct intel_ring_buffer *ring, ret = ring->add_request(ring); if (ret) { - drm_free(request); + kfree(request); return ret; } @@ -2297,7 +2295,7 @@ static void i915_gem_reset_ring_lists(struct drm_i915_private *dev_priv, list_del(&request->list); i915_gem_request_remove_from_client(request); - drm_free(request); + kfree(request); } while (!list_empty(&ring->active_list)) { @@ -2391,7 +2389,7 @@ i915_gem_retire_requests_ring(struct intel_ring_buffer *ring) list_del(&request->list); i915_gem_request_remove_from_client(request); - drm_free(request); + kfree(request); } /* Move any buffers on the active list that are no longer referenced @@ -3119,7 +3117,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, i915_gem_object_pin_pages(obj); - node = malloc(sizeof(*node), M_DRM, M_NOWAIT | M_ZERO); + node = kzalloc(sizeof(*node), GFP_KERNEL); if (node == NULL) { i915_gem_object_unpin_pages(obj); /* XXX Until we've hooked up the shrinking functions. */ @@ -3146,7 +3144,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, i915_gem_object_unpin_pages(obj); /* XXX Until we've hooked up the shrinking functions. */ i915_gem_object_put_pages(obj); - free(node, M_DRM); + kfree(node); return ret; } if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) { @@ -3978,7 +3976,7 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj) drm_gem_object_release(&obj->base); i915_gem_info_remove_obj(dev_priv, obj->base.size); - drm_free(obj->bit_17); + kfree(obj->bit_17); pool_put(&dev->objpl, obj); } @@ -4386,7 +4384,7 @@ static int i915_gem_init_phys_object(struct drm_device *dev, if (dev_priv->mm.phys_objs[id - 1] || !size) return 0; - phys_obj = drm_alloc(sizeof(struct drm_i915_gem_phys_object)); + phys_obj = kzalloc(sizeof(struct drm_i915_gem_phys_object), GFP_KERNEL); if (!phys_obj) return -ENOMEM; @@ -4402,7 +4400,7 @@ static int i915_gem_init_phys_object(struct drm_device *dev, return 0; kfree_obj: - drm_free(phys_obj); + kfree(phys_obj); return ret; } diff --git a/sys/dev/pci/drm/i915/i915_gem_context.c b/sys/dev/pci/drm/i915/i915_gem_context.c index 4e71a448d7d..9c757c81955 100644 --- a/sys/dev/pci/drm/i915/i915_gem_context.c +++ b/sys/dev/pci/drm/i915/i915_gem_context.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem_context.c,v 1.6 2014/01/21 08:43:56 kettenis Exp $ */ +/* $OpenBSD: i915_gem_context.c,v 1.7 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2011-2012 Intel Corporation * @@ -143,7 +143,7 @@ static void do_destroy(struct i915_hw_context *ctx) BUG_ON(ctx != dev_priv->ring[RCS].default_context); drm_gem_object_unreference(&ctx->obj->base); - free(ctx, M_DRM); + kfree(ctx); } static struct i915_hw_context * @@ -155,13 +155,13 @@ create_hw_context(struct drm_device *dev, struct i915_ctx_handle *han; int ret; - ctx = malloc(sizeof(*ctx), M_DRM, M_WAITOK | M_ZERO); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (ctx == NULL) return ERR_PTR(-ENOMEM); ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); if (ctx->obj == NULL) { - free(ctx, M_DRM); + kfree(ctx); DRM_DEBUG_DRIVER("Context object allocated failed\n"); return ERR_PTR(-ENOMEM); } @@ -185,7 +185,8 @@ create_hw_context(struct drm_device *dev, ctx->file_priv = file_priv; - if ((han = drm_calloc(1, sizeof(*han))) == NULL) { + han = malloc(sizeof(*han), M_DRM, M_WAITOK | M_CANFAIL | M_ZERO); + if (han == NULL) { ret = -ENOMEM; DRM_DEBUG_DRIVER("idr allocation failed\n"); goto err_out; @@ -326,7 +327,7 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) nxt = SPLAY_NEXT(i915_ctx_tree, &file_priv->ctx_tree, han); context_idr_cleanup(han->handle, han->ctx, NULL); SPLAY_REMOVE(i915_ctx_tree, &file_priv->ctx_tree, han); - drm_free(han); + free(han, M_DRM); } DRM_UNLOCK(); } diff --git a/sys/dev/pci/drm/i915/i915_gem_execbuffer.c b/sys/dev/pci/drm/i915/i915_gem_execbuffer.c index 79e7dc9ed75..c37a64f6d5d 100644 --- a/sys/dev/pci/drm/i915/i915_gem_execbuffer.c +++ b/sys/dev/pci/drm/i915/i915_gem_execbuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem_execbuffer.c,v 1.25 2013/12/11 20:31:43 kettenis Exp $ */ +/* $OpenBSD: i915_gem_execbuffer.c,v 1.26 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org> * @@ -1252,8 +1252,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data, return -EINVAL; } - exec2_list = malloc(sizeof(*exec2_list)*args->buffer_count, - M_DRM, M_WAITOK); + exec2_list = kmalloc(sizeof(*exec2_list)*args->buffer_count, + GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); if (exec2_list == NULL) { DRM_DEBUG("Failed to allocate exec list for %d buffers\n", args->buffer_count); diff --git a/sys/dev/pci/drm/i915/i915_gem_tiling.c b/sys/dev/pci/drm/i915/i915_gem_tiling.c index ba885872c2a..bc84a9e7f7e 100644 --- a/sys/dev/pci/drm/i915/i915_gem_tiling.c +++ b/sys/dev/pci/drm/i915/i915_gem_tiling.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem_tiling.c,v 1.12 2013/12/15 11:17:36 kettenis Exp $ */ +/* $OpenBSD: i915_gem_tiling.c,v 1.13 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org> * @@ -538,7 +538,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj) * and a better way should be done */ size_t nb17 = ((page_count + 31) & ~31)/32; - obj->bit_17 = drm_alloc(nb17 * sizeof(u_int32_t)); + obj->bit_17 = kmalloc(nb17 * sizeof(u_int32_t), GFP_KERNEL); if (obj->bit_17 == NULL) { DRM_ERROR("Failed to allocate memory for bit 17 " "record\n"); diff --git a/sys/dev/pci/drm/i915/intel_bios.c b/sys/dev/pci/drm/i915/intel_bios.c index 67a5f3bfdc8..4001d0c4670 100644 --- a/sys/dev/pci/drm/i915/intel_bios.c +++ b/sys/dev/pci/drm/i915/intel_bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_bios.c,v 1.6 2014/01/21 04:47:38 kettenis Exp $ */ +/* $OpenBSD: intel_bios.c,v 1.7 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006 Intel Corporation * @@ -234,8 +234,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, lvds_lfp_data_ptrs, lvds_options->panel_type); - panel_fixed_mode = malloc(sizeof(*panel_fixed_mode), M_DRM, - M_WAITOK | M_ZERO); + panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); if (!panel_fixed_mode) return; @@ -313,8 +312,7 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv, if (!dvo_timing) return; - panel_fixed_mode = malloc(sizeof(*panel_fixed_mode), M_DRM, - M_WAITOK | M_ZERO); + panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); if (!panel_fixed_mode) return; @@ -616,8 +614,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv, DRM_DEBUG_KMS("no child dev is parsed from VBT\n"); return; } - dev_priv->child_dev = malloc(sizeof(*p_child) * count, M_DRM, - M_WAITOK | M_ZERO); + dev_priv->child_dev = kcalloc(count, sizeof(*p_child), GFP_KERNEL); if (!dev_priv->child_dev) { DRM_DEBUG_KMS("No memory space for child device\n"); return; diff --git a/sys/dev/pci/drm/i915/intel_crt.c b/sys/dev/pci/drm/i915/intel_crt.c index 483e0560aae..959256d5f78 100644 --- a/sys/dev/pci/drm/i915/intel_crt.c +++ b/sys/dev/pci/drm/i915/intel_crt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_crt.c,v 1.5 2013/08/13 10:23:50 jsg Exp $ */ +/* $OpenBSD: intel_crt.c,v 1.6 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006-2007 Intel Corporation * @@ -121,7 +121,7 @@ static void intel_disable_crt(struct intel_encoder *encoder) static void intel_enable_crt(struct intel_encoder *encoder) { struct intel_crt *crt = intel_encoder_to_crt(encoder); - + intel_crt_set_dpms(encoder, crt->connector->base.dpms); } @@ -427,7 +427,7 @@ static int intel_crt_ddc_get_modes(struct drm_connector *connector, return 0; ret = intel_connector_update_modes(connector, edid); - free(edid, M_DRM); + kfree(edid); return ret; } @@ -446,7 +446,6 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) if (edid) { bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; - free(edid, M_DRM); /* * This may be a DVI-I connector with a shared DDC @@ -463,6 +462,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n"); } + kfree(edid); + return false; } @@ -638,7 +639,7 @@ static void intel_crt_destroy(struct drm_connector *connector) drm_sysfs_connector_remove(connector); #endif drm_connector_cleanup(connector); - free(connector, M_DRM); + kfree(connector); } static int intel_crt_get_modes(struct drm_connector *connector) @@ -744,14 +745,13 @@ void intel_crt_init(struct drm_device *dev) if (dmi_check_system(intel_no_crt)) return; - crt = malloc(sizeof(struct intel_crt), M_DRM, M_WAITOK | M_ZERO); + crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL); if (!crt) return; - intel_connector = malloc(sizeof(struct intel_connector), M_DRM, - M_WAITOK | M_ZERO); + intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); if (!intel_connector) { - free(crt, M_DRM); + kfree(crt); return; } diff --git a/sys/dev/pci/drm/i915/intel_ddi.c b/sys/dev/pci/drm/i915/intel_ddi.c index d60adf2e883..f4a03e116fc 100644 --- a/sys/dev/pci/drm/i915/intel_ddi.c +++ b/sys/dev/pci/drm/i915/intel_ddi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_ddi.c,v 1.5 2013/08/13 10:23:50 jsg Exp $ */ +/* $OpenBSD: intel_ddi.c,v 1.6 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2012 Intel Corporation * @@ -1480,24 +1480,22 @@ void intel_ddi_init(struct drm_device *dev, enum port port) struct intel_connector *hdmi_connector = NULL; struct intel_connector *dp_connector = NULL; - intel_dig_port = malloc(sizeof(struct intel_digital_port), M_DRM, - M_WAITOK | M_ZERO); + intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL); if (!intel_dig_port) return; - dp_connector = malloc(sizeof(struct intel_connector), M_DRM, - M_WAITOK | M_ZERO); + dp_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); if (!dp_connector) { - free(intel_dig_port, M_DRM); + kfree(intel_dig_port); return; } if (port != PORT_A) { - hdmi_connector = malloc(sizeof(struct intel_connector), - M_DRM, M_WAITOK | M_ZERO); + hdmi_connector = kzalloc(sizeof(struct intel_connector), + GFP_KERNEL); if (!hdmi_connector) { - free(dp_connector, M_DRM); - free(intel_dig_port, M_DRM); + kfree(dp_connector); + kfree(intel_dig_port); return; } } diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c index c9bd0705fe6..9f3002477f0 100644 --- a/sys/dev/pci/drm/i915/intel_display.c +++ b/sys/dev/pci/drm/i915/intel_display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_display.c,v 1.18 2013/12/01 14:20:02 kettenis Exp $ */ +/* $OpenBSD: intel_display.c,v 1.19 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006-2007 Intel Corporation * @@ -3950,7 +3950,7 @@ void intel_encoder_destroy(struct drm_encoder *encoder) struct intel_encoder *intel_encoder = to_intel_encoder(encoder); drm_encoder_cleanup(encoder); - free(intel_encoder, M_DRM); + kfree(intel_encoder); } /* Simple dpms helper for encodres with just one connector, no cloning and only @@ -6723,7 +6723,7 @@ intel_framebuffer_create(struct drm_device *dev, struct intel_framebuffer *intel_fb; int ret; - intel_fb = malloc(sizeof(*intel_fb), M_DRM, M_WAITOK | M_ZERO); + intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); if (!intel_fb) { drm_gem_object_unreference_unlocked(&obj->base); return ERR_PTR(-ENOMEM); @@ -6732,7 +6732,7 @@ intel_framebuffer_create(struct drm_device *dev, ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj); if (ret) { drm_gem_object_unreference_unlocked(&obj->base); - free(intel_fb, M_DRM); + kfree(intel_fb); return ERR_PTR(ret); } @@ -7033,7 +7033,7 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, int vtot = I915_READ(VTOTAL(cpu_transcoder)); int vsync = I915_READ(VSYNC(cpu_transcoder)); - mode = malloc(sizeof(*mode), M_DRM, M_WAITOK | M_ZERO); + mode = kzalloc(sizeof(*mode), GFP_KERNEL); if (!mode) return NULL; @@ -7169,12 +7169,12 @@ static void intel_crtc_destroy(struct drm_crtc *crtc) if (work) { task_del(systq, &work->task); - free(work, M_DRM); + kfree(work); } drm_crtc_cleanup(crtc); - free(intel_crtc, M_DRM); + kfree(intel_crtc); } static void intel_unpin_work_fn(void *arg1, void *arg2) @@ -7193,7 +7193,7 @@ static void intel_unpin_work_fn(void *arg1, void *arg2) BUG_ON(atomic_read(&to_intel_crtc(work->crtc)->unpin_work_count) == 0); atomic_dec(&to_intel_crtc(work->crtc)->unpin_work_count); - free(work, M_DRM); + kfree(work); } static void do_intel_finish_page_flip(struct drm_device *dev, @@ -7550,7 +7550,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, fb->pitches[0] != crtc->fb->pitches[0])) return -EINVAL; - work = malloc(sizeof *work, M_DRM, M_WAITOK | M_ZERO); + work = kzalloc(sizeof *work, GFP_KERNEL); if (work == NULL) return -ENOMEM; @@ -7567,7 +7567,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, mtx_enter(&dev->event_lock); if (intel_crtc->unpin_work) { mtx_leave(&dev->event_lock); - free(work, M_DRM); + kfree(work); drm_vblank_put(dev, intel_crtc->pipe); DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); @@ -7628,7 +7628,7 @@ cleanup: drm_vblank_put(dev, intel_crtc->pipe); free_work: - free(work, M_DRM); + kfree(work); return ret; } @@ -8129,9 +8129,9 @@ static void intel_set_config_free(struct intel_set_config *config) if (!config) return; - free(config->save_connector_encoders, M_DRM); - free(config->save_encoder_crtcs, M_DRM); - free(config, M_DRM); + kfree(config->save_connector_encoders); + kfree(config->save_encoder_crtcs); + kfree(config); } static int intel_set_config_save_state(struct drm_device *dev, @@ -8142,14 +8142,14 @@ static int intel_set_config_save_state(struct drm_device *dev, int count; config->save_encoder_crtcs = - malloc(dev->mode_config.num_encoder * - sizeof(struct drm_crtc *), M_DRM, M_WAITOK | M_ZERO); + kcalloc(dev->mode_config.num_encoder, + sizeof(struct drm_crtc *), GFP_KERNEL); if (!config->save_encoder_crtcs) return -ENOMEM; config->save_connector_encoders = - malloc(dev->mode_config.num_connector * - sizeof(struct drm_encoder *),M_DRM, M_WAITOK | M_ZERO); + kcalloc(dev->mode_config.num_connector, + sizeof(struct drm_encoder *), GFP_KERNEL); if (!config->save_connector_encoders) return -ENOMEM; @@ -8356,7 +8356,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set) dev = set->crtc->dev; ret = -ENOMEM; - config = malloc(sizeof(*config), M_DRM, M_WAITOK | M_ZERO); + config = kzalloc(sizeof(*config), GFP_KERNEL); if (!config) goto out_config; @@ -8455,9 +8455,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) struct intel_crtc *intel_crtc; int i; - intel_crtc = malloc(sizeof(struct intel_crtc) + - (INTELFB_CONN_LIMIT * sizeof(struct drm_connector *)), - M_DRM, M_WAITOK | M_ZERO); + intel_crtc = kzalloc(sizeof(struct intel_crtc) + (INTELFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); if (intel_crtc == NULL) return; @@ -8700,7 +8698,7 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb) drm_framebuffer_cleanup(fb); drm_gem_object_unreference_unlocked(&intel_fb->obj->base); - free(intel_fb, M_DRM); + kfree(intel_fb); } static int intel_user_framebuffer_create_handle(struct drm_framebuffer *fb, diff --git a/sys/dev/pci/drm/i915/intel_dp.c b/sys/dev/pci/drm/i915/intel_dp.c index 5b14f9dcdba..a4b02898185 100644 --- a/sys/dev/pci/drm/i915/intel_dp.c +++ b/sys/dev/pci/drm/i915/intel_dp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_dp.c,v 1.10 2013/10/30 02:11:33 dlg Exp $ */ +/* $OpenBSD: intel_dp.c,v 1.11 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2008 Intel Corporation * @@ -2293,7 +2293,7 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_controller *adapte return NULL; size = (intel_connector->edid->extensions + 1) * EDID_LENGTH; - edid = malloc(size, M_DRM, M_WAITOK); + edid = kmalloc(size, GFP_KERNEL); if (!edid) return NULL; @@ -2366,7 +2366,7 @@ intel_dp_detect(struct drm_connector *connector, bool force) edid = intel_dp_get_edid(connector, &intel_dp->adapter); if (edid) { intel_dp->has_audio = drm_detect_monitor_audio(edid); - free(edid, M_DRM); + kfree(edid); } } @@ -2412,7 +2412,7 @@ intel_dp_detect_audio(struct drm_connector *connector) edid = intel_dp_get_edid(connector, &intel_dp->adapter); if (edid) { has_audio = drm_detect_monitor_audio(edid); - free(edid, M_DRM); + kfree(edid); } return has_audio; @@ -2497,7 +2497,7 @@ intel_dp_destroy(struct drm_connector *connector) struct intel_connector *intel_connector = to_intel_connector(connector); if (!IS_ERR_OR_NULL(intel_connector->edid)) - free(intel_connector->edid, M_DRM); + kfree(intel_connector->edid); if (is_edp(intel_dp)) intel_panel_fini(&intel_connector->panel); @@ -2506,7 +2506,7 @@ intel_dp_destroy(struct drm_connector *connector) drm_sysfs_connector_remove(connector); #endif drm_connector_cleanup(connector); - free(connector, M_DRM); + kfree(connector); } void intel_dp_encoder_destroy(struct drm_encoder *encoder) @@ -2523,7 +2523,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) task_del(systq, &intel_dp->panel_vdd_task); ironlake_panel_vdd_off_sync(intel_dp); } - free(intel_dig_port, M_DRM); + kfree(intel_dig_port); } static const struct drm_encoder_helper_funcs intel_dp_helper_funcs = { @@ -2863,7 +2863,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, drm_mode_connector_update_edid_property(connector, edid); drm_edid_to_eld(connector, edid); } else { - free(edid, M_DRM); + kfree(edid); edid = ERR_PTR(-EINVAL); } } else { @@ -2914,15 +2914,13 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) struct drm_encoder *encoder; struct intel_connector *intel_connector; - intel_dig_port = malloc(sizeof(struct intel_digital_port), M_DRM, - M_WAITOK | M_ZERO); + intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL); if (!intel_dig_port) return; - intel_connector = malloc(sizeof(struct intel_connector), M_DRM, - M_WAITOK | M_ZERO); + intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); if (!intel_connector) { - free(intel_dig_port, M_DRM); + kfree(intel_dig_port); return; } diff --git a/sys/dev/pci/drm/i915/intel_dvo.c b/sys/dev/pci/drm/i915/intel_dvo.c index 5f3fa0b6076..f29e8524ea5 100644 --- a/sys/dev/pci/drm/i915/intel_dvo.c +++ b/sys/dev/pci/drm/i915/intel_dvo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_dvo.c,v 1.4 2013/08/13 10:23:51 jsg Exp $ */ +/* $OpenBSD: intel_dvo.c,v 1.5 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright 2006 Dave Airlie <airlied@linux.ie> * Copyright © 2006-2007 Intel Corporation @@ -340,7 +340,7 @@ static void intel_dvo_destroy(struct drm_connector *connector) drm_sysfs_connector_remove(connector); #endif drm_connector_cleanup(connector); - free(connector, M_DRM); + kfree(connector); } static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { @@ -369,7 +369,7 @@ static void intel_dvo_enc_destroy(struct drm_encoder *encoder) if (intel_dvo->dev.dev_ops->destroy) intel_dvo->dev.dev_ops->destroy(&intel_dvo->dev); - free(intel_dvo->panel_fixed_mode, M_DRM); + kfree(intel_dvo->panel_fixed_mode); intel_encoder_destroy(encoder); } @@ -425,14 +425,13 @@ void intel_dvo_init(struct drm_device *dev) int i; int encoder_type = DRM_MODE_ENCODER_NONE; - intel_dvo = malloc(sizeof(struct intel_dvo), M_DRM, M_WAITOK | M_ZERO); + intel_dvo = kzalloc(sizeof(struct intel_dvo), GFP_KERNEL); if (!intel_dvo) return; - intel_connector = malloc(sizeof(struct intel_connector), M_DRM, - M_WAITOK | M_ZERO); + intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); if (!intel_connector) { - free(intel_dvo, M_DRM); + kfree(intel_dvo); return; } @@ -533,6 +532,6 @@ void intel_dvo_init(struct drm_device *dev) } drm_encoder_cleanup(&intel_encoder->base); - free(intel_dvo, M_DRM); - free(intel_connector, M_DRM); + kfree(intel_dvo); + kfree(intel_connector); } diff --git a/sys/dev/pci/drm/i915/intel_fb.c b/sys/dev/pci/drm/i915/intel_fb.c index aa015959b7c..ae0bc22c56f 100644 --- a/sys/dev/pci/drm/i915/intel_fb.c +++ b/sys/dev/pci/drm/i915/intel_fb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_fb.c,v 1.7 2013/11/19 19:14:09 kettenis Exp $ */ +/* $OpenBSD: intel_fb.c,v 1.8 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2007 David Airlie * @@ -248,8 +248,9 @@ int intel_fbdev_init(struct drm_device *dev) drm_i915_private_t *dev_priv = dev->dev_private; int ret; - ifbdev = malloc(sizeof(struct intel_fbdev), M_DRM, - M_WAITOK | M_ZERO); + ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); + if (!ifbdev) + return -ENOMEM; dev_priv->fbdev = ifbdev; ifbdev->helper.funcs = &intel_fb_helper_funcs; @@ -258,7 +259,7 @@ int intel_fbdev_init(struct drm_device *dev) dev_priv->num_pipe, INTELFB_CONN_LIMIT); if (ret) { - free(ifbdev, M_DRM); + kfree(ifbdev); return ret; } @@ -274,7 +275,7 @@ void intel_fbdev_fini(struct drm_device *dev) return; intel_fbdev_destroy(dev, dev_priv->fbdev); - free(dev_priv->fbdev, M_DRM); + kfree(dev_priv->fbdev); dev_priv->fbdev = NULL; } diff --git a/sys/dev/pci/drm/i915/intel_hdmi.c b/sys/dev/pci/drm/i915/intel_hdmi.c index d5c48175971..da65d288164 100644 --- a/sys/dev/pci/drm/i915/intel_hdmi.c +++ b/sys/dev/pci/drm/i915/intel_hdmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_hdmi.c,v 1.4 2013/09/06 08:24:07 mpi Exp $ */ +/* $OpenBSD: intel_hdmi.c,v 1.5 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright 2006 Dave Airlie <airlied@linux.ie> * Copyright © 2006-2009 Intel Corporation @@ -1042,15 +1042,13 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port) struct drm_encoder *encoder; struct intel_connector *intel_connector; - intel_dig_port = malloc(sizeof(struct intel_digital_port), M_DRM, - M_WAITOK | M_ZERO); + intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL); if (!intel_dig_port) return; - intel_connector = malloc(sizeof(struct intel_connector), M_DRM, - M_WAITOK | M_ZERO); + intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); if (!intel_connector) { - free(intel_dig_port, M_DRM); + kfree(intel_dig_port); return; } diff --git a/sys/dev/pci/drm/i915/intel_lvds.c b/sys/dev/pci/drm/i915/intel_lvds.c index b5e5350cfa0..b7689ae8f05 100644 --- a/sys/dev/pci/drm/i915/intel_lvds.c +++ b/sys/dev/pci/drm/i915/intel_lvds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_lvds.c,v 1.6 2013/12/01 14:28:40 kettenis Exp $ */ +/* $OpenBSD: intel_lvds.c,v 1.7 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006-2007 Intel Corporation * Copyright (c) 2006 Dave Airlie <airlied@linux.ie> @@ -568,7 +568,7 @@ static void intel_lvds_destroy(struct drm_connector *connector) #endif if (!IS_ERR_OR_NULL(lvds_connector->base.edid)) - free(lvds_connector->base.edid, M_DRM); + kfree(lvds_connector->base.edid); intel_panel_fini(&lvds_connector->base.panel); @@ -576,7 +576,7 @@ static void intel_lvds_destroy(struct drm_connector *connector) drm_sysfs_connector_remove(connector); #endif drm_connector_cleanup(connector); - free(connector, M_DRM); + kfree(connector); } static int intel_lvds_set_property(struct drm_connector *connector, @@ -976,15 +976,13 @@ bool intel_lvds_init(struct drm_device *dev) } } - lvds_encoder = malloc(sizeof(struct intel_lvds_encoder), M_DRM, - M_WAITOK | M_ZERO); + lvds_encoder = kzalloc(sizeof(struct intel_lvds_encoder), GFP_KERNEL); if (!lvds_encoder) return false; - lvds_connector = malloc(sizeof(struct intel_lvds_connector), M_DRM, - M_WAITOK | M_ZERO); + lvds_connector = kzalloc(sizeof(struct intel_lvds_connector), GFP_KERNEL); if (!lvds_connector) { - free(lvds_encoder, M_DRM); + kfree(lvds_encoder); return false; } @@ -1052,7 +1050,7 @@ bool intel_lvds_init(struct drm_device *dev) drm_mode_connector_update_edid_property(connector, edid); } else { - free(edid, M_DRM); + kfree(edid); edid = ERR_PTR(-EINVAL); } } else { @@ -1157,7 +1155,7 @@ failed: drm_encoder_cleanup(encoder); if (fixed_mode) drm_mode_destroy(dev, fixed_mode); - free(lvds_encoder, M_DRM); - free(lvds_connector, M_DRM); + kfree(lvds_encoder); + kfree(lvds_connector); return false; } diff --git a/sys/dev/pci/drm/i915/intel_overlay.c b/sys/dev/pci/drm/i915/intel_overlay.c index 197013fd58f..b5299404a20 100644 --- a/sys/dev/pci/drm/i915/intel_overlay.c +++ b/sys/dev/pci/drm/i915/intel_overlay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_overlay.c,v 1.7 2013/12/05 21:27:28 kettenis Exp $ */ +/* $OpenBSD: intel_overlay.c,v 1.8 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2009 * @@ -1080,8 +1080,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data, return ret; } - params = malloc(sizeof(struct put_image_params), M_DRM, - M_WAITOK | M_ZERO); + params = kmalloc(sizeof(struct put_image_params), GFP_KERNEL); if (!params) return -ENOMEM; @@ -1184,7 +1183,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data, DRM_UNLOCK(); rw_exit_write(&dev->mode_config.rwl); - free(params, M_DRM); + kfree(params); return 0; @@ -1193,7 +1192,7 @@ out_unlock: rw_exit_write(&dev->mode_config.rwl); drm_gem_object_unreference_unlocked(&new_bo->base); out_free: - free(params, M_DRM); + kfree(params); return ret; } @@ -1347,8 +1346,7 @@ void intel_setup_overlay(struct drm_device *dev) if (!HAS_OVERLAY(dev)) return; - overlay = malloc(sizeof(struct intel_overlay), M_DRM, - M_WAITOK | M_ZERO); + overlay = kzalloc(sizeof(struct intel_overlay), GFP_KERNEL); if (!overlay) return; @@ -1415,7 +1413,7 @@ out_free_bo: drm_gem_object_unreference(®_bo->base); out_free: DRM_UNLOCK(); - free(overlay, M_DRM); + kfree(overlay); return; } @@ -1432,7 +1430,7 @@ void intel_cleanup_overlay(struct drm_device *dev) BUG_ON(dev_priv->overlay->active); drm_gem_object_unreference_unlocked(&dev_priv->overlay->reg_bo->base); - free(dev_priv->overlay, M_DRM); + kfree(dev_priv->overlay); } #ifdef CONFIG_DEBUG_FS @@ -1503,7 +1501,7 @@ intel_overlay_capture_error_state(struct drm_device *dev) return error; err: - free(error, M_DRM); + kfree(error); return NULL; } diff --git a/sys/dev/pci/drm/i915/intel_pm.c b/sys/dev/pci/drm/i915/intel_pm.c index abff71d3694..f7faf111efa 100644 --- a/sys/dev/pci/drm/i915/intel_pm.c +++ b/sys/dev/pci/drm/i915/intel_pm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_pm.c,v 1.13 2013/11/11 02:59:01 jsg Exp $ */ +/* $OpenBSD: intel_pm.c,v 1.14 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2012 Intel Corporation * @@ -299,7 +299,7 @@ static void intel_fbc_work_fn(void *arg1, void *arg2) } DRM_UNLOCK(); - free(work, M_DRM); + kfree(work); } static void @@ -324,7 +324,7 @@ static void intel_cancel_fbc_work(struct drm_i915_private *dev_priv) timeout_del(&dev_priv->fbc_work->to); if (task_del(systq, &dev_priv->fbc_work->task)) /* tasklet was killed before being run, clean up */ - free(dev_priv->fbc_work, M_DRM); + kfree(dev_priv->fbc_work); /* Mark the work as no longer wanted so that if it does * wake-up (because the work was already running and waiting @@ -345,7 +345,7 @@ void intel_enable_fbc(struct drm_crtc *crtc, unsigned long interval) intel_cancel_fbc_work(dev_priv); - work = malloc(sizeof *work, M_DRM, M_WAITOK | M_ZERO); + work = kzalloc(sizeof *work, GFP_KERNEL); if (work == NULL) { dev_priv->display.enable_fbc(crtc, interval); return; diff --git a/sys/dev/pci/drm/i915/intel_ringbuffer.c b/sys/dev/pci/drm/i915/intel_ringbuffer.c index 4d0da2268a4..dab3e77ba1b 100644 --- a/sys/dev/pci/drm/i915/intel_ringbuffer.c +++ b/sys/dev/pci/drm/i915/intel_ringbuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_ringbuffer.c,v 1.14 2013/12/01 11:47:13 kettenis Exp $ */ +/* $OpenBSD: intel_ringbuffer.c,v 1.15 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2008-2010 Intel Corporation * @@ -454,7 +454,7 @@ init_pipe_control(struct intel_ring_buffer *ring) if (ring->private) return 0; - pc = malloc(sizeof(*pc), M_DRM, M_WAITOK); + pc = kmalloc(sizeof(*pc), GFP_KERNEL); if (!pc) return -ENOMEM; @@ -492,7 +492,7 @@ err_unpin: err_unref: drm_gem_object_unreference(&obj->base); err: - free(pc, M_DRM); + kfree(pc); return ret; } @@ -512,7 +512,7 @@ cleanup_pipe_control(struct intel_ring_buffer *ring) i915_gem_object_unpin(obj); drm_gem_object_unreference(&obj->base); - free(pc, M_DRM); + kfree(pc); ring->private = NULL; } diff --git a/sys/dev/pci/drm/i915/intel_sdvo.c b/sys/dev/pci/drm/i915/intel_sdvo.c index bd7b8e01d65..556515a7175 100644 --- a/sys/dev/pci/drm/i915/intel_sdvo.c +++ b/sys/dev/pci/drm/i915/intel_sdvo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_sdvo.c,v 1.11 2013/08/13 10:23:52 jsg Exp $ */ +/* $OpenBSD: intel_sdvo.c,v 1.12 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright 2006 Dave Airlie <airlied@linux.ie> * Copyright © 2006-2007 Intel Corporation @@ -457,15 +457,13 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd, int i, ret = true, x; /* Would be simpler to allocate both in one go ? */ - buf = (u8 *)malloc(args_len * 2 + 2, M_DRM, - M_WAITOK | M_ZERO); + buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL); if (!buf) return false; - msgs = malloc((args_len + 3) * sizeof(*msgs), M_DRM, - M_WAITOK | M_ZERO); + msgs = kcalloc(args_len + 3, sizeof(*msgs), GFP_KERNEL); if (!msgs) { - free(buf, M_DRM); + kfree(buf); return false; } @@ -513,8 +511,8 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd, out: iic_release_bus(intel_sdvo->i2c, 0); - free(msgs, M_DRM); - free(buf, M_DRM); + kfree(msgs); + kfree(buf); return ret; } @@ -1544,7 +1542,7 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector) } } else status = connector_status_disconnected; - free(edid, M_DRM); + kfree(edid); } if (status == connector_status_connected) { @@ -1611,7 +1609,7 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) else ret = connector_status_disconnected; - free(edid, M_DRM); + kfree(edid); } else ret = connector_status_connected; } @@ -1656,7 +1654,7 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) drm_add_edid_modes(connector, edid); } - free(edid, M_DRM); + kfree(edid); } } @@ -1871,7 +1869,7 @@ static void intel_sdvo_destroy(struct drm_connector *connector) drm_sysfs_connector_remove(connector); #endif drm_connector_cleanup(connector); - free(intel_sdvo_connector, M_DRM); + kfree(intel_sdvo_connector); } static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector) @@ -1886,7 +1884,7 @@ static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector) edid = intel_sdvo_get_edid(connector); if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL) has_audio = drm_detect_monitor_audio(edid); - free(edid, M_DRM); + kfree(edid); return has_audio; } @@ -2254,8 +2252,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) struct intel_connector *intel_connector; struct intel_sdvo_connector *intel_sdvo_connector; - intel_sdvo_connector = malloc(sizeof(struct intel_sdvo_connector), - M_DRM, M_WAITOK | M_ZERO); + intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); if (!intel_sdvo_connector) return false; @@ -2304,8 +2301,7 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type) struct intel_connector *intel_connector; struct intel_sdvo_connector *intel_sdvo_connector; - intel_sdvo_connector = malloc(sizeof(struct intel_sdvo_connector), - M_DRM, M_WAITOK | M_ZERO); + intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); if (!intel_sdvo_connector) return false; @@ -2343,8 +2339,7 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device) struct intel_connector *intel_connector; struct intel_sdvo_connector *intel_sdvo_connector; - intel_sdvo_connector = malloc(sizeof(struct intel_sdvo_connector), - M_DRM, M_WAITOK | M_ZERO); + intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); if (!intel_sdvo_connector) return false; @@ -2375,8 +2370,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) struct intel_connector *intel_connector; struct intel_sdvo_connector *intel_sdvo_connector; - intel_sdvo_connector = malloc(sizeof(struct intel_sdvo_connector), - M_DRM, M_WAITOK | M_ZERO); + intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); if (!intel_sdvo_connector) return false; @@ -2765,8 +2759,7 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) struct intel_sdvo *intel_sdvo; u32 hotplug_mask; int i; - intel_sdvo = malloc(sizeof(struct intel_sdvo), M_DRM, - M_WAITOK | M_ZERO); + intel_sdvo = kzalloc(sizeof(struct intel_sdvo), GFP_KERNEL); if (!intel_sdvo) return false; @@ -2878,7 +2871,7 @@ err: #endif err_i2c_bus: intel_sdvo_unselect_i2c_bus(intel_sdvo); - free(intel_sdvo, M_DRM); + kfree(intel_sdvo); return false; } diff --git a/sys/dev/pci/drm/i915/intel_sprite.c b/sys/dev/pci/drm/i915/intel_sprite.c index 4cd8623a961..e483356ea4c 100644 --- a/sys/dev/pci/drm/i915/intel_sprite.c +++ b/sys/dev/pci/drm/i915/intel_sprite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_sprite.c,v 1.3 2013/08/13 10:23:52 jsg Exp $ */ +/* $OpenBSD: intel_sprite.c,v 1.4 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2011 Intel Corporation * @@ -575,7 +575,7 @@ static void intel_destroy_plane(struct drm_plane *plane) struct intel_plane *intel_plane = to_intel_plane(plane); intel_disable_plane(plane); drm_plane_cleanup(plane); - free(intel_plane, M_DRM); + kfree(intel_plane); } int intel_sprite_set_colorkey(struct drm_device *dev, void *data, @@ -675,8 +675,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) if (INTEL_INFO(dev)->gen < 5) return -ENODEV; - intel_plane = malloc(sizeof(struct intel_plane), M_DRM, - M_WAITOK | M_ZERO); + intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL); if (!intel_plane) return -ENOMEM; @@ -715,7 +714,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) break; default: - free(intel_plane, M_DRM); + kfree(intel_plane); return -ENODEV; } @@ -726,7 +725,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) plane_formats, num_plane_formats, false); if (ret) - free(intel_plane, M_DRM); + kfree(intel_plane); return ret; } diff --git a/sys/dev/pci/drm/i915/intel_tv.c b/sys/dev/pci/drm/i915/intel_tv.c index 375b716ccaf..4279fbfd88a 100644 --- a/sys/dev/pci/drm/i915/intel_tv.c +++ b/sys/dev/pci/drm/i915/intel_tv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_tv.c,v 1.3 2013/08/13 10:23:52 jsg Exp $ */ +/* $OpenBSD: intel_tv.c,v 1.4 2014/01/21 08:57:22 kettenis Exp $ */ /* * Copyright © 2006-2008 Intel Corporation * Jesse Barnes <jesse.barnes@intel.com> @@ -1431,7 +1431,7 @@ intel_tv_destroy(struct drm_connector *connector) drm_sysfs_connector_remove(connector); #endif drm_connector_cleanup(connector); - free(connector, M_DRM); + kfree(connector); } @@ -1593,16 +1593,14 @@ intel_tv_init(struct drm_device *dev) (tv_dac_off & TVDAC_STATE_CHG_EN) != 0) return; - intel_tv = malloc(sizeof(struct intel_tv), M_DRM, - M_WAITOK | M_ZERO); + intel_tv = kzalloc(sizeof(struct intel_tv), GFP_KERNEL); if (!intel_tv) { return; } - intel_connector = malloc(sizeof(struct intel_connector), M_DRM, - M_WAITOK | M_ZERO); + intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); if (!intel_connector) { - free(intel_tv, M_DRM); + kfree(intel_tv); return; } |