Module Name: src Committed By: tsutsui Date: Wed Feb 14 12:59:44 UTC 2024
Modified Files: src/sys/dev/dec: lk201_ws.c lk201var.h Log Message: Use proper macro for return values and remove #if 0'ed out block. Mostly from OpenBSD/vax. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dec/lk201_ws.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dec/lk201var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/dec/lk201_ws.c diff -u src/sys/dev/dec/lk201_ws.c:1.10 src/sys/dev/dec/lk201_ws.c:1.11 --- src/sys/dev/dec/lk201_ws.c:1.10 Mon Jul 11 10:55:35 2016 +++ src/sys/dev/dec/lk201_ws.c Wed Feb 14 12:59:44 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lk201_ws.c,v 1.10 2016/07/11 10:55:35 skrll Exp $ */ +/* $NetBSD: lk201_ws.c,v 1.11 2024/02/14 12:59:44 tsutsui Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lk201_ws.c,v 1.10 2016/07/11 10:55:35 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lk201_ws.c,v 1.11 2024/02/14 12:59:44 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -133,17 +133,10 @@ lk201_decode(struct lk201_state *lks, in } switch (datain) { -#if 0 - case LK_KEY_UP: - for (i = 0; i < LK_KLL; i++) - lks->down_keys_list[i] = -1; - *type = WSCONS_EVENT_ALL_KEYS_UP; - return (1); -#endif case LK_POWER_UP: printf("lk201_decode: powerup detected\n"); lk201_init(lks); - return (0); + return LKD_NODATA; case LK_KDOWN_ERROR: case LK_POWER_ERROR: case LK_OUTPUT_ERROR: @@ -152,7 +145,7 @@ lk201_decode(struct lk201_state *lks, in /* FALLTHRU */ case LK_KEY_REPEAT: /* autorepeat handled by wskbd */ case LK_MODE_CHANGE: /* ignore silently */ - return (0); + return LKD_NODATA; } @@ -164,18 +157,18 @@ lk201_decode(struct lk201_state *lks, in *dataout = lks->down_keys_list[i] - MIN_LK201_KEY; lks->down_keys_list[i] = -1; - return (LKD_MORE); + return LKD_MORE; } - return (LKD_NODATA); + return LKD_NODATA; } else { for (i = 0; i < LK_KLL; i++) lks->down_keys_list[i] = -1; *type = WSCONS_EVENT_ALL_KEYS_UP; - return (LKD_COMPLETE); + return LKD_COMPLETE; } } else if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) { printf("lk201_decode: %x\n", datain); - return (0); + return LKD_NODATA; } *dataout = datain - MIN_LK201_KEY; @@ -185,7 +178,7 @@ lk201_decode(struct lk201_state *lks, in if (lks->down_keys_list[i] == datain) { *type = WSCONS_EVENT_KEY_UP; lks->down_keys_list[i] = -1; - return (1); + return LKD_COMPLETE; } if (lks->down_keys_list[i] == -1 && freeslot == -1) freeslot = i; @@ -193,12 +186,12 @@ lk201_decode(struct lk201_state *lks, in if (freeslot == -1) { printf("lk201_decode: down(%d) no free slot\n", datain); - return (0); + return LKD_NODATA; } *type = WSCONS_EVENT_KEY_DOWN; lks->down_keys_list[freeslot] = datain; - return (1); + return LKD_COMPLETE; } void Index: src/sys/dev/dec/lk201var.h diff -u src/sys/dev/dec/lk201var.h:1.7 src/sys/dev/dec/lk201var.h:1.8 --- src/sys/dev/dec/lk201var.h:1.7 Fri Jan 2 21:32:26 2015 +++ src/sys/dev/dec/lk201var.h Wed Feb 14 12:59:44 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lk201var.h,v 1.7 2015/01/02 21:32:26 jklos Exp $ */ +/* $NetBSD: lk201var.h,v 1.8 2024/02/14 12:59:44 tsutsui Exp $ */ /* * Copyright (c) 1998 @@ -54,7 +54,7 @@ void lk201_bell(struct lk201_state *, st void lk201_set_leds(struct lk201_state *, int); void lk201_set_keyclick(struct lk201_state *, int); +/* Values returned by lk201_decode */ #define LKD_NODATA 0x00 #define LKD_COMPLETE 0x01 #define LKD_MORE 0x02 -