int radioioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) { struct radio_softc *sc; int unit, error; unit = RADIOUNIT(dev); if (unit >= radio_cd.cd_ndevs || (sc = radio_cd.cd_devs[unit]) == NULL || sc->hw_if == NULL) return (ENXIO); error = EOPNOTSUPP; switch (cmd) { case RIOCGINFO: if (sc->hw_if->get_info) error = (sc->hw_if->get_info)(sc->hw_hdl, (struct radio_info *)data); break; case RIOCSINFO: if (sc->hw_if->set_info) error = (sc->hw_if->set_info)(sc->hw_hdl, (struct radio_info *)data); break; case RIOCSSRCH: if (sc->hw_if->search) error = (sc->hw_if->search)(sc->hw_hdl, *(int *)data); break; default: error = EINVAL; } return (error); }
static int radioioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) { struct radio_softc *sc; int unit, error; unit = RADIOUNIT(dev); sc = device_lookup_private(&radio_cd, unit); if (sc == NULL || sc->hw_if == NULL) return (ENXIO); error = EOPNOTSUPP; switch (cmd) { case RIOCGINFO: if (sc->hw_if->get_info) error = (sc->hw_if->get_info)(sc->hw_hdl, (struct radio_info *)data); break; case RIOCSINFO: if (sc->hw_if->set_info) error = (sc->hw_if->set_info)(sc->hw_hdl, (struct radio_info *)data); break; case RIOCSSRCH: if (sc->hw_if->search) error = (sc->hw_if->search)(sc->hw_hdl, *(int *)data); break; default: error = EINVAL; } return (error); }
int radioclose(dev_t dev, int flags, int fmt, struct proc *p) { struct radio_softc *sc; sc = radio_cd.cd_devs[RADIOUNIT(dev)]; if (sc->hw_if->close != NULL) return (sc->hw_if->close(sc->hw_hdl, flags, fmt, p)); else return (0); }
static int radioclose(dev_t dev, int flags, int fmt, struct lwp *l) { struct radio_softc *sc; sc = device_lookup_private(&radio_cd, RADIOUNIT(dev)); if (sc->hw_if->close != NULL) return (sc->hw_if->close(sc->hw_hdl, flags, fmt, l->l_proc)); else return (0); }
static int radioopen(dev_t dev, int flags, int fmt, struct lwp *l) { int unit; struct radio_softc *sc; unit = RADIOUNIT(dev); sc = device_lookup_private(&radio_cd, unit); if (sc == NULL || sc->hw_if == NULL) return (ENXIO); if (sc->hw_if->open != NULL) return (sc->hw_if->open(sc->hw_hdl, flags, fmt, l->l_proc)); else return (0); }
int radioopen(dev_t dev, int flags, int fmt, struct proc *p) { int unit; struct radio_softc *sc; unit = RADIOUNIT(dev); if (unit >= radio_cd.cd_ndevs || (sc = radio_cd.cd_devs[unit]) == NULL || sc->hw_if == NULL) return (ENXIO); if (sc->hw_if->open != NULL) return (sc->hw_if->open(sc->hw_hdl, flags, fmt, p)); else return (0); }