Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sbus kill subyte.
details: https://anonhg.NetBSD.org/src/rev/214cf6015772
branches: trunk
changeset: 341740:214cf6015772
user: christos <christos%NetBSD.org@localhost>
date: Fri Nov 20 19:09:23 2015 +0000
description:
kill subyte.
diffstat:
sys/dev/sbus/zx.c | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diffs (64 lines):
diff -r c9aa7564ea2d -r 214cf6015772 sys/dev/sbus/zx.c
--- a/sys/dev/sbus/zx.c Fri Nov 20 18:34:17 2015 +0000
+++ b/sys/dev/sbus/zx.c Fri Nov 20 19:09:23 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $ */
+/* $NetBSD: zx.c,v 1.40 2015/11/20 19:09:23 christos Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.39 2012/01/11 16:08:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.40 2015/11/20 19:09:23 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -388,7 +388,7 @@
struct fbcmap *cm;
struct fbcursor *cu;
uint32_t curbits[2][32];
- int rv, v, count, i;
+ int rv, v, count, i, error;
sc = device_lookup_private(&zx_cd, minor(dev));
@@ -537,20 +537,23 @@
return (rv);
}
if (cu->cmap.red != NULL) {
- if (cu->cmap.index > 2 ||
- cu->cmap.count > 2 - cu->cmap.index)
- return (EINVAL);
- for (i = 0; i < cu->cmap.count; i++) {
- v = sc->sc_curcmap[i + cu->cmap.index + 0];
- if (subyte(&cu->cmap.red[i], v))
- return (EFAULT);
- v = sc->sc_curcmap[i + cu->cmap.index + 2];
- if (subyte(&cu->cmap.green[i], v))
- return (EFAULT);
- v = sc->sc_curcmap[i + cu->cmap.index + 4];
- if (subyte(&cu->cmap.blue[i], v))
- return (EFAULT);
+ uint8_t red[2], green[2], blue[2];
+ const uint8_t *ccm = sc->sc_curcmap;
+ cm = &cu->cmap;
+
+ if (cm->index > 2 || cm->count > 2 - cm->index)
+ return EINVAL;
+
+ for (i = 0; i < cm->count; i++) {
+ red[i] = ccm[i + cm->index + 0];
+ green[i] = ccm[i + cm->index + 2];
+ blue[i] = ccm[i + cm->index + 4];
}
+
+ if ((error = copyout(red, cm->red, cm->count)) ||
+ (error = copyout(green, cm->green, cm->count)) ||
+ (error = copyout(blue, cm->blue, cm->count)))
+ return error;
} else {
cu->cmap.index = 0;
cu->cmap.count = 2;
Home |
Main Index |
Thread Index |
Old Index