Why doesn't ppc(4) check non-ENXIO failures during probe?

Garrett Cooper yanegomi at gmail.com
Sun Aug 15 05:33:39 UTC 2010


    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");


More information about the freebsd-hackers mailing list