pccard.c (127135) | pccard.c (133865) |
---|---|
1/* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */ 2 3/* 4 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> | 1/* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */ 2 3/* 4 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/pccard/pccard.c 127135 2004-03-17 17:50:55Z njl $"); | 33__FBSDID("$FreeBSD: head/sys/dev/pccard/pccard.c 133865 2004-08-16 15:57:18Z imp $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/module.h> 39#include <sys/kernel.h> 40#include <sys/queue.h> 41#include <sys/sysctl.h> --- 105 unchanged lines hidden (view full) --- 147 pf->pf_ccr_offset + ccr, val); 148 } 149} 150 151static int 152pccard_set_default_descr(device_t dev) 153{ 154 const char *vendorstr, *prodstr; | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/module.h> 39#include <sys/kernel.h> 40#include <sys/queue.h> 41#include <sys/sysctl.h> --- 105 unchanged lines hidden (view full) --- 147 pf->pf_ccr_offset + ccr, val); 148 } 149} 150 151static int 152pccard_set_default_descr(device_t dev) 153{ 154 const char *vendorstr, *prodstr; |
155 uint32_t vendor, prod; |
|
155 char *str; 156 157 if (pccard_get_vendor_str(dev, &vendorstr)) 158 return (0); 159 if (pccard_get_product_str(dev, &prodstr)) 160 return (0); | 156 char *str; 157 158 if (pccard_get_vendor_str(dev, &vendorstr)) 159 return (0); 160 if (pccard_get_product_str(dev, &prodstr)) 161 return (0); |
161 str = malloc(strlen(vendorstr) + strlen(prodstr) + 2, M_DEVBUF, 162 M_WAITOK); 163 sprintf(str, "%s %s", vendorstr, prodstr); 164 device_set_desc_copy(dev, str); 165 free(str, M_DEVBUF); | 162 if (vendorstr != NULL && prodstr != NULL) { 163 str = malloc(strlen(vendorstr) + strlen(prodstr) + 2, M_DEVBUF, 164 M_WAITOK); 165 sprintf(str, "%s %s", vendorstr, prodstr); 166 device_set_desc_copy(dev, str); 167 free(str, M_DEVBUF); 168 } else { 169 if (pccard_get_vendor(dev, &vendor)) 170 return (0); 171 if (pccard_get_product(dev, &prod)) 172 return (0); 173 str = malloc(100, M_DEVBUF, M_WAITOK); 174 snprintf(str, 100, "vendor=0x%x product=0x%x", vendor, prod); 175 device_set_desc_copy(dev, str); 176 free(str, M_DEVBUF); 177 } |
166 return (0); 167} 168 169static int 170pccard_attach_card(device_t dev) 171{ 172 struct pccard_softc *sc = PCCARD_SOFTC(dev); 173 struct pccard_function *pf; --- 187 unchanged lines hidden (view full) --- 361 vendor != ent->pp_vendor) 362 matches = 0; 363 if (matches && ent->pp_product != PCCARD_PRODUCT_ANY && 364 prod != ent->pp_product) 365 matches = 0; 366 if (matches && fcn != ent->pp_expfunc) 367 matches = 0; 368 if (matches && ent->pp_cis[0] && | 178 return (0); 179} 180 181static int 182pccard_attach_card(device_t dev) 183{ 184 struct pccard_softc *sc = PCCARD_SOFTC(dev); 185 struct pccard_function *pf; --- 187 unchanged lines hidden (view full) --- 373 vendor != ent->pp_vendor) 374 matches = 0; 375 if (matches && ent->pp_product != PCCARD_PRODUCT_ANY && 376 prod != ent->pp_product) 377 matches = 0; 378 if (matches && fcn != ent->pp_expfunc) 379 matches = 0; 380 if (matches && ent->pp_cis[0] && |
369 strcmp(ent->pp_cis[0], vendorstr) != 0) | 381 (vendorstr == NULL || 382 strcmp(ent->pp_cis[0], vendorstr) != 0)) |
370 matches = 0; 371 if (matches && ent->pp_cis[1] && | 383 matches = 0; 384 if (matches && ent->pp_cis[1] && |
372 strcmp(ent->pp_cis[1], prodstr) != 0) | 385 (prodstr == NULL || 386 strcmp(ent->pp_cis[1], prodstr) != 0)) |
373 matches = 0; 374 /* XXX need to match cis[2] and cis[3] also XXX */ 375 if (matchfn != NULL) 376 matches = (*matchfn)(dev, ent, matches); 377 if (matches) 378 return (ent); 379 } 380 return (NULL); --- 976 unchanged lines hidden --- | 387 matches = 0; 388 /* XXX need to match cis[2] and cis[3] also XXX */ 389 if (matchfn != NULL) 390 matches = (*matchfn)(dev, ent, matches); 391 if (matches) 392 return (ent); 393 } 394 return (NULL); --- 976 unchanged lines hidden --- |