* Afzal Mohammed <[email protected]> [120604 00:06]:
> +static int omap_prefetch_enable(int cs, int fifo_th, int dma_mode,
> +     unsigned int u32_count, int is_write, struct omap_nand_info *info)
> +{
> +     u32 val;
> +
> +     if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX) {
> +             pr_err("gpmc: fifo threshold is not supported\n");
> +             return -1;
> +     } else if (!(readl(info->reg.gpmc_prefetch_control))) {
> +             /* Set the amount of bytes to be prefetched */
> +             writel(u32_count, info->reg.gpmc_prefetch_config2);
> +
> +             /* Set dma/mpu mode, the prefetch read / post write and
> +              * enable the engine. Set which cs is has requested for.
> +              */
> +             val = ((cs << PREFETCH_CONFIG1_CS_SHIFT) |
> +                                     PREFETCH_FIFOTHRESHOLD(fifo_th) |
> +                                     ENABLE_PREFETCH |
> +                                     (dma_mode << DMA_MPU_MODE_SHIFT) |
> +                                     (0x1 & is_write));
> +             writel(val, info->reg.gpmc_prefetch_config1);
> +
> +             /*  Start the prefetch engine */
> +             writel(0x1, info->reg.gpmc_prefetch_control);
> +     } else {
> +             return -EBUSY;
> +     }
> +
> +     return 0;
> +}

You can simplify the above by leaving out the if else stuff by
returning early:

        if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX)
                return -1;

        if (readl(info->reg.gpmc_prefetch_control))
                return -EBUSY;

        /* Set the amount of bytes to be prefetched */
        writel(u32_count, info->reg.gpmc_prefetch_config2);
        ...

        return 0;

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to