[ARM] 5303/1: period_cycles should be greater than 1
authorroelkluin <roel.kluin@gmail.com>
Tue, 14 Oct 2008 20:28:51 +0000 (21:28 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 17 Oct 2008 12:44:47 +0000 (13:44 +0100)
If period_cycles is 0, prescale becomes silly.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/pwm.c

index 316cd986da5cea37dbe6692b57124dc0e9fb46b0..74e2ead8cee80fa7f52ca7d7e40b64ce8005fc00 100644 (file)
@@ -60,7 +60,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
        do_div(c, 1000000000);
        period_cycles = c;
 
-       if (period_cycles < 0)
+       if (period_cycles < 1)
                period_cycles = 1;
        prescale = (period_cycles - 1) / 1024;
        pv = period_cycles / (prescale + 1) - 1;