Re: [linux-usb-devel] [PATCH] limit power budget on spitz

From: David Brownell
Date: Thu Jun 08 2006 - 19:43:54 EST


On Thursday 08 June 2006 2:49 pm, Richard Purdie wrote:
>
> > > The easiest solution might be to move the ohci device registration into
> > > pxa_set_ohci_info (in pxa27x.c). I gave in and appended a patch (compile
> > > tested only so far).
> >
> > Looked OK to me.
> >
> > That's the kind of approach now used with OMAP and AT91, and which IMO
> > would be appropriate to use for most platform devices ... that is, don't
> > register devices that the board doesn't have. One additional nuance: if
> > the kernel doesn't have that driver configured, that's another reason not
> > to bother registering its device.
>
> This is where you start to add ugly ifdefs and generally start making
> the code look horrible. The device model separated the drivers and the
> devices to deal with this issue as I see it.

Enumeration is a separate issue. You wouldn't argue that every potential
PCI or USB device must get registered, right? Only the ones that are
actually _present_ get registered.

But here you argue that platform bus should not work that same way ... it
should register devices that can't be present. If nothing else, that's
an inconsistent aproach.

Plus, consider the common situation that a given pin could potentially
be used with several different devices. On a given board, only one of
those devices will be wired up. It's counterproductive to register any
of the others ... error prone, waste-of-kernel-address-space, etc.


> Generally I'd say its
> cleaner just to let the device register, then if a module comes along at
> some later point, the device is there for it.

Whether the device is there or not is a hardware issue. Board schematics
will show which devices are relevant ... registering any others is just
wastage. "Clean" is somewhat in the eye of the beholder; in mine, wasting
system resources is not clean.

- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/