Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Aug 2010 22:33:38 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        hackers@freebsd.org
Subject:   Why doesn't ppc(4) check non-ENXIO failures during probe?
Message-ID:  <AANLkTinMSdRh0T4aWpZ4gR%2BRogzHQS5Vz7f6O1_vozvo@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
    One thing that's puzzling me about the ppc(4) driver's ISA
routines is that it only checks to see whether or not the device has
an IO error:

(from sys/dev/ppc/ppc_isa.c)

@@ -121,8 +121,8 @@
 	parent = device_get_parent(dev);

 	error = ISA_PNP_PROBE(parent, dev, lpc_ids);
	if (error == ENXIO)
		return (ENXIO);
 	if (error != 0)		/* XXX shall be set after detection */
 		device_set_desc(dev, "Parallel port");

    But what about the case where ENOENT is returned :)?

(from sys/isa/isa_common.c)

static int
isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids)
{
        struct isa_device* idev = DEVTOISA(child);

        if (!idev->id_vendorid)
                return (ENOENT);

        while (ids && ids->ip_id) {
                /*
                 * Really ought to support >1 compat id per device.
                 */
                if (idev->id_logicalid == ids->ip_id
                    || idev->id_compatid == ids->ip_id) {
                        if (ids->ip_desc)
                                device_set_desc(child, ids->ip_desc);
                        return (0);
                }
                ids++;
        }

        return (ENXIO);
}

    Does it make sense for this patch to be applied to ppc(4)? I think
it solves some problems with bogus device.hints files and the ppc
driver, but my eye is a bit untrained for this stuff and I don't have
the experience to say with absolute authority whether or not it's the
case.
Thanks,
-Garrett

Index: sys/dev/ppc/ppc_isa.c
===================================================================
--- sys/dev/ppc/ppc_isa.c	(revision 211309)
+++ sys/dev/ppc/ppc_isa.c	(working copy)
@@ -121,8 +121,8 @@
 	parent = device_get_parent(dev);

 	error = ISA_PNP_PROBE(parent, dev, lpc_ids);
-	if (error == ENXIO)
-		return (ENXIO);
+	if (error)
+		return (error);
 	if (error != 0)		/* XXX shall be set after detection */
 		device_set_desc(dev, "Parallel port");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinMSdRh0T4aWpZ4gR%2BRogzHQS5Vz7f6O1_vozvo>