Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons Constify. Drivers pass const default calibra...
details: https://anonhg.NetBSD.org/src/rev/80ddb39cd3d4
branches: trunk
changeset: 581369:80ddb39cd3d4
user: uwe <uwe%NetBSD.org@localhost>
date: Wed Jun 01 00:02:17 2005 +0000
description:
Constify. Drivers pass const default calibration data to
WSMOUSEIO_SCALIBCOORDS using __UNCONST, so make sure we don't try to
modify it.
diffstat:
sys/dev/wscons/mra.c | 17 ++++++++++-------
sys/dev/wscons/tpcalib.c | 16 ++++++++--------
2 files changed, 18 insertions(+), 15 deletions(-)
diffs (104 lines):
diff -r ce2e8634aed4 -r 80ddb39cd3d4 sys/dev/wscons/mra.c
--- a/sys/dev/wscons/mra.c Tue May 31 23:37:47 2005 +0000
+++ b/sys/dev/wscons/mra.c Wed Jun 01 00:02:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mra.c,v 1.1 2004/05/28 17:52:06 tsarna Exp $ */
+/* $NetBSD: mra.c,v 1.2 2005/06/01 00:02:17 uwe Exp $ */
/*
* Copyright (c) 1999 Shin Takemura All rights reserved.
@@ -28,21 +28,24 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.1 2004/05/28 17:52:06 tsarna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.2 2005/06/01 00:02:17 uwe Exp $");
#include <sys/param.h>
#include <sys/systm.h>
-int mra_Y_AX1_BX2_C(int *, int, int *, int, int *, int, int, int, int *,
- int *, int *);
+extern int mra_Y_AX1_BX2_C(const int *, int,
+ const int *, int, const int *, int, int, int,
+ int *, int *, int *);
/*
* multiple regression analysis
* Y = AX1 + BX2 + C
*/
int
-mra_Y_AX1_BX2_C(int *y, int ys, int *x1, int x1s, int *x2, int x2s, int n,
- int scale, int *a, int *b, int *c)
+mra_Y_AX1_BX2_C(const int *y, int ys,
+ const int *x1, int x1s, const int *x2, int x2s,
+ int n, int scale,
+ int *a, int *b, int *c)
{
int i;
int64_t X1a, X2a, Ya;
@@ -51,7 +54,7 @@
int64_t S11, S22, S12;
int64_t SYY, S1Y, S2Y;
int64_t A, B, C, M;
-#define AA(p, s, i) (*((long*)(((char*)(p)) + (s) * (i))))
+#define AA(p, s, i) (*((const long *)(((const char *)(p)) + (s) * (i))))
#define X1(i) AA(x1, x1s, i)
#define X2(i) AA(x2, x2s, i)
#define Y(i) AA(y, ys, i)
diff -r ce2e8634aed4 -r 80ddb39cd3d4 sys/dev/wscons/tpcalib.c
--- a/sys/dev/wscons/tpcalib.c Tue May 31 23:37:47 2005 +0000
+++ b/sys/dev/wscons/tpcalib.c Wed Jun 01 00:02:17 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tpcalib.c,v 1.4 2005/05/31 23:37:47 uwe Exp $ */
+/* $NetBSD: tpcalib.c,v 1.5 2005/06/01 00:02:17 uwe Exp $ */
/*
* Copyright (c) 1999-2003 TAKEMURA Shin All rights reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tpcalib.c,v 1.4 2005/05/31 23:37:47 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpcalib.c,v 1.5 2005/06/01 00:02:17 uwe Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -46,8 +46,9 @@
#endif
/* mra is defined in mra.c */
-extern int mra_Y_AX1_BX2_C(int *, int, int *, int, int *, int, int, int, int *,
- int *, int *);
+extern int mra_Y_AX1_BX2_C(const int *, int,
+ const int *, int, const int *, int, int, int,
+ int *, int *, int *);
#define SCALE (1024*256)
@@ -88,13 +89,13 @@
tpcalib_ioctl(struct tpcalib_softc *sc, u_long cmd, caddr_t data, int flag,
struct proc *p)
{
- struct wsmouse_calibcoords *d;
+ const struct wsmouse_calibcoords *d;
int s;
switch (cmd) {
case WSMOUSEIO_SCALIBCOORDS:
s = sizeof(struct wsmouse_calibcoord);
- d = (struct wsmouse_calibcoords *)data;
+ d = (const struct wsmouse_calibcoords *)data;
if (d->samplelen == WSMOUSE_CALIBCOORDS_RESET) {
tpcalib_reset(sc);
} else
@@ -129,8 +130,7 @@
break;
case WSMOUSEIO_GCALIBCOORDS:
- d = (struct wsmouse_calibcoords *)data;
- *d = sc->sc_saved;
+ *(struct wsmouse_calibcoords *)data = sc->sc_saved;
break;
default:
Home |
Main Index |
Thread Index |
Old Index