summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-02-09 11:03:32 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-02-09 11:03:32 +0000
commit85368cb559d2ef493c9cba6a38a76173f18a2aba (patch)
tree4b3515f658644356ad5a62b791a75672fa76773b
parent247eb21896c54c2feef7cf901f51e02ce0c2ff82 (diff)
use linux style memory allocations in radeon
-rw-r--r--sys/dev/pci/drm/radeon/atom.c22
-rw-r--r--sys/dev/pci/drm/radeon/atombios_encoders.c20
-rw-r--r--sys/dev/pci/drm/radeon/evergreen.c5
-rw-r--r--sys/dev/pci/drm/radeon/evergreen_cs.c12
-rw-r--r--sys/dev/pci/drm/radeon/ni.c5
-rw-r--r--sys/dev/pci/drm/radeon/r100.c7
-rw-r--r--sys/dev/pci/drm/radeon/r300.c7
-rw-r--r--sys/dev/pci/drm/radeon/r420.c5
-rw-r--r--sys/dev/pci/drm/radeon/r600.c5
-rw-r--r--sys/dev/pci/drm/radeon/r600_cs.c28
-rw-r--r--sys/dev/pci/drm/radeon/radeon_acpi.c14
-rw-r--r--sys/dev/pci/drm/radeon/radeon_atombios.c48
-rw-r--r--sys/dev/pci/drm/radeon/radeon_bios.c16
-rw-r--r--sys/dev/pci/drm/radeon/radeon_combios.c29
-rw-r--r--sys/dev/pci/drm/radeon/radeon_connectors.c51
-rw-r--r--sys/dev/pci/drm/radeon/radeon_cs.c28
-rw-r--r--sys/dev/pci/drm/radeon/radeon_device.c13
-rw-r--r--sys/dev/pci/drm/radeon/radeon_display.c53
-rw-r--r--sys/dev/pci/drm/radeon/radeon_fb.c10
-rw-r--r--sys/dev/pci/drm/radeon/radeon_fence.c6
-rw-r--r--sys/dev/pci/drm/radeon/radeon_gart.c26
-rw-r--r--sys/dev/pci/drm/radeon/radeon_i2c.c12
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c8
-rw-r--r--sys/dev/pci/drm/radeon/radeon_legacy_encoders.c22
-rw-r--r--sys/dev/pci/drm/radeon/radeon_pm.c4
-rw-r--r--sys/dev/pci/drm/radeon/radeon_prime.c4
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ring.c6
-rw-r--r--sys/dev/pci/drm/radeon/radeon_sa.c8
-rw-r--r--sys/dev/pci/drm/radeon/radeon_semaphore.c8
-rw-r--r--sys/dev/pci/drm/radeon/radeon_test.c6
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ttm.c8
-rw-r--r--sys/dev/pci/drm/radeon/rs400.c5
-rw-r--r--sys/dev/pci/drm/radeon/rs600.c5
-rw-r--r--sys/dev/pci/drm/radeon/rs690.c5
-rw-r--r--sys/dev/pci/drm/radeon/rv515.c5
-rw-r--r--sys/dev/pci/drm/radeon/rv770.c5
-rw-r--r--sys/dev/pci/drm/radeon/si.c5
37 files changed, 239 insertions, 287 deletions
diff --git a/sys/dev/pci/drm/radeon/atom.c b/sys/dev/pci/drm/radeon/atom.c
index 31856f8e881..7bf79957c53 100644
--- a/sys/dev/pci/drm/radeon/atom.c
+++ b/sys/dev/pci/drm/radeon/atom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atom.c,v 1.2 2014/01/23 00:57:10 jsg Exp $ */
+/* $OpenBSD: atom.c,v 1.3 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
*
@@ -1183,7 +1183,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
ectx.abort = false;
ectx.last_jump = 0;
if (ws)
- ectx.ws = malloc(4 * ws, M_DRM, M_WAITOK | M_ZERO);
+ ectx.ws = kzalloc(4 * ws, GFP_KERNEL);
else
ectx.ws = NULL;
@@ -1215,7 +1215,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
free:
if (ws)
- free(ectx.ws, M_DRM);
+ kfree(ectx.ws);
return ret;
}
@@ -1244,7 +1244,7 @@ static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
static void atom_index_iio(struct atom_context *ctx, int base)
{
- ctx->iio = malloc(2 * 256, M_DRM, M_WAITOK | M_ZERO);
+ ctx->iio = kzalloc(2 * 256, GFP_KERNEL);
while (CU8(base) == ATOM_IIO_START) {
ctx->iio[CU8(base + 1)] = base + 2;
base += 2;
@@ -1258,7 +1258,7 @@ struct atom_context *atom_parse(struct card_info *card, void *bios)
{
int base;
struct atom_context *ctx =
- malloc(sizeof(struct atom_context), M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct atom_context), GFP_KERNEL);
#ifdef DRMDEBUG
char *str;
char name[512];
@@ -1273,14 +1273,14 @@ struct atom_context *atom_parse(struct card_info *card, void *bios)
if (CU16(0) != ATOM_BIOS_MAGIC) {
DRM_INFO( "Invalid BIOS magic.\n");
- free(ctx, M_DRM);
+ kfree(ctx);
return NULL;
}
if (strncmp
(CSTR(ATOM_ATI_MAGIC_PTR), ATOM_ATI_MAGIC,
strlen(ATOM_ATI_MAGIC))) {
DRM_INFO( "Invalid ATI magic.\n");
- free(ctx, M_DRM);
+ kfree(ctx);
return NULL;
}
@@ -1289,7 +1289,7 @@ struct atom_context *atom_parse(struct card_info *card, void *bios)
(CSTR(base + ATOM_ROM_MAGIC_PTR), ATOM_ROM_MAGIC,
strlen(ATOM_ROM_MAGIC))) {
DRM_INFO( "Invalid ATOM magic.\n");
- free(ctx, M_DRM);
+ kfree(ctx);
return NULL;
}
@@ -1347,8 +1347,8 @@ int atom_asic_init(struct atom_context *ctx)
void atom_destroy(struct atom_context *ctx)
{
if (ctx->iio)
- free(ctx->iio, M_DRM);
- free(ctx, M_DRM);
+ kfree(ctx->iio);
+ kfree(ctx);
}
bool atom_parse_data_header(struct atom_context *ctx, int index,
@@ -1409,7 +1409,7 @@ int atom_allocate_fb_scratch(struct atom_context *ctx)
if (usage_bytes == 0)
usage_bytes = 20 * 1024;
/* allocate some scratch memory */
- ctx->scratch = malloc(usage_bytes, M_DRM, M_WAITOK | M_ZERO);
+ ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL);
if (!ctx->scratch)
return -ENOMEM;
ctx->scratch_size_bytes = usage_bytes;
diff --git a/sys/dev/pci/drm/radeon/atombios_encoders.c b/sys/dev/pci/drm/radeon/atombios_encoders.c
index b1ea6d55f31..d51283e5f2a 100644
--- a/sys/dev/pci/drm/radeon/atombios_encoders.c
+++ b/sys/dev/pci/drm/radeon/atombios_encoders.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atombios_encoders.c,v 1.3 2014/01/23 00:46:16 jsg Exp $ */
+/* $OpenBSD: atombios_encoders.c,v 1.4 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2007-11 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -201,7 +201,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
return;
- pdata = malloc(sizeof(struct radeon_backlight_privdata), M_DRM, M_WAITOK);
+ pdata = kmalloc(sizeof(struct radeon_backlight_privdata), GFP_KERNEL);
if (!pdata) {
DRM_ERROR("Memory allocation failed\n");
goto error;
@@ -235,7 +235,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
return;
error:
- free(pdata, M_DRM);
+ kfree(pdata);
return;
}
@@ -264,7 +264,7 @@ static void radeon_atom_backlight_exit(struct radeon_encoder *radeon_encoder)
pdata = bl_get_data(bd);
backlight_device_unregister(bd);
- free(pdata, M_DRM);
+ kfree(pdata);
DRM_INFO("radeon atom LVDS backlight unloaded\n");
}
@@ -2506,9 +2506,9 @@ void radeon_enc_destroy(struct drm_encoder *encoder)
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
radeon_atom_backlight_exit(radeon_encoder);
- free(radeon_encoder->enc_priv, M_DRM);
+ kfree(radeon_encoder->enc_priv);
drm_encoder_cleanup(encoder);
- free(radeon_encoder, M_DRM);
+ kfree(radeon_encoder);
}
static const struct drm_encoder_funcs radeon_atom_enc_funcs = {
@@ -2520,8 +2520,7 @@ radeon_atombios_set_dac_info(struct radeon_encoder *radeon_encoder)
{
struct drm_device *dev = radeon_encoder->base.dev;
struct radeon_device *rdev = dev->dev_private;
- struct radeon_encoder_atom_dac *dac = malloc(sizeof(struct radeon_encoder_atom_dac),
- M_DRM, M_WAITOK | M_ZERO);
+ struct radeon_encoder_atom_dac *dac = kzalloc(sizeof(struct radeon_encoder_atom_dac), GFP_KERNEL);
if (!dac)
return NULL;
@@ -2534,8 +2533,7 @@ static struct radeon_encoder_atom_dig *
radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder)
{
int encoder_enum = (radeon_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
- struct radeon_encoder_atom_dig *dig = malloc(sizeof(struct radeon_encoder_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ struct radeon_encoder_atom_dig *dig = kzalloc(sizeof(struct radeon_encoder_atom_dig), GFP_KERNEL);
if (!dig)
return NULL;
@@ -2573,7 +2571,7 @@ radeon_add_atom_encoder(struct drm_device *dev,
}
/* add a new one */
- radeon_encoder = malloc(sizeof(struct radeon_encoder), M_DRM, M_WAITOK | M_ZERO);
+ radeon_encoder = kzalloc(sizeof(struct radeon_encoder), GFP_KERNEL);
if (!radeon_encoder)
return;
diff --git a/sys/dev/pci/drm/radeon/evergreen.c b/sys/dev/pci/drm/radeon/evergreen.c
index 4a64d2dbe7c..53aafe546fe 100644
--- a/sys/dev/pci/drm/radeon/evergreen.c
+++ b/sys/dev/pci/drm/radeon/evergreen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evergreen.c,v 1.9 2014/01/24 05:43:46 jsg Exp $ */
+/* $OpenBSD: evergreen.c,v 1.10 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2010 Advanced Micro Devices, Inc.
*
@@ -3813,8 +3813,7 @@ void evergreen_fini(struct radeon_device *rdev)
radeon_agp_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/evergreen_cs.c b/sys/dev/pci/drm/radeon/evergreen_cs.c
index 737e8255857..5a3cdb64979 100644
--- a/sys/dev/pci/drm/radeon/evergreen_cs.c
+++ b/sys/dev/pci/drm/radeon/evergreen_cs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evergreen_cs.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: evergreen_cs.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2010 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -2760,7 +2760,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p)
if (p->track == NULL) {
/* initialize tracker, we are in kms */
- track = malloc(sizeof(*track), M_DRM, M_WAITOK | M_ZERO);
+ track = kzalloc(sizeof(*track), GFP_KERNEL);
if (track == NULL)
return -ENOMEM;
evergreen_cs_track_init(track);
@@ -2826,7 +2826,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p)
do {
r = evergreen_cs_packet_parse(p, &pkt, p->idx);
if (r) {
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return r;
}
@@ -2842,12 +2842,12 @@ int evergreen_cs_parse(struct radeon_cs_parser *p)
break;
default:
DRM_ERROR("Unknown packet type %d !\n", pkt.type);
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return -EINVAL;
}
if (r) {
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return r;
}
@@ -2858,7 +2858,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p)
mdelay(1);
}
#endif
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return 0;
}
diff --git a/sys/dev/pci/drm/radeon/ni.c b/sys/dev/pci/drm/radeon/ni.c
index f9f866fa042..12322df7472 100644
--- a/sys/dev/pci/drm/radeon/ni.c
+++ b/sys/dev/pci/drm/radeon/ni.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ni.c,v 1.3 2014/01/24 05:17:06 jsg Exp $ */
+/* $OpenBSD: ni.c,v 1.4 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2010 Advanced Micro Devices, Inc.
*
@@ -1832,8 +1832,7 @@ void cayman_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/r100.c b/sys/dev/pci/drm/radeon/r100.c
index 9a6897a223e..6c9c2f9e1dc 100644
--- a/sys/dev/pci/drm/radeon/r100.c
+++ b/sys/dev/pci/drm/radeon/r100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: r100.c,v 1.3 2013/10/30 02:11:33 dlg Exp $ */
+/* $OpenBSD: r100.c,v 1.4 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -2133,7 +2133,7 @@ int r100_cs_parse(struct radeon_cs_parser *p)
struct r100_cs_track *track;
int r;
- track = malloc(sizeof(*track), M_DRM, M_WAITOK | M_ZERO);
+ track = kzalloc(sizeof(*track), GFP_KERNEL);
if (!track)
return -ENOMEM;
r100_cs_track_clear(p->rdev, track);
@@ -4070,8 +4070,7 @@ void r100_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/r300.c b/sys/dev/pci/drm/radeon/r300.c
index 1760d542693..3b033458f91 100644
--- a/sys/dev/pci/drm/radeon/r300.c
+++ b/sys/dev/pci/drm/radeon/r300.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: r300.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: r300.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -1258,7 +1258,7 @@ int r300_cs_parse(struct radeon_cs_parser *p)
struct r100_cs_track *track;
int r;
- track = malloc(sizeof(*track), M_DRM, M_WAITOK | M_ZERO);
+ track = kzalloc(sizeof(*track), GFP_KERNEL);
if (track == NULL)
return -ENOMEM;
r100_cs_track_clear(p->rdev, track);
@@ -1466,8 +1466,7 @@ void r300_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/r420.c b/sys/dev/pci/drm/radeon/r420.c
index 4a61223a97d..5c03dad5b87 100644
--- a/sys/dev/pci/drm/radeon/r420.c
+++ b/sys/dev/pci/drm/radeon/r420.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: r420.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: r420.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -353,8 +353,7 @@ void r420_fini(struct radeon_device *rdev)
} else {
radeon_combios_fini(rdev);
}
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/r600.c b/sys/dev/pci/drm/radeon/r600.c
index 130fb0afb37..d17d4867341 100644
--- a/sys/dev/pci/drm/radeon/r600.c
+++ b/sys/dev/pci/drm/radeon/r600.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: r600.c,v 1.6 2013/10/30 02:11:33 dlg Exp $ */
+/* $OpenBSD: r600.c,v 1.7 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -3019,8 +3019,7 @@ void r600_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/r600_cs.c b/sys/dev/pci/drm/radeon/r600_cs.c
index 867f91a3195..18b3a2fe2f9 100644
--- a/sys/dev/pci/drm/radeon/r600_cs.c
+++ b/sys/dev/pci/drm/radeon/r600_cs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: r600_cs.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: r600_cs.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -2401,7 +2401,7 @@ int r600_cs_parse(struct radeon_cs_parser *p)
if (p->track == NULL) {
/* initialize tracker, we are in kms */
- track = malloc(sizeof(*track), M_DRM, M_WAITOK | M_ZERO);
+ track = kzalloc(sizeof(*track), GFP_KERNEL);
if (track == NULL)
return -ENOMEM;
r600_cs_track_init(track);
@@ -2419,7 +2419,7 @@ int r600_cs_parse(struct radeon_cs_parser *p)
do {
r = r600_cs_packet_parse(p, &pkt, p->idx);
if (r) {
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return r;
}
@@ -2435,12 +2435,12 @@ int r600_cs_parse(struct radeon_cs_parser *p)
break;
default:
DRM_ERROR("Unknown packet type %d !\n", pkt.type);
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return -EINVAL;
}
if (r) {
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return r;
}
@@ -2451,7 +2451,7 @@ int r600_cs_parse(struct radeon_cs_parser *p)
mdelay(1);
}
#endif
- free(p->track, M_DRM);
+ kfree(p->track);
p->track = NULL;
return 0;
}
@@ -2463,7 +2463,7 @@ static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p)
if (p->chunk_relocs_idx == -1) {
return 0;
}
- p->relocs = malloc(sizeof(struct radeon_cs_reloc), M_DRM, M_WAITOK | M_ZERO);
+ p->relocs = kzalloc(sizeof(struct radeon_cs_reloc), GFP_KERNEL);
if (p->relocs == NULL) {
return -ENOMEM;
}
@@ -2482,16 +2482,16 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
{
unsigned i;
- free(parser->relocs, M_DRM);
+ kfree(parser->relocs);
for (i = 0; i < parser->nchunks; i++) {
- free(parser->chunks[i].kdata, M_DRM);
+ kfree(parser->chunks[i].kdata);
if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) {
- free(parser->chunks[i].kpage[0], M_DRM);
- free(parser->chunks[i].kpage[1], M_DRM);
+ kfree(parser->chunks[i].kpage[0]);
+ kfree(parser->chunks[i].kpage[1]);
}
}
- free(parser->chunks, M_DRM);
- free(parser->chunks_array, M_DRM);
+ kfree(parser->chunks);
+ kfree(parser->chunks_array);
}
int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
@@ -2503,7 +2503,7 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
int r;
/* initialize tracker */
- track = malloc(sizeof(*track), M_DRM, M_WAITOK | M_ZERO);
+ track = kzalloc(sizeof(*track), GFP_KERNEL);
if (track == NULL)
return -ENOMEM;
r600_cs_track_init(track);
diff --git a/sys/dev/pci/drm/radeon/radeon_acpi.c b/sys/dev/pci/drm/radeon/radeon_acpi.c
index 850e62d73c8..9a5801940f2 100644
--- a/sys/dev/pci/drm/radeon/radeon_acpi.c
+++ b/sys/dev/pci/drm/radeon/radeon_acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_acpi.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_acpi.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2012 Advanced Micro Devices, Inc.
*
@@ -111,7 +111,7 @@ static union acpi_object *radeon_atif_call(acpi_handle handle, int function,
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
acpi_format_exception(status));
- free(buffer.pointer, M_DRM);
+ kfree(buffer.pointer);
return NULL;
}
@@ -207,7 +207,7 @@ static int radeon_atif_verify_interface(acpi_handle handle,
radeon_atif_parse_functions(&atif->functions, output.function_bits);
out:
- free(info, M_DRM);
+ kfree(info);
return err;
}
@@ -270,7 +270,7 @@ out:
DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
(n->enabled ? "enabled" : "disabled"),
n->command_code);
- free(info, M_DRM);
+ kfree(info);
return err;
}
@@ -310,7 +310,7 @@ static int radeon_atif_get_sbios_requests(acpi_handle handle,
count = hweight32(req->pending);
out:
- free(info, M_DRM);
+ kfree(info);
return count;
}
@@ -426,7 +426,7 @@ static union acpi_object *radeon_atcs_call(acpi_handle handle, int function,
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
DRM_DEBUG_DRIVER("failed to evaluate ATCS got %s\n",
acpi_format_exception(status));
- free(buffer.pointer, M_DRM);
+ kfree(buffer.pointer);
return NULL;
}
@@ -492,7 +492,7 @@ static int radeon_atcs_verify_interface(acpi_handle handle,
radeon_atcs_parse_functions(&atcs->functions, output.function_bits);
out:
- free(info, M_DRM);
+ kfree(info);
return err;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_atombios.c b/sys/dev/pci/drm/radeon/radeon_atombios.c
index b25a69b86df..09fa40f4418 100644
--- a/sys/dev/pci/drm/radeon/radeon_atombios.c
+++ b/sys/dev/pci/drm/radeon/radeon_atombios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_atombios.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_atombios.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -934,13 +934,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
router.ddc_valid = false;
router.cd_valid = false;
- bios_connectors = malloc(bc_size, M_DRM, M_WAITOK | M_ZERO);
+ bios_connectors = kzalloc(bc_size, GFP_KERNEL);
if (!bios_connectors)
return false;
if (!atom_parse_data_header(ctx, index, &size, &frev, &crev,
&data_offset)) {
- free(bios_connectors, M_DRM);
+ kfree(bios_connectors);
return false;
}
@@ -1112,7 +1112,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
radeon_link_encoder_connector(dev);
- free(bios_connectors, M_DRM);
+ kfree(bios_connectors);
return true;
}
@@ -1561,7 +1561,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
lvds_info =
(union lvds_info *)(mode_info->atom_context->bios + data_offset);
lvds =
- malloc(sizeof(struct radeon_encoder_atom_dig), M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct radeon_encoder_atom_dig), GFP_KERNEL);
if (!lvds)
return NULL;
@@ -1648,7 +1648,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
struct edid *edid;
int edid_size =
max((int)EDID_LENGTH, (int)fake_edid_record->ucFakeEDIDLength);
- edid = malloc(edid_size, M_DRM, M_WAITOK);
+ edid = kmalloc(edid_size, GFP_KERNEL);
if (edid) {
memcpy((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0],
fake_edid_record->ucFakeEDIDLength);
@@ -1657,7 +1657,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
rdev->mode_info.bios_hardcoded_edid = edid;
rdev->mode_info.bios_hardcoded_edid_size = edid_size;
} else
- free(edid, M_DRM);
+ kfree(edid);
}
}
record += sizeof(ATOM_FAKE_EDID_PATCH_RECORD);
@@ -1699,8 +1699,7 @@ radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder)
dac_info = (struct _COMPASSIONATE_DATA *)
(mode_info->atom_context->bios + data_offset);
- p_dac = malloc(sizeof(struct radeon_encoder_primary_dac),
- M_DRM, M_WAITOK | M_ZERO);
+ p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), GFP_KERNEL);
if (!p_dac)
return NULL;
@@ -1885,8 +1884,7 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
dac_info = (struct _COMPASSIONATE_DATA *)
(mode_info->atom_context->bios + data_offset);
- tv_dac = malloc(sizeof(struct radeon_encoder_tv_dac),
- M_DRM, M_WAITOK | M_ZERO);
+ tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
if (!tv_dac)
return NULL;
@@ -2043,15 +2041,13 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK;
if (num_modes == 0)
return state_index;
- rdev->pm.power_state = malloc(sizeof(struct radeon_power_state) * num_modes,
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * num_modes, GFP_KERNEL);
if (!rdev->pm.power_state)
return state_index;
/* last mode is usually default, array is low to high */
for (i = 0; i < num_modes; i++) {
rdev->pm.power_state[state_index].clock_info =
- malloc(sizeof(struct radeon_pm_clock_info) * 1,
- M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
if (!rdev->pm.power_state[state_index].clock_info)
return state_index;
rdev->pm.power_state[state_index].num_clock_modes = 1;
@@ -2453,8 +2449,8 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev)
radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController);
if (power_info->pplib.ucNumStates == 0)
return state_index;
- rdev->pm.power_state = malloc(sizeof(struct radeon_power_state) *
- power_info->pplib.ucNumStates, M_DRM, M_WAITOK | M_ZERO);
+ rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) *
+ power_info->pplib.ucNumStates, GFP_KERNEL);
if (!rdev->pm.power_state)
return state_index;
/* first mode is usually default, followed by low to high */
@@ -2469,10 +2465,10 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev)
le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) +
(power_state->v1.ucNonClockStateIndex *
power_info->pplib.ucNonClockSize));
- rdev->pm.power_state[i].clock_info = malloc(sizeof(struct radeon_pm_clock_info) *
+ rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) *
((power_info->pplib.ucStateEntrySize - 1) ?
(power_info->pplib.ucStateEntrySize - 1) : 1),
- M_DRM, M_WAITOK | M_ZERO);
+ GFP_KERNEL);
if (!rdev->pm.power_state[i].clock_info)
return state_index;
if (power_info->pplib.ucStateEntrySize - 1) {
@@ -2554,8 +2550,8 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev)
le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
if (state_array->ucNumEntries == 0)
return state_index;
- rdev->pm.power_state = malloc(sizeof(struct radeon_power_state) *
- state_array->ucNumEntries, M_DRM, M_WAITOK | M_ZERO);
+ rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) *
+ state_array->ucNumEntries, GFP_KERNEL);
if (!rdev->pm.power_state)
return state_index;
power_state_offset = (u8 *)state_array->states;
@@ -2565,10 +2561,10 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev)
non_clock_array_index = power_state->v2.nonClockInfoIndex;
non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *)
&non_clock_info_array->nonClockInfo[non_clock_array_index];
- rdev->pm.power_state[i].clock_info = malloc(sizeof(struct radeon_pm_clock_info) *
+ rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) *
(power_state->v2.ucNumDPMLevels ?
power_state->v2.ucNumDPMLevels : 1),
- M_DRM, M_WAITOK | M_ZERO);
+ GFP_KERNEL);
if (!rdev->pm.power_state[i].clock_info)
return state_index;
if (power_state->v2.ucNumDPMLevels) {
@@ -2645,12 +2641,10 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
}
if (state_index == 0) {
- rdev->pm.power_state = malloc(sizeof(struct radeon_power_state),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL);
if (rdev->pm.power_state) {
rdev->pm.power_state[0].clock_info =
- malloc(sizeof(struct radeon_pm_clock_info) * 1,
- M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
if (rdev->pm.power_state[0].clock_info) {
/* add the default mode */
rdev->pm.power_state[state_index].type =
diff --git a/sys/dev/pci/drm/radeon/radeon_bios.c b/sys/dev/pci/drm/radeon/radeon_bios.c
index 49e54e6dbf2..c50004d312f 100644
--- a/sys/dev/pci/drm/radeon/radeon_bios.c
+++ b/sys/dev/pci/drm/radeon/radeon_bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_bios.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_bios.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -73,7 +73,7 @@ radeon_read_platform_bios(struct radeon_device *rdev)
return false;
}
- rdev->bios = malloc(size, M_DRM, M_WAITOK);
+ rdev->bios = kmalloc(size, GFP_KERNEL);
if (rdev->bios == NULL)
return false;
@@ -116,7 +116,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
return false;
}
- rdev->bios = malloc(size, M_DRM, M_WAITOK);
+ rdev->bios = kmalloc(size, GFP_KERNEL);
if (rdev->bios == NULL) {
bus_space_unmap(bst, bsh, size);
return false;
@@ -160,7 +160,7 @@ static bool radeon_read_bios(struct radeon_device *rdev)
if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa)
goto fail;
- rdev->bios = malloc(size, M_DRM, M_WAITOK);
+ rdev->bios = kmalloc(size, GFP_KERNEL);
memcpy(rdev->bios, bios, size);
bus_space_unmap(rdev->memt, romh, size);
return true;
@@ -213,7 +213,7 @@ static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios,
obj = (union acpi_object *)buffer.pointer;
memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length);
len = obj->buffer.length;
- free(buffer.pointer, M_DRM);
+ kfree(buffer.pointer);
return len;
}
@@ -246,7 +246,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
if (!found)
return false;
- rdev->bios = malloc(size, M_DRM, M_WAITOK);
+ rdev->bios = kmalloc(size, GFP_KERNEL);
if (!rdev->bios) {
DRM_ERROR("Unable to allocate bios\n");
return false;
@@ -262,7 +262,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
}
if (i == 0 || rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) {
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
return false;
}
return true;
@@ -723,7 +723,7 @@ bool radeon_get_bios(struct radeon_device *rdev)
DRM_DEBUG("%sBIOS detected\n", rdev->is_atom_bios ? "ATOM" : "COM");
return true;
free_bios:
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
return false;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_combios.c b/sys/dev/pci/drm/radeon/radeon_combios.c
index 55faece6917..ae95c8def14 100644
--- a/sys/dev/pci/drm/radeon/radeon_combios.c
+++ b/sys/dev/pci/drm/radeon/radeon_combios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_combios.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_combios.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2004 ATI Technologies Inc., Markham, Ontario
* Copyright 2007-8 Advanced Micro Devices, Inc.
@@ -390,14 +390,14 @@ bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
raw = rdev->bios + edid_info;
size = EDID_LENGTH * (raw[0x7e] + 1);
- edid = malloc(size, M_DRM, M_WAITOK);
+ edid = kmalloc(size, GFP_KERNEL);
if (edid == NULL)
return false;
memcpy((unsigned char *)edid, raw, size);
if (!drm_edid_is_valid(edid)) {
- free(edid, M_DRM);
+ kfree(edid);
return false;
}
@@ -413,7 +413,7 @@ radeon_bios_get_hardcoded_edid(struct radeon_device *rdev)
struct edid *edid;
if (rdev->mode_info.bios_hardcoded_edid) {
- edid = malloc(rdev->mode_info.bios_hardcoded_edid_size, M_DRM, M_WAITOK);
+ edid = kmalloc(rdev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL);
if (edid) {
memcpy((unsigned char *)edid,
(unsigned char *)rdev->mode_info.bios_hardcoded_edid,
@@ -879,8 +879,8 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
struct radeon_encoder_primary_dac *p_dac = NULL;
int found = 0;
- p_dac = malloc(sizeof(struct radeon_encoder_primary_dac),
- M_DRM, M_WAITOK | M_ZERO);
+ p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac),
+ GFP_KERNEL);
if (!p_dac)
return NULL;
@@ -1024,8 +1024,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
struct radeon_encoder_tv_dac *tv_dac = NULL;
int found = 0;
- tv_dac = malloc(sizeof(struct radeon_encoder_tv_dac),
- M_DRM, M_WAITOK | M_ZERO);
+ tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
if (!tv_dac)
return NULL;
@@ -1113,7 +1112,7 @@ static struct radeon_encoder_lvds *radeon_legacy_get_lvds_info_from_regs(struct
uint32_t ppll_div_sel, ppll_val;
uint32_t lvds_ss_gen_cntl = RREG32(RADEON_LVDS_SS_GEN_CNTL);
- lvds = malloc(sizeof(struct radeon_encoder_lvds), M_DRM, M_WAITOK | M_ZERO);
+ lvds = kzalloc(sizeof(struct radeon_encoder_lvds), GFP_KERNEL);
if (!lvds)
return NULL;
@@ -1188,8 +1187,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder
lcd_info = combios_get_table_offset(dev, COMBIOS_LCD_INFO_TABLE);
if (lcd_info) {
- lvds = malloc(sizeof(struct radeon_encoder_lvds),
- M_DRM, M_WAITOK | M_ZERO);
+ lvds = kzalloc(sizeof(struct radeon_encoder_lvds), GFP_KERNEL);
if (!lvds)
return NULL;
@@ -2647,16 +2645,13 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
rdev->pm.default_power_state_index = -1;
/* allocate 2 power states */
- rdev->pm.power_state = malloc(sizeof(struct radeon_power_state) * 2,
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL);
if (rdev->pm.power_state) {
/* allocate 1 clock mode per state */
rdev->pm.power_state[0].clock_info =
- malloc(sizeof(struct radeon_pm_clock_info) * 1,
- M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
rdev->pm.power_state[1].clock_info =
- malloc(sizeof(struct radeon_pm_clock_info) * 1,
- M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
if (!rdev->pm.power_state[0].clock_info ||
!rdev->pm.power_state[1].clock_info)
goto pm_failed;
diff --git a/sys/dev/pci/drm/radeon/radeon_connectors.c b/sys/dev/pci/drm/radeon/radeon_connectors.c
index 254ec84fdc9..b0decbfd3f6 100644
--- a/sys/dev/pci/drm/radeon/radeon_connectors.c
+++ b/sys/dev/pci/drm/radeon/radeon_connectors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_connectors.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_connectors.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -650,13 +650,13 @@ static void radeon_connector_destroy(struct drm_connector *connector)
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
if (radeon_connector->edid)
- free(radeon_connector->edid, M_DRM);
- free(radeon_connector->con_priv, M_DRM);
+ kfree(radeon_connector->edid);
+ kfree(radeon_connector->con_priv);
#ifdef __linux__
drm_sysfs_connector_remove(connector);
#endif
drm_connector_cleanup(connector);
- free(connector, M_DRM);
+ kfree(connector);
}
static int radeon_lvds_set_property(struct drm_connector *connector,
@@ -753,7 +753,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
if (dret) {
radeon_connector->detected_by_load = false;
if (radeon_connector->edid) {
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
radeon_connector->edid = NULL;
}
radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter);
@@ -769,7 +769,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
* with a shared ddc line (often vga + hdmi)
*/
if (radeon_connector->use_digital && radeon_connector->shared_ddc) {
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
radeon_connector->edid = NULL;
ret = connector_status_disconnected;
} else
@@ -959,7 +959,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
if (dret) {
radeon_connector->detected_by_load = false;
if (radeon_connector->edid) {
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
radeon_connector->edid = NULL;
}
radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter);
@@ -984,7 +984,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
* with a shared ddc line (often vga + hdmi)
*/
if ((!radeon_connector->use_digital) && radeon_connector->shared_ddc) {
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
radeon_connector->edid = NULL;
ret = connector_status_disconnected;
} else
@@ -1009,7 +1009,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
if (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
/* hpd is our only option in this case */
if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
radeon_connector->edid = NULL;
ret = connector_status_disconnected;
}
@@ -1218,15 +1218,15 @@ static void radeon_dp_connector_destroy(struct drm_connector *connector)
struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
if (radeon_connector->edid)
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
if (radeon_dig_connector->dp_i2c_bus)
radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus);
- free(radeon_connector->con_priv, M_DRM);
+ kfree(radeon_connector->con_priv);
#ifdef __linux__
drm_sysfs_connector_remove(connector);
#endif
drm_connector_cleanup(connector);
- free(connector, M_DRM);
+ kfree(connector);
}
static int radeon_dp_get_modes(struct drm_connector *connector)
@@ -1377,7 +1377,7 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
return connector->status;
if (radeon_connector->edid) {
- free(radeon_connector->edid, M_DRM);
+ kfree(radeon_connector->edid);
radeon_connector->edid = NULL;
}
@@ -1565,7 +1565,7 @@ radeon_add_atom_connector(struct drm_device *dev,
}
}
- radeon_connector = malloc(sizeof(struct radeon_connector), M_DRM, M_WAITOK | M_ZERO);
+ radeon_connector = kzalloc(sizeof(struct radeon_connector), GFP_KERNEL);
if (!radeon_connector)
return;
@@ -1585,8 +1585,7 @@ radeon_add_atom_connector(struct drm_device *dev,
}
if (is_dp_bridge) {
- radeon_dig_connector = malloc(sizeof(struct radeon_connector_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector)
goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info;
@@ -1692,8 +1691,7 @@ radeon_add_atom_connector(struct drm_device *dev,
break;
case DRM_MODE_CONNECTOR_DVII:
case DRM_MODE_CONNECTOR_DVID:
- radeon_dig_connector = malloc(sizeof(struct radeon_connector_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector)
goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info;
@@ -1734,8 +1732,7 @@ radeon_add_atom_connector(struct drm_device *dev,
break;
case DRM_MODE_CONNECTOR_HDMIA:
case DRM_MODE_CONNECTOR_HDMIB:
- radeon_dig_connector = malloc(sizeof(struct radeon_connector_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector)
goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info;
@@ -1769,8 +1766,7 @@ radeon_add_atom_connector(struct drm_device *dev,
connector->doublescan_allowed = false;
break;
case DRM_MODE_CONNECTOR_DisplayPort:
- radeon_dig_connector = malloc(sizeof(struct radeon_connector_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector)
goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info;
@@ -1806,8 +1802,7 @@ radeon_add_atom_connector(struct drm_device *dev,
connector->doublescan_allowed = false;
break;
case DRM_MODE_CONNECTOR_eDP:
- radeon_dig_connector = malloc(sizeof(struct radeon_connector_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector)
goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info;
@@ -1848,8 +1843,7 @@ radeon_add_atom_connector(struct drm_device *dev,
connector->doublescan_allowed = false;
break;
case DRM_MODE_CONNECTOR_LVDS:
- radeon_dig_connector = malloc(sizeof(struct radeon_connector_atom_dig),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector)
goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info;
@@ -1885,7 +1879,7 @@ radeon_add_atom_connector(struct drm_device *dev,
failed:
drm_connector_cleanup(connector);
- free(connector, M_DRM);
+ kfree(connector);
}
void
@@ -1921,8 +1915,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
}
}
- radeon_connector = malloc(sizeof(struct radeon_connector),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_connector = kzalloc(sizeof(struct radeon_connector), GFP_KERNEL);
if (!radeon_connector)
return;
diff --git a/sys/dev/pci/drm/radeon/radeon_cs.c b/sys/dev/pci/drm/radeon/radeon_cs.c
index eb62f317289..c5e92f5eadf 100644
--- a/sys/dev/pci/drm/radeon/radeon_cs.c
+++ b/sys/dev/pci/drm/radeon/radeon_cs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_cs.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_cs.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Jerome Glisse.
* All Rights Reserved.
@@ -234,7 +234,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
if ((p->chunks[i].chunk_id == RADEON_CHUNK_ID_RELOCS) ||
(p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS)) {
size = p->chunks[i].length_dw * sizeof(uint32_t);
- p->chunks[i].kdata = malloc(size, M_DRM, M_WAITOK);
+ p->chunks[i].kdata = kmalloc(size, GFP_KERNEL);
if (p->chunks[i].kdata == NULL) {
return -ENOMEM;
}
@@ -281,12 +281,12 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
return -EINVAL;
}
if (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) {
- p->chunks[p->chunk_ib_idx].kpage[0] = malloc(PAGE_SIZE, M_DRM, M_WAITOK);
- p->chunks[p->chunk_ib_idx].kpage[1] = malloc(PAGE_SIZE, M_DRM, M_WAITOK);
+ p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL ||
p->chunks[p->chunk_ib_idx].kpage[1] == NULL) {
- drm_free(p->chunks[p->chunk_ib_idx].kpage[0]);
- drm_free(p->chunks[p->chunk_ib_idx].kpage[1]);
+ kfree(p->chunks[p->chunk_ib_idx].kpage[0]);
+ kfree(p->chunks[p->chunk_ib_idx].kpage[1]);
p->chunks[p->chunk_ib_idx].kpage[0] = NULL;
p->chunks[p->chunk_ib_idx].kpage[1] = NULL;
return -ENOMEM;
@@ -327,18 +327,18 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
drm_gem_object_unreference_unlocked(parser->relocs[i].gobj);
}
}
- drm_free(parser->track);
- drm_free(parser->relocs);
- drm_free(parser->relocs_ptr);
+ kfree(parser->track);
+ kfree(parser->relocs);
+ kfree(parser->relocs_ptr);
for (i = 0; i < parser->nchunks; i++) {
- drm_free(parser->chunks[i].kdata);
+ kfree(parser->chunks[i].kdata);
if ((parser->rdev->flags & RADEON_IS_AGP)) {
- drm_free(parser->chunks[i].kpage[0]);
- drm_free(parser->chunks[i].kpage[1]);
+ kfree(parser->chunks[i].kpage[0]);
+ kfree(parser->chunks[i].kpage[1]);
}
}
- drm_free(parser->chunks);
- drm_free(parser->chunks_array);
+ kfree(parser->chunks);
+ kfree(parser->chunks_array);
radeon_ib_free(parser->rdev, &parser->ib);
radeon_ib_free(parser->rdev, &parser->const_ib);
}
diff --git a/sys/dev/pci/drm/radeon/radeon_device.c b/sys/dev/pci/drm/radeon/radeon_device.c
index 8404efeb538..8fa821e67c6 100644
--- a/sys/dev/pci/drm/radeon/radeon_device.c
+++ b/sys/dev/pci/drm/radeon/radeon_device.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_device.c,v 1.3 2014/01/24 05:28:50 jsg Exp $ */
+/* $OpenBSD: radeon_device.c,v 1.4 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -748,7 +748,7 @@ cail_ioreg_read(struct card_info *info, uint32_t reg)
int radeon_atombios_init(struct radeon_device *rdev)
{
struct card_info *atom_card_info =
- malloc(sizeof(struct card_info), M_DRM, M_WAITOK | M_ZERO);
+ kzalloc(sizeof(struct card_info), GFP_KERNEL);
if (!atom_card_info)
return -ENOMEM;
@@ -790,11 +790,10 @@ int radeon_atombios_init(struct radeon_device *rdev)
void radeon_atombios_fini(struct radeon_device *rdev)
{
if (rdev->mode_info.atom_context) {
- free(rdev->mode_info.atom_context->scratch, M_DRM);
- free(rdev->mode_info.atom_context, M_DRM);
+ kfree(rdev->mode_info.atom_context->scratch);
+ kfree(rdev->mode_info.atom_context);
}
- if (rdev->mode_info.atom_card_info)
- free(rdev->mode_info.atom_card_info, M_DRM);
+ kfree(rdev->mode_info.atom_card_info);
}
/* COMBIOS */
@@ -1446,7 +1445,7 @@ retry:
} else {
radeon_fence_driver_force_completion(rdev);
for (i = 0; i < RADEON_NUM_RINGS; ++i) {
- free(ring_data[i], M_DRM);
+ kfree(ring_data[i]);
}
}
diff --git a/sys/dev/pci/drm/radeon/radeon_display.c b/sys/dev/pci/drm/radeon/radeon_display.c
index 8a84d9e4271..3b3f6e0d483 100644
--- a/sys/dev/pci/drm/radeon/radeon_display.c
+++ b/sys/dev/pci/drm/radeon/radeon_display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_display.c,v 1.5 2013/12/05 13:29:56 kettenis Exp $ */
+/* $OpenBSD: radeon_display.c,v 1.6 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -242,7 +242,7 @@ static void radeon_crtc_destroy(struct drm_crtc *crtc)
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
drm_crtc_cleanup(crtc);
- free(radeon_crtc, M_DRM);
+ kfree(radeon_crtc);
}
/*
@@ -266,7 +266,7 @@ radeon_unpin_work_func(void *arg1, void *arg2)
DRM_ERROR("failed to reserve buffer after flip\n");
drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
- free(work, M_DRM);
+ kfree(work);
}
void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
@@ -364,7 +364,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
u64 base;
int r;
- work = malloc(sizeof *work, M_DRM, M_WAITOK | M_ZERO);
+ work = kzalloc(sizeof *work, GFP_KERNEL);
if (work == NULL)
return -ENOMEM;
@@ -492,7 +492,7 @@ unlock_free:
mtx_leave(&dev->event_lock);
drm_gem_object_unreference_unlocked(old_radeon_fb->obj);
radeon_fence_unref(&work->fence);
- free(work, M_DRM);
+ kfree(work);
return r;
}
@@ -512,8 +512,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
struct radeon_crtc *radeon_crtc;
int i;
- radeon_crtc = malloc(sizeof(struct radeon_crtc) + (RADEONFB_CONN_LIMIT * sizeof(struct drm_connector *)),
- M_DRM, M_WAITOK | M_ZERO);
+ radeon_crtc = kzalloc(sizeof(struct radeon_crtc) + (RADEONFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL);
if (radeon_crtc == NULL)
return;
@@ -1072,7 +1071,7 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
drm_gem_object_unreference_unlocked(radeon_fb->obj);
}
drm_framebuffer_cleanup(fb);
- free(radeon_fb, M_DRM);
+ kfree(radeon_fb);
}
static int radeon_user_framebuffer_create_handle(struct drm_framebuffer *fb,
@@ -1122,7 +1121,7 @@ radeon_user_framebuffer_create(struct drm_device *dev,
return ERR_PTR(-ENOENT);
}
- radeon_fb = malloc(sizeof(*radeon_fb), M_DRM, M_WAITOK | M_ZERO);
+ radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL);
if (radeon_fb == NULL) {
drm_gem_object_unreference_unlocked(obj);
return ERR_PTR(-ENOMEM);
@@ -1130,7 +1129,7 @@ radeon_user_framebuffer_create(struct drm_device *dev,
ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj);
if (ret) {
- free(radeon_fb, M_DRM);
+ kfree(radeon_fb);
drm_gem_object_unreference_unlocked(obj);
return ERR_PTR(ret);
}
@@ -1259,39 +1258,33 @@ static void radeon_afmt_init(struct radeon_device *rdev)
} else if (ASIC_IS_DCE4(rdev)) {
/* DCE4/5 has 6 audio blocks tied to DIG encoders */
/* DCE4.1 has 2 audio blocks tied to DIG encoders */
- rdev->mode_info.afmt[0] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[0] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[0]) {
rdev->mode_info.afmt[0]->offset = EVERGREEN_CRTC0_REGISTER_OFFSET;
rdev->mode_info.afmt[0]->id = 0;
}
- rdev->mode_info.afmt[1] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[1] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[1]) {
rdev->mode_info.afmt[1]->offset = EVERGREEN_CRTC1_REGISTER_OFFSET;
rdev->mode_info.afmt[1]->id = 1;
}
if (!ASIC_IS_DCE41(rdev)) {
- rdev->mode_info.afmt[2] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[2] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[2]) {
rdev->mode_info.afmt[2]->offset = EVERGREEN_CRTC2_REGISTER_OFFSET;
rdev->mode_info.afmt[2]->id = 2;
}
- rdev->mode_info.afmt[3] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[3] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[3]) {
rdev->mode_info.afmt[3]->offset = EVERGREEN_CRTC3_REGISTER_OFFSET;
rdev->mode_info.afmt[3]->id = 3;
}
- rdev->mode_info.afmt[4] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[4] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[4]) {
rdev->mode_info.afmt[4]->offset = EVERGREEN_CRTC4_REGISTER_OFFSET;
rdev->mode_info.afmt[4]->id = 4;
}
- rdev->mode_info.afmt[5] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[5] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[5]) {
rdev->mode_info.afmt[5]->offset = EVERGREEN_CRTC5_REGISTER_OFFSET;
rdev->mode_info.afmt[5]->id = 5;
@@ -1299,30 +1292,26 @@ static void radeon_afmt_init(struct radeon_device *rdev)
}
} else if (ASIC_IS_DCE3(rdev)) {
/* DCE3.x has 2 audio blocks tied to DIG encoders */
- rdev->mode_info.afmt[0] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[0] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[0]) {
rdev->mode_info.afmt[0]->offset = DCE3_HDMI_OFFSET0;
rdev->mode_info.afmt[0]->id = 0;
}
- rdev->mode_info.afmt[1] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[1] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[1]) {
rdev->mode_info.afmt[1]->offset = DCE3_HDMI_OFFSET1;
rdev->mode_info.afmt[1]->id = 1;
}
} else if (ASIC_IS_DCE2(rdev)) {
/* DCE2 has at least 1 routable audio block */
- rdev->mode_info.afmt[0] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[0] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[0]) {
rdev->mode_info.afmt[0]->offset = DCE2_HDMI_OFFSET0;
rdev->mode_info.afmt[0]->id = 0;
}
/* r6xx has 2 routable audio blocks */
if (rdev->family >= CHIP_R600) {
- rdev->mode_info.afmt[1] = malloc(sizeof(struct radeon_afmt),
- M_DRM, M_WAITOK | M_ZERO);
+ rdev->mode_info.afmt[1] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL);
if (rdev->mode_info.afmt[1]) {
rdev->mode_info.afmt[1]->offset = DCE2_HDMI_OFFSET1;
rdev->mode_info.afmt[1]->id = 1;
@@ -1336,7 +1325,7 @@ static void radeon_afmt_fini(struct radeon_device *rdev)
int i;
for (i = 0; i < RADEON_MAX_AFMT_BLOCKS; i++) {
- free(rdev->mode_info.afmt[i], M_DRM);
+ kfree(rdev->mode_info.afmt[i]);
rdev->mode_info.afmt[i] = NULL;
}
}
@@ -1416,7 +1405,7 @@ int radeon_modeset_init(struct radeon_device *rdev)
void radeon_modeset_fini(struct radeon_device *rdev)
{
radeon_fbdev_fini(rdev);
- free(rdev->mode_info.bios_hardcoded_edid, M_DRM);
+ kfree(rdev->mode_info.bios_hardcoded_edid);
radeon_pm_fini(rdev);
if (rdev->mode_info.mode_config_initialized) {
diff --git a/sys/dev/pci/drm/radeon/radeon_fb.c b/sys/dev/pci/drm/radeon/radeon_fb.c
index a451b71aba5..d5cfe02459f 100644
--- a/sys/dev/pci/drm/radeon/radeon_fb.c
+++ b/sys/dev/pci/drm/radeon/radeon_fb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_fb.c,v 1.4 2014/01/09 13:42:57 mpi Exp $ */
+/* $OpenBSD: radeon_fb.c,v 1.5 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright © 2007 David Airlie
*
@@ -340,7 +340,7 @@ out_unref:
if (fb && ret) {
drm_gem_object_unreference(gobj);
drm_framebuffer_cleanup(fb);
- free(fb, M_DRM);
+ kfree(fb);
}
return ret;
}
@@ -410,7 +410,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
bpp_sel = 8;
- rfbdev = malloc(sizeof(struct radeon_fbdev), M_DRM, M_WAITOK | M_ZERO);
+ rfbdev = kzalloc(sizeof(struct radeon_fbdev), GFP_KERNEL);
if (!rfbdev)
return -ENOMEM;
@@ -422,7 +422,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
rdev->num_crtc,
RADEONFB_CONN_LIMIT);
if (ret) {
- free(rfbdev, M_DRM);
+ kfree(rfbdev);
return ret;
}
@@ -463,7 +463,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
task_del(systq, &rdev->burner_task);
radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
- free(rdev->mode_info.rfbdev, M_DRM);
+ kfree(rdev->mode_info.rfbdev);
rdev->mode_info.rfbdev = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_fence.c b/sys/dev/pci/drm/radeon/radeon_fence.c
index 56eb5395272..0e6714d6e25 100644
--- a/sys/dev/pci/drm/radeon/radeon_fence.c
+++ b/sys/dev/pci/drm/radeon/radeon_fence.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_fence.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_fence.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2009 Jerome Glisse.
* All Rights Reserved.
@@ -109,7 +109,7 @@ int radeon_fence_emit(struct radeon_device *rdev,
int ring)
{
/* we are protected by the ring emission rwlock */
- *fence = malloc(sizeof(struct radeon_fence), M_DRM, M_WAITOK);
+ *fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL);
if ((*fence) == NULL) {
return -ENOMEM;
}
@@ -205,7 +205,7 @@ void radeon_fence_process(struct radeon_device *rdev, int ring)
static void radeon_fence_destroy(struct radeon_fence *fence)
{
- drm_free(fence);
+ kfree(fence);
}
/**
diff --git a/sys/dev/pci/drm/radeon/radeon_gart.c b/sys/dev/pci/drm/radeon/radeon_gart.c
index b6c55a32920..4ccb562a5dc 100644
--- a/sys/dev/pci/drm/radeon/radeon_gart.c
+++ b/sys/dev/pci/drm/radeon/radeon_gart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_gart.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_gart.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -352,15 +352,13 @@ int radeon_gart_init(struct radeon_device *rdev)
rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages);
#endif
/* Allocate pages table */
- rdev->gart.pages = malloc(sizeof(void *) * rdev->gart.num_cpu_pages,
- M_DRM, M_ZERO | M_WAITOK);
+ rdev->gart.pages = vzalloc(sizeof(void *) * rdev->gart.num_cpu_pages);
if (rdev->gart.pages == NULL) {
radeon_gart_fini(rdev);
return -ENOMEM;
}
- rdev->gart.pages_addr = malloc(sizeof(bus_addr_t) *
- rdev->gart.num_cpu_pages,
- M_DRM, M_ZERO | M_WAITOK);
+ rdev->gart.pages_addr = vzalloc(sizeof(bus_addr_t) *
+ rdev->gart.num_cpu_pages);
if (rdev->gart.pages_addr == NULL) {
radeon_gart_fini(rdev);
return -ENOMEM;
@@ -386,10 +384,8 @@ void radeon_gart_fini(struct radeon_device *rdev)
radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages);
}
rdev->gart.ready = false;
- if (rdev->gart.pages)
- free(rdev->gart.pages, M_DRM);
- if (rdev->gart.pages_addr)
- free(rdev->gart.pages_addr, M_DRM);
+ vfree(rdev->gart.pages);
+ vfree(rdev->gart.pages_addr);
rdev->gart.pages = NULL;
rdev->gart.pages_addr = NULL;
@@ -530,7 +526,7 @@ static void radeon_vm_free_pt(struct radeon_device *rdev,
for (i = 0; i < radeon_vm_num_pdes(rdev); i++)
radeon_sa_bo_free(rdev, &vm->page_tables[i], vm->fence);
- free(vm->page_tables, M_DRM);
+ kfree(vm->page_tables);
}
/**
@@ -642,7 +638,7 @@ retry:
memset(pd_addr, 0, pd_size);
pts_size = radeon_vm_num_pdes(rdev) * sizeof(struct radeon_sa_bo *);
- vm->page_tables = malloc(pts_size, M_DRM, M_WAITOK | M_ZERO);
+ vm->page_tables = kzalloc(pts_size, GFP_KERNEL);
if (vm->page_tables == NULL) {
DRM_ERROR("Cannot allocate memory for page table array\n");
@@ -790,7 +786,7 @@ struct radeon_bo_va *radeon_vm_bo_add(struct radeon_device *rdev,
{
struct radeon_bo_va *bo_va;
- bo_va = malloc(sizeof(struct radeon_bo_va), M_DRM, M_WAITOK | M_ZERO);
+ bo_va = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
if (bo_va == NULL) {
return NULL;
}
@@ -1220,7 +1216,7 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
rw_exit_write(&bo_va->vm->rwlock);
list_del(&bo_va->bo_list);
- free(bo_va, M_DRM);
+ kfree(bo_va);
return r;
}
@@ -1288,7 +1284,7 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm)
if (!r) {
list_del_init(&bo_va->bo_list);
radeon_bo_unreserve(bo_va->bo);
- free(bo_va, M_DRM);
+ kfree(bo_va);
}
}
radeon_fence_unref(&vm->fence);
diff --git a/sys/dev/pci/drm/radeon/radeon_i2c.c b/sys/dev/pci/drm/radeon/radeon_i2c.c
index cdcb3b5fa21..a24e1b4f171 100644
--- a/sys/dev/pci/drm/radeon/radeon_i2c.c
+++ b/sys/dev/pci/drm/radeon/radeon_i2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_i2c.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_i2c.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -1012,7 +1012,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
if (rec->mm_i2c && (radeon_hw_i2c == 0))
return NULL;
- i2c = malloc(sizeof(struct radeon_i2c_chan), M_DRM, M_WAITOK | M_ZERO);
+ i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL);
if (i2c == NULL)
return NULL;
@@ -1090,7 +1090,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
return i2c;
out_free:
- free(i2c, M_DRM);
+ kfree(i2c);
return NULL;
}
@@ -1101,7 +1101,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
struct radeon_i2c_chan *i2c;
int ret = 0;
- i2c = malloc(sizeof(struct radeon_i2c_chan), M_DRM, M_WAITOK | M_ZERO);
+ i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL);
if (i2c == NULL)
return NULL;
@@ -1130,7 +1130,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
return i2c;
out_free:
- free(i2c, M_DRM);
+ kfree(i2c);
return NULL;
}
@@ -1141,7 +1141,7 @@ void radeon_i2c_destroy(struct radeon_i2c_chan *i2c)
if (!i2c)
return;
i2c_del_adapter(&i2c->adapter);
- free(i2c, M_DRM);
+ kfree(i2c);
#endif
}
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index d54e1b0bcfb..36ba1648178 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_kms.c,v 1.19 2014/01/23 03:15:09 kettenis Exp $ */
+/* $OpenBSD: radeon_kms.c,v 1.20 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -1052,7 +1052,7 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
struct radeon_bo_va *bo_va;
int r;
- fpriv = malloc(sizeof(*fpriv), M_DRM, M_WAITOK | M_ZERO);
+ fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
if (unlikely(!fpriv)) {
return -ENOMEM;
}
@@ -1068,7 +1068,7 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
RADEON_VM_PAGE_SNOOPED);
if (r) {
radeon_vm_fini(rdev, &fpriv->vm);
- free(fpriv, M_DRM);
+ kfree(fpriv);
return r;
}
@@ -1106,7 +1106,7 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
}
radeon_vm_fini(rdev, &fpriv->vm);
- free(fpriv, M_DRM);
+ kfree(fpriv);
file_priv->driver_priv = NULL;
}
}
diff --git a/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c b/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c
index 6c4cdadb7de..5f2b694f673 100644
--- a/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c
+++ b/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_legacy_encoders.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_legacy_encoders.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -383,7 +383,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
return;
#endif
- pdata = malloc(sizeof(struct radeon_backlight_privdata), M_DRM, M_WAITOK);
+ pdata = kmalloc(sizeof(struct radeon_backlight_privdata), GFP_KERNEL);
if (!pdata) {
DRM_ERROR("Memory allocation failed\n");
goto error;
@@ -447,7 +447,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
return;
error:
- free(pdata, M_DRM);
+ kfree(pdata);
return;
}
@@ -475,7 +475,7 @@ static void radeon_legacy_backlight_exit(struct radeon_encoder *radeon_encoder)
pdata = bl_get_data(bd);
backlight_device_unregister(bd);
- free(pdata, M_DRM);
+ kfree(pdata);
DRM_INFO("radeon legacy LVDS backlight unloaded\n");
}
@@ -500,10 +500,10 @@ static void radeon_lvds_enc_destroy(struct drm_encoder *encoder)
if (radeon_encoder->enc_priv) {
radeon_legacy_backlight_exit(radeon_encoder);
- free(radeon_encoder->enc_priv, M_DRM);
+ kfree(radeon_encoder->enc_priv);
}
drm_encoder_cleanup(encoder);
- free(radeon_encoder, M_DRM);
+ kfree(radeon_encoder);
}
static const struct drm_encoder_funcs radeon_legacy_lvds_enc_funcs = {
@@ -1010,9 +1010,9 @@ static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder)
{
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
/* don't destroy the i2c bus record here, this will be done in radeon_i2c_fini */
- free(radeon_encoder->enc_priv, M_DRM);
+ kfree(radeon_encoder->enc_priv);
drm_encoder_cleanup(encoder);
- free(radeon_encoder, M_DRM);
+ kfree(radeon_encoder);
}
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = {
@@ -1696,7 +1696,7 @@ static struct radeon_encoder_int_tmds *radeon_legacy_get_tmds_info(struct radeon
struct radeon_encoder_int_tmds *tmds = NULL;
bool ret;
- tmds = malloc(sizeof(struct radeon_encoder_int_tmds), M_DRM, M_WAITOK | M_ZERO);
+ tmds = kzalloc(sizeof(struct radeon_encoder_int_tmds), GFP_KERNEL);
if (!tmds)
return NULL;
@@ -1722,7 +1722,7 @@ static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct ra
if (rdev->is_atom_bios)
return NULL;
- tmds = malloc(sizeof(struct radeon_encoder_ext_tmds), M_DRM, M_WAITOK | M_ZERO);
+ tmds = kzalloc(sizeof(struct radeon_encoder_ext_tmds), GFP_KERNEL);
if (!tmds)
return NULL;
@@ -1753,7 +1753,7 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_
}
/* add a new one */
- radeon_encoder = malloc(sizeof(struct radeon_encoder), M_DRM, M_WAITOK | M_ZERO);
+ radeon_encoder = kzalloc(sizeof(struct radeon_encoder), GFP_KERNEL);
if (!radeon_encoder)
return;
diff --git a/sys/dev/pci/drm/radeon/radeon_pm.c b/sys/dev/pci/drm/radeon/radeon_pm.c
index b9a25f3ac66..0c45d4ab90f 100644
--- a/sys/dev/pci/drm/radeon/radeon_pm.c
+++ b/sys/dev/pci/drm/radeon/radeon_pm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_pm.c,v 1.5 2013/11/11 03:08:20 dlg Exp $ */
+/* $OpenBSD: radeon_pm.c,v 1.6 2014/02/09 11:03:31 jsg Exp $ */
/*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -709,7 +709,7 @@ void radeon_pm_fini(struct radeon_device *rdev)
}
if (rdev->pm.power_state)
- free(rdev->pm.power_state, M_DRM);
+ kfree(rdev->pm.power_state);
radeon_hwmon_fini(rdev);
}
diff --git a/sys/dev/pci/drm/radeon/radeon_prime.c b/sys/dev/pci/drm/radeon/radeon_prime.c
index a33fa2390d5..3f740afb831 100644
--- a/sys/dev/pci/drm/radeon/radeon_prime.c
+++ b/sys/dev/pci/drm/radeon/radeon_prime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_prime.c,v 1.2 2013/12/05 13:29:56 kettenis Exp $ */
+/* $OpenBSD: radeon_prime.c,v 1.3 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2012 Advanced Micro Devices, Inc.
*
@@ -50,7 +50,7 @@ static void radeon_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
{
dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir);
sg_free_table(sg);
- free(sg, M_DRM);
+ kfree(sg);
}
static void radeon_gem_dmabuf_release(struct dma_buf *dma_buf)
diff --git a/sys/dev/pci/drm/radeon/radeon_ring.c b/sys/dev/pci/drm/radeon/radeon_ring.c
index a27d937dafc..6822d399c54 100644
--- a/sys/dev/pci/drm/radeon/radeon_ring.c
+++ b/sys/dev/pci/drm/radeon/radeon_ring.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_ring.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_ring.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -617,7 +617,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring
}
/* and then save the content of the ring */
- *data = malloc(size * sizeof(uint32_t), M_DRM, M_WAITOK);
+ *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
if (!*data) {
rw_exit_write(&rdev->ring_lock);
return 0;
@@ -659,7 +659,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,
}
radeon_ring_unlock_commit(rdev, ring);
- free(data, M_DRM);
+ kfree(data);
return 0;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_sa.c b/sys/dev/pci/drm/radeon/radeon_sa.c
index 9738189a552..b699c8f93cb 100644
--- a/sys/dev/pci/drm/radeon/radeon_sa.c
+++ b/sys/dev/pci/drm/radeon/radeon_sa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_sa.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_sa.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2011 Red Hat Inc.
* All Rights Reserved.
@@ -156,7 +156,7 @@ static void radeon_sa_bo_remove_locked(struct radeon_sa_bo *sa_bo)
list_del_init(&sa_bo->olist);
list_del_init(&sa_bo->flist);
radeon_fence_unref(&sa_bo->fence);
- free(sa_bo, M_DRM);
+ kfree(sa_bo);
}
static void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager)
@@ -332,7 +332,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
BUG_ON(align > RADEON_GPU_PAGE_SIZE);
BUG_ON(size > sa_manager->size);
- *sa_bo = malloc(sizeof(struct radeon_sa_bo), M_DRM, M_WAITOK);
+ *sa_bo = kmalloc(sizeof(struct radeon_sa_bo), GFP_KERNEL);
if ((*sa_bo) == NULL) {
return -ENOMEM;
}
@@ -383,7 +383,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
} while (!r);
mtx_leave(&sa_manager->wq_lock);
- free(*sa_bo, M_DRM);
+ kfree(*sa_bo);
*sa_bo = NULL;
return r;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_semaphore.c b/sys/dev/pci/drm/radeon/radeon_semaphore.c
index 91ca1d3bd11..036e41d2cc1 100644
--- a/sys/dev/pci/drm/radeon/radeon_semaphore.c
+++ b/sys/dev/pci/drm/radeon/radeon_semaphore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_semaphore.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_semaphore.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2011 Christian König.
* All Rights Reserved.
@@ -37,14 +37,14 @@ int radeon_semaphore_create(struct radeon_device *rdev,
{
int r;
- *semaphore = malloc(sizeof(struct radeon_semaphore), M_DRM, M_WAITOK);
+ *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL);
if (*semaphore == NULL) {
return -ENOMEM;
}
r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo,
&(*semaphore)->sa_bo, 8, 8, true);
if (r) {
- free(*semaphore, M_DRM);
+ kfree(*semaphore);
*semaphore = NULL;
return r;
}
@@ -115,6 +115,6 @@ void radeon_semaphore_free(struct radeon_device *rdev,
" hardware lockup imminent!\n", *semaphore);
}
radeon_sa_bo_free(rdev, &(*semaphore)->sa_bo, fence);
- free(*semaphore, M_DRM);
+ kfree(*semaphore);
*semaphore = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_test.c b/sys/dev/pci/drm/radeon/radeon_test.c
index 5558c52525d..5456447ef2c 100644
--- a/sys/dev/pci/drm/radeon/radeon_test.c
+++ b/sys/dev/pci/drm/radeon/radeon_test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_test.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_test.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2009 VMware, Inc.
*
@@ -67,7 +67,7 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
n -= rdev->ih.ring_size;
n /= size;
- gtt_obj = malloc(n * sizeof(*gtt_obj), M_DRM, M_WAITOK | M_ZERO);
+ gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
if (!gtt_obj) {
DRM_ERROR("Failed to allocate %d pointers\n", n);
r = 1;
@@ -235,7 +235,7 @@ out_cleanup:
radeon_bo_unref(&gtt_obj[i]);
}
}
- free(gtt_obj, M_DRM);
+ kfree(gtt_obj);
}
if (fence) {
radeon_fence_unref(&fence);
diff --git a/sys/dev/pci/drm/radeon/radeon_ttm.c b/sys/dev/pci/drm/radeon/radeon_ttm.c
index 89d5e0c8133..1f1801d512e 100644
--- a/sys/dev/pci/drm/radeon/radeon_ttm.c
+++ b/sys/dev/pci/drm/radeon/radeon_ttm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_ttm.c,v 1.2 2014/01/24 05:43:46 jsg Exp $ */
+/* $OpenBSD: radeon_ttm.c,v 1.3 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2009 Jerome Glisse.
* All Rights Reserved.
@@ -594,7 +594,7 @@ radeon_ttm_backend_destroy(struct ttm_tt *ttm)
bus_dmamap_destroy(gtt->rdev->dmat, gtt->map);
free(gtt->segs, M_DRM);
ttm_dma_tt_fini(&gtt->ttm);
- free(gtt, M_DRM);
+ kfree(gtt);
}
static struct ttm_backend_func radeon_backend_func = {
@@ -618,14 +618,14 @@ struct ttm_tt *radeon_ttm_tt_create(struct ttm_bo_device *bdev,
}
#endif
- gtt = malloc(sizeof(struct radeon_ttm_tt), M_DRM, M_WAITOK | M_ZERO);
+ gtt = kzalloc(sizeof(struct radeon_ttm_tt), GFP_KERNEL);
if (gtt == NULL) {
return NULL;
}
gtt->ttm.ttm.func = &radeon_backend_func;
gtt->rdev = rdev;
if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags, dummy_read_page)) {
- free(gtt, M_DRM);
+ kfree(gtt);
return NULL;
}
diff --git a/sys/dev/pci/drm/radeon/rs400.c b/sys/dev/pci/drm/radeon/rs400.c
index 83822ebebf9..008d8fbc49e 100644
--- a/sys/dev/pci/drm/radeon/rs400.c
+++ b/sys/dev/pci/drm/radeon/rs400.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rs400.c,v 1.2 2014/01/23 00:15:31 jsg Exp $ */
+/* $OpenBSD: rs400.c,v 1.3 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -488,8 +488,7 @@ void rs400_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/rs600.c b/sys/dev/pci/drm/radeon/rs600.c
index 4605223a8c2..c5855e081e5 100644
--- a/sys/dev/pci/drm/radeon/rs600.c
+++ b/sys/dev/pci/drm/radeon/rs600.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rs600.c,v 1.4 2013/10/30 02:11:33 dlg Exp $ */
+/* $OpenBSD: rs600.c,v 1.5 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -1004,8 +1004,7 @@ void rs600_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/rs690.c b/sys/dev/pci/drm/radeon/rs690.c
index 3c134067133..75f7e98d4d5 100644
--- a/sys/dev/pci/drm/radeon/rs690.c
+++ b/sys/dev/pci/drm/radeon/rs690.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rs690.c,v 1.2 2014/01/23 00:30:20 jsg Exp $ */
+/* $OpenBSD: rs690.c,v 1.3 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -715,8 +715,7 @@ void rs690_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/rv515.c b/sys/dev/pci/drm/radeon/rv515.c
index e60fc6cd6be..c293394625e 100644
--- a/sys/dev/pci/drm/radeon/rv515.c
+++ b/sys/dev/pci/drm/radeon/rv515.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rv515.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: rv515.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -607,8 +607,7 @@ void rv515_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/rv770.c b/sys/dev/pci/drm/radeon/rv770.c
index ccf88ce8497..9925874d72f 100644
--- a/sys/dev/pci/drm/radeon/rv770.c
+++ b/sys/dev/pci/drm/radeon/rv770.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rv770.c,v 1.3 2013/08/26 05:15:21 jsg Exp $ */
+/* $OpenBSD: rv770.c,v 1.4 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -1204,8 +1204,7 @@ void rv770_fini(struct radeon_device *rdev)
radeon_agp_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/si.c b/sys/dev/pci/drm/radeon/si.c
index 6e04b7a8265..0c289122315 100644
--- a/sys/dev/pci/drm/radeon/si.c
+++ b/sys/dev/pci/drm/radeon/si.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: si.c,v 1.8 2014/01/24 05:52:01 jsg Exp $ */
+/* $OpenBSD: si.c,v 1.9 2014/02/09 11:03:31 jsg Exp $ */
/*
* Copyright 2011 Advanced Micro Devices, Inc.
*
@@ -4408,8 +4408,7 @@ void si_fini(struct radeon_device *rdev)
radeon_fence_driver_fini(rdev);
radeon_bo_fini(rdev);
radeon_atombios_fini(rdev);
- if (rdev->bios)
- free(rdev->bios, M_DRM);
+ kfree(rdev->bios);
rdev->bios = NULL;
}