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

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Nov 12 17:32:37 EST 2009


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?



More information about the linux-arm-kernel mailing list