Avoid adding another member to the softc and use sc_flags instead.

NFCI.
This commit is contained in:
nat 2023-08-08 17:31:13 +00:00
parent 815776a21a
commit 5bacd30de6
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hd44780_subr.c,v 1.23 2023/08/08 16:32:39 nat Exp $ */
/* $NetBSD: hd44780_subr.c,v 1.24 2023/08/08 17:31:13 nat Exp $ */
/*
* Copyright (c) 2002 Dennis I. Chernoivanov
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.23 2023/08/08 16:32:39 nat Exp $");
__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.24 2023/08/08 17:31:13 nat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -458,7 +458,8 @@ hd44780_chipinit(struct hd44780_chip *sc, uint32_t en)
hd44780_ir_write(sc, en, cmd_ddramset(0x5));
hd44780_ir_write(sc, en, cmd_shift(0, 1));
hd44780_busy_wait(sc, en);
if (!sc->sc_writeonly && (dat = hd44780_ir_read(sc, en) & 0x7f) != 0x6) {
if (!(sc->sc_flags & HD_WRITEONLY) &&
(dat = hd44780_ir_read(sc, en) & 0x7f) != 0x6) {
sc->sc_dev_ok = 0;
sc->sc_flags &= ~HD_UP;
return EIO;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hd44780var.h,v 1.10 2023/08/08 16:32:39 nat Exp $ */
/* $NetBSD: hd44780var.h,v 1.11 2023/08/08 17:31:13 nat Exp $ */
/*
* Copyright (c) 2002 Dennis I. Chernoivanov
@ -97,6 +97,7 @@ struct hd44780_chip {
#define HD_UP 0x10 /* if set, lcd has been initialized */
#define HD_TIMEDOUT 0x20 /* lcd has recently stopped talking */
#define HD_MULTICHIP 0x40 /* two HD44780 controllers (4-line) */
#define HD_WRITEONLY 0x80 /* write only if set */
uint8_t sc_flags;
uint8_t sc_cols; /* visible columns */
@ -118,7 +119,6 @@ struct hd44780_chip {
void (* sc_writereg)(struct hd44780_chip *, uint32_t, uint32_t,
uint8_t);
uint8_t (* sc_readreg)(struct hd44780_chip *, uint32_t, uint32_t);
bool sc_writeonly; /* Output only device */
};
#define hd44780_ir_write(sc, en, dat) \