[PATCH 09/20] ALSA: Cleanup WM8753 driver after switch to i2c driver model

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Oct 2 11:41:26 CEST 2008

On Wed, Oct 01, 2008 at 09:47:21PM +0200, Jonas Bonn wrote:

> Mainly this concerns device registration.  Registration should be handled
> at the machine level and not in the driver itself.  This patch drops
> registration at the driver level.

> As registration allows for specifying an i2c device address, the setup
> data is not needed to be passed to the driver.

> Signed-off-by: Jonas Bonn <jonas.bonn at gmail.com>

This looks mostly good from a code review perspective (one small issue
below).  However, it can't be into mainline at present since there are
several users of WM8753 which would also need to be updated to register
the WM8753 in their machine drivers.  

What's probably best for now if you're not comfortable updating the
other systems is that you guys carry this patch and I'll try to ensure
that the same change is picked up in mainline eventually so it merges
cleanly for you.  That'd also avoid skew between this and the other
codec drivers.  Does that sound sensible to you guys?

Thanks for doing all this work!

> @@ -1752,10 +1715,10 @@ static int wm8753_probe(struct platform_device *pdev)
>  	INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
>  #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
> -	if (setup->i2c_address) {
> -		codec->hw_write = (hw_write_t)i2c_master_send;
> -		ret = wm8753_add_i2c_device(pdev, setup);
> -	}
> +	codec->hw_write = (hw_write_t)i2c_master_send;

The assignment of hw_write should be pushed into the I2C probe function.
Otherwise if both I2C and SPI support are compiled in then things will
get confused (SPI support isn't there yet but it should be soon).

More information about the openmoko-kernel mailing list