Change edid_parse() to take the edid structure as argument rather than

allocating its own.  (This is cleaner since we aren't allocating any
other data in this structure.)

Get rid of edid_free() as a result.
This commit is contained in:
gdamore 2006-05-11 19:05:41 +00:00
parent fc23c7c758
commit 80044be1b4
2 changed files with 8 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: edid.c,v 1.1 2006/05/11 01:49:53 gdamore Exp $ */ /* $NetBSD: edid.c,v 1.2 2006/05/11 19:05:41 gdamore Exp $ */
/*- /*-
* Copyright (c) 2006 Itronix Inc. * Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.1 2006/05/11 01:49:53 gdamore Exp $"); __KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.2 2006/05/11 19:05:41 gdamore Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -475,21 +475,16 @@ edid_block(struct edid_info *edid, uint8_t *data)
/* /*
* Gets EDID version in BCD, e.g. EDID v1.3 returned as 0x0103 * Gets EDID version in BCD, e.g. EDID v1.3 returned as 0x0103
*/ */
struct edid_info * int
edid_parse(uint8_t *data) edid_parse(uint8_t *data, struct edid_info *edid)
{ {
uint16_t manfid, estmodes; uint16_t manfid, estmodes;
struct edid_info *edid;
const struct videomode *vmp; const struct videomode *vmp;
int i; int i;
const char *name; const char *name;
if (edid_is_valid(data) != 0) if (edid_is_valid(data) != 0)
return NULL; return -1;
edid = malloc(sizeof (struct edid_info), M_DEVBUF, M_WAITOK|M_ZERO);
if (edid == NULL)
return NULL;
/* get product identification */ /* get product identification */
manfid = EDID_VENDOR_ID(data); manfid = EDID_VENDOR_ID(data);
@ -574,11 +569,6 @@ edid_parse(uint8_t *data)
edid_strchomp(edid->edid_serial); edid_strchomp(edid->edid_serial);
edid_strchomp(edid->edid_comment); edid_strchomp(edid->edid_comment);
return edid; return 0;
} }
void
edid_free(struct edid_info *edid)
{
free(edid, M_DEVBUF);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: edidvar.h,v 1.1 2006/05/11 01:49:53 gdamore Exp $ */ /* $NetBSD: edidvar.h,v 1.2 2006/05/11 19:05:41 gdamore Exp $ */
/*- /*-
* Copyright (c) 2006 Itronix Inc. * Copyright (c) 2006 Itronix Inc.
@ -88,8 +88,7 @@ struct edid_info {
}; };
int edid_is_valid(uint8_t *); int edid_is_valid(uint8_t *);
struct edid_info *edid_parse(uint8_t *); int edid_parse(uint8_t *, struct edid_info *);
void edid_free(struct edid_info *);
void edid_print(struct edid_info *); void edid_print(struct edid_info *);
#endif /* _DEV_VIDEOMODE_EDIDVAR_H */ #endif /* _DEV_VIDEOMODE_EDIDVAR_H */