From 922b79e1c87aa2ccc62307a25b3504212cf15c16 Mon Sep 17 00:00:00 2001 From: stsp Date: Sun, 11 Oct 2015 10:22:28 +0000 Subject: [PATCH] Add a symbolic name for the special '-1' value of iwm's sc_wantresp. ok phessler --- sys/dev/pci/if_iwm.c | 10 +++++----- sys/dev/pci/if_iwmvar.h | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 7f7c26b8b4f..d41b60d0e01 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.54 2015/10/10 19:04:57 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.55 2015/10/11 10:22:28 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh @@ -3374,7 +3374,7 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd) /* if the command wants an answer, busy sc_cmd_resp */ if (wantresp) { KASSERT(!async); - while (sc->sc_wantresp != -1) + while (sc->sc_wantresp != IWM_CMD_RESP_IDLE) tsleep(&sc->sc_wantresp, 0, "iwmcmdsl", 0); sc->sc_wantresp = ring->qid << 16 | ring->cur; DPRINTFN(12, ("wantresp is %x\n", sc->sc_wantresp)); @@ -3573,10 +3573,10 @@ iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint8_t id, void iwm_free_resp(struct iwm_softc *sc, struct iwm_host_cmd *hcmd) { - KASSERT(sc->sc_wantresp != -1); + KASSERT(sc->sc_wantresp != IWM_CMD_RESP_IDLE); KASSERT((hcmd->flags & (IWM_CMD_WANT_SKB|IWM_CMD_SYNC)) == (IWM_CMD_WANT_SKB|IWM_CMD_SYNC)); - sc->sc_wantresp = -1; + sc->sc_wantresp = IWM_CMD_RESP_IDLE; wakeup(&sc->sc_wantresp); } @@ -6452,7 +6452,7 @@ iwm_attach(struct device *parent, struct device *self, void *aux) } printf(", %s\n", intrstr); - sc->sc_wantresp = -1; + sc->sc_wantresp = IWM_CMD_RESP_IDLE; switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_INTEL_WL_3160_1: diff --git a/sys/dev/pci/if_iwmvar.h b/sys/dev/pci/if_iwmvar.h index 7644ec8f306..8ac2ce17ed8 100644 --- a/sys/dev/pci/if_iwmvar.h +++ b/sys/dev/pci/if_iwmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwmvar.h,v 1.10 2015/10/05 13:05:08 stsp Exp $ */ +/* $OpenBSD: if_iwmvar.h,v 1.11 2015/10/11 10:22:28 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh @@ -301,6 +301,9 @@ struct iwm_ucode_status { int uc_intr; }; +/* sc_wantresp */ +#define IWM_CMD_RESP_IDLE -1 + #define IWM_CMD_RESP_MAX PAGE_SIZE #define IWM_OTP_LOW_IMAGE_SIZE 2048 -- 2.20.1