[PATCH 8/9 v2] MXC: Add a digital audio multiplexer driver

Sascha Hauer s.hauer at pengutronix.de
Fri Nov 13 02:29:03 EST 2009


On Thu, Nov 12, 2009 at 10:32:37PM +0000, Russell King - ARM Linux wrote:
> On Thu, Nov 12, 2009 at 04:06:15PM +0100, Sascha Hauer wrote:
> > +static int mxc_audmux_v2_init(void)
> > +{
> > +	int ret;
> > +
> > +	if (cpu_is_mx31() || cpu_is_mx35())
> > +		audmux_base = IO_ADDRESS(AUDMUX_BASE_ADDR);
> > +	else
> > +		return 0;
> > +
> > +	if (cpu_is_mx35()) {
> > +		audmux_clk = clk_get(NULL, "audmux");
> > +		if (IS_ERR(audmux_clk)) {
> > +			audmux_base = NULL;
> > +			ret = PTR_ERR(audmux_clk);
> > +			printk(KERN_ERR "%s: cannot get clock: %d\n", __func__,
> > +					ret);
> > +			return ret;
> > +		}
> > +	}
> > +
> > +	return 0;
> > +}
> 
> Hmm.  Wouldn't something like:
> 
> 	if (cpu_is_mx35()) {
> 		audmux_clk = clk_get(NULL, "audmux");
> 		if (IS_ERR(audmux_clk)) {
> 			int ret = PTR_ERR(audmux_clk);
> 			printk(KERN_ERR "%s: cannot get clock: %d\n", __func__,
> 					ret);
> 			return ret;
> 		}
> 	}
> 
> 	if (cpu_is_mx31() || cpu_is_mx35())
> 		audmux_base = IO_ADDRESS(AUDMUX_BASE_ADDR);
> 
> 	return 0;
> 
> be a better and clearer way to write this?

Indeed. I Changed this.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-arm-kernel mailing list