Re: [patch] collie: enable frontlight

From: Andrew Morton
Date: Fri Nov 04 2005 - 18:17:49 EST


Pavel Machek <pavel@xxxxxx> wrote:
>
> +static spinlock_t fl_lock = SPIN_LOCK_UNLOCKED;
> +
> +#define LCM_ALC_EN 0x8000
> +
> +void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(&fl_lock, flags);
> + locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
> + udelay(100);
> + locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
> + locomo_writel(bpwf | LCM_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
> + spin_unlock_irqrestore(&fl_lock, flags);
> +}

ick, a 100 microsecond glitch, quite unnecessary. Why not use a semaphore
here, if any locking is actually needed? (It's called from device probe -
there's higher-level serialisation, no?)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/