Date: Wed, 14 Jul 1999 01:24:20 -0600 From: Warner Losh <imp@village.org> To: mobile@freebsd.org Subject: More verbose errors from pccard Message-ID: <199907140724.BAA53478@harmony.village.org>
next in thread | raw e-mail | index | archive | help
Here are some preliminary patches to improve the error reporting when things go wrong. I've added error messages as well as changing the return value for unknown ioctls from EINVAL to ENOTTY. What comments do people have? Warner Index: pccard.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pccard/pccard.c,v retrieving revision 1.80 diff -u -r1.80 pccard.c --- pccard.c 1999/05/31 11:28:48 1.80 +++ pccard.c 1999/07/14 07:19:48 @@ -590,11 +590,19 @@ * against the slot interrupt (if one has been allocated). */ if (desc->irqmask && drv->imask) { - if ((slt->ctrl->irqs & desc->irqmask) == 0) + if ((slt->ctrl->irqs & desc->irqmask) == 0) { + printf("pccard: PIOCSDRV requested irq (mask 0x%x) is " + "not free (available mask 0x%x)\n", desc->irqmask, + slt->ctrl->irqs); return(EINVAL); + } if (slt->irq) { - if (((1 << slt->irq) & desc->irqmask) == 0) + if (((1 << slt->irq) & desc->irqmask) == 0) { + printf("pccard: PIOSCDRIV irq %d not in " + "available mask 0x%x\n", slt->irq, + desc->irqmask); return(EINVAL); + } slt->irqref++; irq = slt->irq; } else { @@ -606,8 +614,11 @@ irq = pccard_alloc_intr(desc->irqmask, slot_irq_handler, (int)slt, drv->imask, slt->ctrl->imask); - if (irq < 0) + if (irq < 0) { + printf("pccard_alloc_intr failed for irq %d\n", + irq); return(EINVAL); + } slt->irq = irq; slt->irqref = 1; slt->ctrl->mapirq(slt, slt->irq); @@ -650,8 +661,10 @@ * the error. We assume that when we free the device, * it will also set 'running' to off. */ - if (err) + if (err) { + printf("Enable failed %d\n", err); remove_device(devi); + } return(err); } @@ -926,7 +939,7 @@ default: if (slt->ctrl->ioctl) return(slt->ctrl->ioctl(slt, cmd, data)); - return(EINVAL); + return(ENOTTY); /* * Get slot state. */ Index: pcic.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pccard/pcic.c,v retrieving revision 1.72 diff -u -r1.72 pcic.c --- pcic.c 1999/05/02 21:45:31 1.72 +++ pcic.c 1999/07/13 22:01:36 @@ -854,7 +858,7 @@ switch(cmd) { default: - return(EINVAL); + return(ENOTTY); /* * Get/set PCIC registers */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907140724.BAA53478>