int spc_pcmcia_enable(device_t self, int onoff) { struct spc_pcmcia_softc *sc = device_private(self); int error; if (onoff) { /* Establish the interrupt handler. */ sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO, spc_intr, &sc->sc_spc); if (!sc->sc_ih) return EIO; error = pcmcia_function_enable(sc->sc_pf); if (error) { pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih); sc->sc_ih = 0; return error; } /* Initialize only chip. */ spc_init(&sc->sc_spc, 0); } else { pcmcia_function_disable(sc->sc_pf); pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih); sc->sc_ih = 0; } return 0; }
static int tr_pcmcia_enable(struct tr_softc *sc) { struct tr_pcmcia_softc *psc = (struct tr_pcmcia_softc *) sc; int ret; sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, tr_intr, psc); if (sc->sc_ih == NULL) { aprint_error_dev(psc->sc_tr.sc_dev, "couldn't establish interrupt\n"); return 1; } ret = pcmcia_function_enable(psc->sc_pf); if (ret != 0) return ret; tr_pcmcia_setup(sc); if (tr_reset(sc)) return 1; if (tr_config(sc)) return 1; return 0; }
int wi_pcmcia_activate(struct device *dev, enum devact act) { struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)dev; struct wi_softc *sc = &psc->sc_wi; struct ifnet *ifp = &sc->sc_ic.ic_if; int s; s = splnet(); switch (act) { case DVACT_ACTIVATE: pcmcia_function_enable(psc->sc_pf); sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, wi_intr, sc, sc->sc_dev.dv_xname); wi_cor_reset(sc); wi_init(sc); break; case DVACT_DEACTIVATE: ifp->if_timer = 0; if (ifp->if_flags & IFF_RUNNING) wi_stop(sc); sc->wi_flags &= ~WI_FLAGS_INITIALIZED; if (sc->sc_ih != NULL) pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); pcmcia_function_disable(psc->sc_pf); break; } splx(s); return (0); }
int wi_pcmcia_activate(struct device *dev, int act) { struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)dev; struct wi_softc *sc = &psc->sc_wi; struct ifnet *ifp = &sc->sc_ic.ic_if; switch (act) { case DVACT_SUSPEND: ifp->if_timer = 0; if (ifp->if_flags & IFF_RUNNING) wi_stop(sc); sc->wi_flags &= ~WI_FLAGS_INITIALIZED; if (sc->sc_ih != NULL) pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); sc->sc_ih = NULL; pcmcia_function_disable(psc->sc_pf); break; case DVACT_RESUME: pcmcia_function_enable(psc->sc_pf); sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, wi_intr, sc, sc->sc_dev.dv_xname); break; case DVACT_WAKEUP: wi_pcmcia_wakeup(sc); break; case DVACT_DEACTIVATE: if (sc->sc_ih != NULL) pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); sc->sc_ih = NULL; pcmcia_function_disable(psc->sc_pf); break; } return (0); }
static int cs_pcmcia_enable(struct cs_softc *sc) { struct cs_pcmcia_softc *psc = (void *)sc; struct pcmcia_function *pf = psc->sc_pf; if (pcmcia_io_map(pf, PCMCIA_WIDTH_AUTO, 0, psc->sc_pcioh.size, &psc->sc_pcioh, &psc->sc_io_window) != 0) { printf("%s: can't map i/o space\n", DEVNAME(sc)); goto fail; } psc->sc_flags |= CS_PCMCIA_FLAGS_IO_MAPPED; if (pcmcia_function_enable(pf)) { printf("%s: can't enable function\n", DEVNAME(sc)); goto fail; } sc->sc_ih = pcmcia_intr_establish(pf, IPL_NET, cs_intr, sc); if (sc->sc_ih == 0) { printf("%s: can't establish interrupt\n", DEVNAME(sc)); goto fail; } return 0; fail: return EIO; }
void fdc_pcmcia_attach(device_t parent, device_t self, void *aux) { struct fdc_pcmcia_softc *psc = device_private(self); struct fdc_softc *fdc = &psc->sc_fdc; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; struct pcmcia_function *pf = pa->pf; struct fdc_attach_args fa; int error; fdc->sc_dev = self; psc->sc_pf = pf; error = pcmcia_function_configure(pf, fdc_pcmcia_validate_config); if (error) { aprint_error_dev(self, "configure failed, error=%d\n", error); return; } cfe = pf->cfe; fdc->sc_iot = cfe->iospace[0].handle.iot; fdc->sc_iot = cfe->iospace[0].handle.ioh; if (pcmcia_function_enable(pf)) goto fail; fdc->sc_flags = FDC_HEADSETTLE; fdc->sc_state = DEVIDLE; TAILQ_INIT(&fdc->sc_drives); if (!fdcfind(fdc->sc_iot, fdc->sc_ioh, 1)) aprint_error_dev(self, "coundn't find fdc\n"); fdc_conf(fdc); /* Establish the interrupt handler. */ fdc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_BIO, fdchwintr, fdc); if (!fdc->sc_ih) goto fail; /* physical limit: four drives per controller. */ for (fa.fa_drive = 0; fa.fa_drive < 4; fa.fa_drive++) { if (fa.fa_drive < 2) fa.fa_deftype = &fd_types[0]; else fa.fa_deftype = NULL; /* unknown */ (void)config_found(self, (void *)&fa, fdprint); } return; fail: pcmcia_function_unconfigure(pf); }
void an_pcmcia_attach(struct device *parent, struct device *self, void *aux) { struct an_pcmcia_softc *psc = (struct an_pcmcia_softc *)self; struct an_softc *sc = (struct an_softc *)self; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; const char *intrstr; int error; psc->sc_pf = pa->pf; cfe = SIMPLEQ_FIRST(&pa->pf->cfe_head); pcmcia_function_init(pa->pf, cfe); if (pcmcia_function_enable(pa->pf)) { printf(": function enable failed\n"); return; } if (pcmcia_io_alloc(pa->pf, 0, AN_IOSIZ, AN_IOSIZ, &psc->sc_pcioh)) { printf(": can't alloc i/o space\n"); pcmcia_function_disable(pa->pf); return; } if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO16, 0, AN_IOSIZ, &psc->sc_pcioh, &psc->sc_io_window)) { printf(": can't map i/o space\n"); pcmcia_io_free(pa->pf, &psc->sc_pcioh); pcmcia_function_disable(pa->pf); return; } sc->sc_iot = psc->sc_pcioh.iot; sc->sc_ioh = psc->sc_pcioh.ioh; sc->sc_enabled = 1; sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, an_intr, sc, sc->sc_dev.dv_xname); intrstr = pcmcia_intr_string(psc->sc_pf, sc->sc_ih); if (*intrstr) printf(", %s", intrstr); printf("\n"); error = an_attach(sc); if (error) { printf("%s: failed to attach controller\n", self->dv_xname); return; } sc->sc_enabled = 0; psc->sc_state = AN_PCMCIA_ATTACHED; }
int cfxga_match(struct device *parent, void *match, void *aux) { struct pcmcia_attach_args *pa = aux; struct pcmcia_function *pf = pa->pf; struct pcmcia_mem_handle h; int rc; int win; bus_addr_t ptr; u_int8_t id = 0; if (pa->product != PCMCIA_PRODUCT_INVALID || pa->manufacturer != PCMCIA_VENDOR_INVALID) return (0); /* Only a card with no CIS will have a fake function... */ if ((pf->pf_flags & PFF_FAKE) == 0) return (0); if (cfxga_install_function(pf) != 0) return (0); if (pcmcia_function_enable(pf) != 0) { DPRINTF(("%s: function enable failed\n")); return (0); } rc = pcmcia_mem_alloc(pf, CFXGA_MEM_RANGE, &h); if (rc != 0) goto out; rc = pcmcia_mem_map(pf, PCMCIA_MEM_ATTR, 0, CFXGA_MEM_RANGE, &h, &ptr, &win); if (rc != 0) goto out2; id = (bus_space_read_1(h.memt, h.memh, ptr + CFREG_REV) & CR_PRODUCT_MASK) >> CR_PRODUCT_SHIFT; pcmcia_mem_unmap(pa->pf, win); out2: pcmcia_mem_free(pa->pf, &h); out: pcmcia_function_disable(pf); cfxga_remove_function(pf); /* * Be sure to return a value greater than pccom's if we match, * otherwise it can win due to the way config(8) will order devices... */ return (id == PRODUCT_S1D13806 ? 10 : 0); }
static int wi_pcmcia_enable(device_t self, int onoff) { struct wi_pcmcia_softc *psc = device_private(self); struct wi_softc *sc = &psc->sc_wi; struct pcmcia_function *pf = psc->sc_pf; int error; if (onoff) { /* establish the interrupt. */ sc->sc_ih = pcmcia_intr_establish(pf, IPL_NET, wi_intr, sc); if (sc->sc_ih == NULL) return EIO; error = pcmcia_function_enable(pf); if (error) { pcmcia_intr_disestablish(pf, sc->sc_ih); sc->sc_ih = NULL; return EIO; } if (psc->sc_symbol_cf) { #if WI_PCMCIA_SPECTRUM24T_FW if (wi_pcmcia_load_firm(sc, spectrum24t_primsym, sizeof(spectrum24t_primsym), spectrum24t_secsym, sizeof(spectrum24t_secsym))) { aprint_error_dev(sc->sc_dev, "couldn't load firmware\n"); wi_pcmcia_enable(self, 0); return EIO; } #else aprint_error_dev(sc->sc_dev, "firmware load not configured\n"); return EIO; #endif } DELAY(1000); } else { pcmcia_function_disable(psc->sc_pf); if (sc->sc_ih != NULL) { pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); sc->sc_ih = NULL; } } return 0; }
int cfxga_activate(struct device *dev, int act) { struct cfxga_softc *sc = (void *)dev; switch (act) { case DVACT_ACTIVATE: pcmcia_function_enable(sc->sc_pf); cfxga_reset_and_repaint(sc); break; case DVACT_DEACTIVATE: pcmcia_function_disable(sc->sc_pf); break; } return (0); }
static int cs_pcmcia_enable(struct cs_softc *sc) { struct cs_pcmcia_softc *psc = (void *)sc; int error; sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, cs_intr, sc); if (!sc->sc_ih) return (EIO); error = pcmcia_function_enable(psc->sc_pf); if (error) { pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); sc->sc_ih = 0; } return (error); }
int cfxga_activate(struct device *dev, enum devact act) { struct cfxga_softc *sc = (void *)dev; switch (act) { case DVACT_ACTIVATE: if (pcmcia_function_enable(sc->sc_pf) != 0) { printf("%s: function enable failed\n", sc->sc_dev.dv_xname); } else { cfxga_reset_and_repaint(sc); } break; case DVACT_DEACTIVATE: pcmcia_function_disable(sc->sc_pf); break; } return (0); }
int gpr_activate(struct device *dev, int act) { struct gpr_softc *sc = (struct gpr_softc *)dev; switch (act) { case DVACT_ACTIVATE: pcmcia_function_enable(sc->sc_pf); sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_TTY, gpr_intr, sc, sc->sc_dev.dv_xname); break; case DVACT_DEACTIVATE: if (sc->sc_ih) pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih); sc->sc_ih = NULL; pcmcia_function_disable(sc->sc_pf); break; } return (0); }
void cfxga_attach(struct device *parent, struct device *self, void *aux) { struct cfxga_softc *sc = (void *)self; struct pcmcia_attach_args *pa = aux; struct pcmcia_function *pf = pa->pf; struct wsemuldisplaydev_attach_args waa; struct wsscreen_descr *wsd; u_int i; LIST_INIT(&sc->sc_scr); sc->sc_nscreens = 0; sc->sc_pf = pf; if (cfxga_install_function(pf) != 0) { printf(": pcmcia function setup failed\n"); return; } if (pcmcia_function_enable(pf)) { printf(": function enable failed\n"); return; } if (pcmcia_mem_alloc(pf, CFXGA_MEM_RANGE, &sc->sc_pmemh) != 0) { printf(": can't allocate memory space\n"); return; } if (pcmcia_mem_map(pf, PCMCIA_MEM_ATTR, 0, CFXGA_MEM_RANGE, &sc->sc_pmemh, &sc->sc_offset, &sc->sc_memwin) != 0) { printf(": can't map frame buffer registers\n"); pcmcia_mem_free(pf, &sc->sc_pmemh); return; } SET(sc->sc_state, CS_MAPPED); printf("\n"); sc->sc_mode = WSDISPLAYIO_MODE_EMUL; /* * We actually defer real initialization to the creation of the * first wsdisplay screen, since we do not know which mode to pick * yet. */ for (wsd = sc->sc_wsd, i = 0; i < CFXGA_NMODES; wsd++, i++) { strlcpy(wsd->name, cfxga_modenames[i], sizeof(wsd->name)); wsd->textops = &sc->sc_ops; sc->sc_scrlist[i] = wsd; } sc->sc_wsl.nscreens = CFXGA_NMODES; sc->sc_wsl.screens = (const struct wsscreen_descr **)sc->sc_scrlist; waa.console = 0; waa.scrdata = &sc->sc_wsl; waa.accessops = &cfxga_accessops; waa.accesscookie = sc; waa.defaultscreens = 1; if ((sc->sc_wsdisplay = config_found(self, &waa, wsemuldisplaydevprint)) == NULL) { /* otherwise wscons will do this */ if (sc->sc_active != NULL) cfxga_clear_screen(sc->sc_active); else cfxga_burner(sc, 0, 0); } }
void gpr_attach(struct device *parent, struct device *self, void *aux) { struct gpr_softc *sc = (void *)self; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; const char *intrstr; for (cfe = SIMPLEQ_FIRST(&pa->pf->cfe_head); cfe; cfe = SIMPLEQ_NEXT(cfe, cfe_list)) { if (!pcmcia_io_alloc(pa->pf, cfe->iospace[0].start, cfe->iospace[0].length, cfe->iospace[0].length, &sc->sc_pioh)) break; } if (cfe == NULL) { printf(": can't alloc i/o space\n"); goto fail_io_alloc; } pcmcia_function_init(pa->pf, cfe); if (pcmcia_function_enable(pa->pf)) { printf(": function enable failed\n"); goto fail_enable; } if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_AUTO, 0, sc->sc_pioh.size, &sc->sc_pioh, &sc->sc_iowin)) { printf(": can't map i/o space\n"); goto fail_io_map; } /* * GPR400 has some registers in attribute memory as well. */ if (pcmcia_mem_alloc(pa->pf, GPR400_MEM_LEN, &sc->sc_pmemh)) { printf(": can't map mem space\n"); goto fail_mem_alloc; } if (pcmcia_mem_map(pa->pf, PCMCIA_MEM_ATTR, pa->pf->ccr_base, GPR400_MEM_LEN, &sc->sc_pmemh, &sc->sc_offset, &sc->sc_memwin)) { printf(": can't map memory\n"); goto fail_mem_map; } sc->sc_pf = pa->pf; sc->sc_iot = sc->sc_pioh.iot; sc->sc_ioh = sc->sc_pioh.ioh; sc->sc_memt = sc->sc_pmemh.memt; sc->sc_memh = sc->sc_pmemh.memh; printf(" port 0x%lx/%d", sc->sc_pioh.addr, sc->sc_pioh.size); sc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_TTY, gpr_intr, sc, sc->sc_dev.dv_xname); intrstr = pcmcia_intr_string(sc->sc_pf, sc->sc_ih); printf("%s%s\n", *intrstr ? ", " : "", intrstr); if (sc->sc_ih != NULL) return; pcmcia_mem_unmap(pa->pf, sc->sc_memwin); fail_mem_map: pcmcia_mem_free(pa->pf, &sc->sc_pmemh); fail_mem_alloc: pcmcia_io_unmap(pa->pf, sc->sc_iowin); fail_io_map: pcmcia_function_disable(pa->pf); fail_enable: pcmcia_io_free(pa->pf, &sc->sc_pioh); fail_io_alloc: return; }
void wi_pcmcia_attach(struct device *parent, struct device *self, void *aux) { struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)self; struct wi_softc *sc = &psc->sc_wi; struct pcmcia_attach_args *pa = aux; struct pcmcia_function *pf = pa->pf; struct pcmcia_config_entry *cfe = SIMPLEQ_FIRST(&pf->cfe_head); const char *intrstr; int state = 0; psc->sc_pf = pf; /* Enable the card. */ pcmcia_function_init(pf, cfe); if (pcmcia_function_enable(pf)) { printf(": function enable failed\n"); goto bad; } state++; if (pcmcia_io_alloc(pf, 0, WI_IOSIZ, WI_IOSIZ, &psc->sc_pcioh)) { printf(": can't alloc i/o space\n"); goto bad; } state++; if (pcmcia_io_map(pf, PCMCIA_WIDTH_IO16, 0, WI_IOSIZ, &psc->sc_pcioh, &psc->sc_io_window)) { printf(": can't map io space\n"); goto bad; } state++; printf(" port 0x%lx/%lu", psc->sc_pcioh.addr, (u_long)psc->sc_pcioh.size); sc->wi_ltag = sc->wi_btag = psc->sc_pcioh.iot; sc->wi_lhandle = sc->wi_bhandle = psc->sc_pcioh.ioh; sc->wi_cor_offset = WI_COR_OFFSET; sc->wi_flags |= WI_FLAGS_BUS_PCMCIA; /* Make sure interrupts are disabled. */ CSR_WRITE_2(sc, WI_INT_EN, 0); CSR_WRITE_2(sc, WI_EVENT_ACK, 0xffff); /* Establish the interrupt. */ sc->sc_ih = pcmcia_intr_establish(pa->pf, IPL_NET, wi_intr, psc, sc->sc_dev.dv_xname); if (sc->sc_ih == NULL) { printf("%s: couldn't establish interrupt\n", sc->sc_dev.dv_xname); goto bad; } intrstr = pcmcia_intr_string(psc->sc_pf, sc->sc_ih); printf("%s%s\n", *intrstr ? ", " : "", intrstr); if (wi_attach(sc, &wi_func_io) == 0) return; /* wi_attach() failed, do some cleanup */ pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); sc->sc_ih = NULL; bad: if (state > 2) pcmcia_io_unmap(pf, psc->sc_io_window); if (state > 1) pcmcia_io_free(pf, &psc->sc_pcioh); if (state > 0) pcmcia_function_disable(pf); }
static void tr_pcmcia_attach(device_t parent, device_t self, void *aux) { struct tr_pcmcia_softc *psc = device_private(self); struct tr_softc *sc = &psc->sc_tr; struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; bus_size_t offset; psc->sc_pf = pa->pf; cfe = SIMPLEQ_FIRST(&pa->pf->cfe_head); pcmcia_function_init(pa->pf, cfe); if (pcmcia_function_enable(pa->pf) != 0) { aprint_error_dev(self, "function enable failed\n"); return; } if (pcmcia_io_alloc(pa->pf, cfe->iospace[0].start, cfe->iospace[0].length, cfe->iospace[0].length, &psc->sc_pioh) != 0) { aprint_error_dev(self, "can't allocate pio space\n"); goto fail1; } if (pcmcia_io_map(psc->sc_pf, PCMCIA_WIDTH_IO8, /* XXX _AUTO? */ &psc->sc_pioh, &psc->sc_pio_window) != 0) { aprint_error_dev(self, "can't map pio space\n"); goto fail2; } if (pcmcia_mem_alloc(psc->sc_pf, TR_SRAM_SIZE, &psc->sc_sramh) != 0) { aprint_error_dev(self, "can't allocate sram space\n"); goto fail3; } if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_COMMON, TR_PCMCIA_SRAM_ADDR, TR_SRAM_SIZE, &psc->sc_sramh, &offset, &psc->sc_sram_window) != 0) { aprint_error_dev(self, "can't map sram space\n"); goto fail4; } if (pcmcia_mem_alloc(psc->sc_pf, TR_MMIO_SIZE, &psc->sc_mmioh) != 0) { aprint_error_dev(self, "can't allocate mmio space\n"); goto fail5; return; } if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_COMMON, TR_PCMCIA_MMIO_ADDR, TR_MMIO_SIZE, &psc->sc_mmioh, &offset, &psc->sc_mmio_window) != 0) { aprint_error_dev(self, "can't map mmio space\n"); goto fail6; } sc->sc_piot = psc->sc_pioh.iot; sc->sc_pioh = psc->sc_pioh.ioh; sc->sc_memt = psc->sc_sramh.memt; sc->sc_sramh = psc->sc_sramh.memh; sc->sc_mmioh = psc->sc_mmioh.memh; sc->sc_init_status = RSP_16; sc->sc_memwinsz = TR_SRAM_SIZE; sc->sc_memsize = TR_SRAM_SIZE; sc->sc_memreserved = 0; sc->sc_aca = TR_ACA_OFFSET; sc->sc_maddr = TR_PCMCIA_SRAM_ADDR; sc->sc_mediastatus = tr_pcmcia_mediastatus; sc->sc_mediachange = tr_pcmcia_mediachange; sc->sc_enable = tr_pcmcia_enable; sc->sc_disable = tr_pcmcia_disable; tr_pcmcia_setup(sc); if (tr_reset(sc) == 0) (void)tr_attach(sc); pcmcia_function_disable(pa->pf); sc->sc_enabled = 0; return; fail6: pcmcia_mem_free(psc->sc_pf, &psc->sc_mmioh); fail5: pcmcia_mem_unmap(psc->sc_pf, psc->sc_sram_window); fail4: pcmcia_mem_free(psc->sc_pf, &psc->sc_sramh); fail3: pcmcia_io_unmap(psc->sc_pf, psc->sc_pio_window); fail2: pcmcia_io_free(psc->sc_pf, &psc->sc_pioh); fail1: pcmcia_function_disable(pa->pf); sc->sc_enabled = 0; }
int slhci_pcmcia_enable(struct slhci_pcmcia_softc *psc, int enable) { struct pcmcia_function *pf; struct pcmcia_io_handle *pioh; struct slhci_softc *sc; int error; pf = psc->sc_pf; sc = &psc->sc_slhci; if (enable) { if (psc->sc_flags & PFL_ENABLED) return 0; error = pcmcia_function_configure(pf, slhci_pcmcia_validate_config); if (error) { printf("%s: configure failed, error=%d\n", SC_NAME(sc), error); return 1; } pioh = &pf->cfe->iospace[0].handle; /* The data port is repeated three times; using a stride of * 2 prevents read/write errors on a Clio C-1000 hpcmips * system. */ slhci_preinit(sc, NULL, pioh->iot, pioh->ioh, 100, 2); psc->sc_ih = pcmcia_intr_establish(pf, IPL_USB, slhci_intr, sc); if (psc->sc_ih == NULL) { printf("%s: unable to establish interrupt\n", SC_NAME(sc)); goto fail1; } if (pcmcia_function_enable(pf)) { printf("%s: function enable failed\n", SC_NAME(sc)); goto fail2; } if (slhci_attach(sc)) { printf("%s: slhci_attach failed\n", SC_NAME(sc)); goto fail3; } psc->sc_flags |= PFL_ENABLED; return 0; } else { if (!(psc->sc_flags & PFL_ENABLED)) return 1; psc->sc_flags &= ~PFL_ENABLED; fail3: pcmcia_function_disable(pf); fail2: pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih); fail1: pcmcia_function_unconfigure(pf); return 1; } }