From: kettenis Date: Wed, 31 Aug 2022 15:14:01 +0000 (+0000) Subject: Introduce iic_intr_disestablish() and use it in ihidev(4). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d36891302982b78f8cc3f1cfa46408d6f898f1c7;p=openbsd Introduce iic_intr_disestablish() and use it in ihidev(4). ok jcs@ --- diff --git a/sys/dev/acpi/dwiic_acpi.c b/sys/dev/acpi/dwiic_acpi.c index 23b427b2bb4..ad8b9776116 100644 --- a/sys/dev/acpi/dwiic_acpi.c +++ b/sys/dev/acpi/dwiic_acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic_acpi.c,v 1.19 2022/04/06 18:59:27 naddy Exp $ */ +/* $OpenBSD: dwiic_acpi.c,v 1.20 2022/08/31 15:14:01 kettenis Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -173,6 +173,7 @@ dwiic_acpi_attach(struct device *parent, struct device *self, void *aux) sc->sc_i2c_tag.ic_release_bus = dwiic_i2c_release_bus; sc->sc_i2c_tag.ic_exec = dwiic_i2c_exec; sc->sc_i2c_tag.ic_intr_establish = dwiic_i2c_intr_establish; + sc->sc_i2c_tag.ic_intr_disestablish = dwiic_i2c_intr_disestablish; sc->sc_i2c_tag.ic_intr_string = dwiic_i2c_intr_string; bzero(&sc->sc_iba, sizeof(sc->sc_iba)); @@ -312,6 +313,13 @@ dwiic_i2c_intr_establish(void *cookie, void *ih, int level, level, func, arg, name); } +void +dwiic_i2c_intr_disestablish(void *cookie, void *ih) +{ + /* XXX GPIO interrupts */ + acpi_intr_disestablish(ih); +} + const char * dwiic_i2c_intr_string(void *cookie, void *ih) { diff --git a/sys/dev/i2c/i2cvar.h b/sys/dev/i2c/i2cvar.h index 72469227e8b..346337a3e56 100644 --- a/sys/dev/i2c/i2cvar.h +++ b/sys/dev/i2c/i2cvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i2cvar.h,v 1.18 2022/02/09 07:58:24 visa Exp $ */ +/* $OpenBSD: i2cvar.h,v 1.19 2022/08/31 15:14:01 kettenis Exp $ */ /* $NetBSD: i2cvar.h,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */ /* @@ -93,6 +93,7 @@ typedef struct i2c_controller { void *(*ic_intr_establish)(void *, void *, int, int (*)(void *), void *, const char *); + void (*ic_intr_disestablish)(void *, void *); const char *(*ic_intr_string)(void *, void *); } *i2c_tag_t; @@ -161,6 +162,8 @@ int iic_smbus_receive_byte(i2c_tag_t, i2c_addr_t, uint8_t *, int); #define iic_intr_establish(ic, ih, level, func, arg, name) \ (*(ic)->ic_intr_establish)((ic)->ic_cookie, (ih), (level), \ (func), (arg), (name)) +#define iic_intr_disestablish(ic, ih) \ + (*(ic)->ic_intr_disestablish)((ic)->ic_cookie, (ih)) #define iic_intr_string(ic, ih) \ (*(ic)->ic_intr_string)((ic)->ic_cookie, (ih)) diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index 2d1d7e48913..233739404d1 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.27 2022/05/20 05:03:45 anton Exp $ */ +/* $OpenBSD: ihidev.c,v 1.28 2022/08/31 15:14:01 kettenis Exp $ */ /* * HID-over-i2c driver * @@ -211,7 +211,7 @@ ihidev_detach(struct device *self, int flags) struct ihidev_softc *sc = (struct ihidev_softc *)self; if (sc->sc_ih != NULL) { - intr_disestablish(sc->sc_ih); + iic_intr_disestablish(sc->sc_tag, sc->sc_ih); sc->sc_ih = NULL; } diff --git a/sys/dev/ic/dwiicvar.h b/sys/dev/ic/dwiicvar.h index 275e652f917..ea718914a30 100644 --- a/sys/dev/ic/dwiicvar.h +++ b/sys/dev/ic/dwiicvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiicvar.h,v 1.4 2020/02/18 12:13:39 mpi Exp $ */ +/* $OpenBSD: dwiicvar.h,v 1.5 2022/08/31 15:14:01 kettenis Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -90,6 +90,7 @@ int dwiic_intr(void *); void * dwiic_i2c_intr_establish(void *, void *, int, int (*)(void *), void *, const char *); +void dwiic_i2c_intr_disestablish(void *, void *); const char * dwiic_i2c_intr_string(void *, void *); int dwiic_i2c_print(void *, const char *);