[PATCH 1/2] ARM: sa11x0: Implement autoloading of codec and codec pdata for mcp bus.
Russell King - ARM Linux
linux at arm.linux.org.uk
Fri Jan 20 12:11:02 EST 2012
On Wed, Jan 18, 2012 at 03:21:49PM +0000, Russell King - ARM Linux wrote:
> On Sun, Nov 27, 2011 at 10:00:54PM +0100, Jochen Friedrich wrote:
> > + if (mid && mid->driver_data) {
> > + if (id != mid->driver_data) {
> > + printk(KERN_WARNING "%s wrong ID %04x found: %04x\n",
> > + mid->name, (unsigned int) mid->driver_data, id);
> > + goto err_disable;
> > + }
> > + } else {
> > + mid = &ucb1x00_id[1];
> > + while (mid->driver_data) {
> > + if (id == mid->driver_data)
> > + break;
> > + mid++;
> > + }
> > + printk(KERN_WARNING "%s ID not found: %04x\n",
> > + ucb1x00_id[0].name, id);
>
> Why do we need this complexity when we can detect the device from its
> ID in hardware? This, to me, is just code for the sake of code.
>
> I'm far from impressed by this patch, and had it not already gone in,
> I'd be NAKing it.
Right, I'm even more convinced that the above is over the top. What
it's doing is requiring either:
(a) the autodetect option to be given, in which case we will match
using the ID from the device
(b) use a specific option, in which case the ID must match
which is absolutely silly and completely unnecessary. If we require the
ID to be correct from the hardware, there's absolutely no point what so
ever passing some kind of identifier in to the driver. It just creates
an additional unnecessary reason for things to fail - in other words,
the only thing it adds is _fragility_.
And to prove the point that it's fragile, on the Assabet I get this:
ucb1x00 ID not found: 1005
and it fails to initialize - 0x1005 is a valid id for a UCB1300 device.
So clearly this code hasn't even been tested either.
Samuel, please revert this change. It's broken and does more than what
it says in the change log.
More information about the linux-arm-kernel
mailing list