From: Hans-Christian Egtvedt Date: Thu, 24 Jul 2008 04:28:55 +0000 (-0700) Subject: atmel_pwm: set up only one PWM clock when allocating a clock X-Git-Tag: v2.6.27-rc1~719 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5aa0769d089125e63f8dc23e0283e559e1790493;p=platform%2Fupstream%2Fkernel-adaptation-pc.git atmel_pwm: set up only one PWM clock when allocating a clock This patch will only setup one clock, if free, and return this clock to the caller. The previous solution would setup both clocks with the same prescaler and divider and return PWM_CPR_CLKB, thus taking both clocks in the same call without the caller knowing. Signed-off-by: Hans-Christian Egtvedt Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c index 5b5a14d..6aa5294 100644 --- a/drivers/misc/atmel_pwm.c +++ b/drivers/misc/atmel_pwm.c @@ -211,8 +211,7 @@ int pwm_clk_alloc(unsigned prescale, unsigned div) if ((mr & 0xffff) == 0) { mr |= val; ret = PWM_CPR_CLKA; - } - if ((mr & (0xffff << 16)) == 0) { + } else if ((mr & (0xffff << 16)) == 0) { mr |= val << 16; ret = PWM_CPR_CLKB; }