From: 黄涛 Date: Wed, 7 May 2014 11:47:44 +0000 (+0800) Subject: pwm: rockchip: fix lock warning X-Git-Tag: firefly_0821_release~5343 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f1c7ceac6452323b3f417b61defb0688e8ad4d80;p=firefly-linux-kernel-4.4.55.git pwm: rockchip: fix lock warning INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0 #43 [] (unwind_backtrace+0x0/0xe0) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (__lock_acquire.isra.24+0x1a4/0x7a4) [] (__lock_acquire.isra.24+0x1a4/0x7a4) from [] (lock_acquire+0x120/0x144) [] (lock_acquire+0x120/0x144) from [] (_raw_spin_lock_irqsave+0x4c/0x60) [] (_raw_spin_lock_irqsave+0x4c/0x60) from [] (rk_pwm_config_v2+0xd4/0x15c) [] (rk_pwm_config_v2+0xd4/0x15c) from [] (rk_pwm_config+0x60/0x74) --- diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index 25c321d49749..a15b38d75b80 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c @@ -86,15 +86,7 @@ module_param_named(dbg_level, pwm_dbg_level, int, 0644); #define PWMPCR_MIN_PERIOD 0x0001 #define PWMPCR_MAX_PERIOD 0xFFFF -#if 0 -static spinlock_t pwm_lock[4] = { - __SPIN_LOCK_UNLOCKED(pwm_lock0), - __SPIN_LOCK_UNLOCKED(pwm_lock1), - __SPIN_LOCK_UNLOCKED(pwm_lock2), - __SPIN_LOCK_UNLOCKED(pwm_lock3), -}; -#endif -int spinlock_num = 0; + /******************************************** * struct rk_pwm_chip - struct representing pwm chip @@ -145,7 +137,6 @@ static int rk_pwm_config_v1(struct pwm_chip *chip, struct pwm_device *pwm, struct rk_pwm_chip *pc = to_rk_pwm_chip(chip); u64 val, div, clk_rate; unsigned long prescale = PWMCR_MIN_PRESCALE, pv, dc; - int ret; u32 off, on; int conf=0; unsigned long flags; @@ -252,7 +243,6 @@ static int rk_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm, struct rk_pwm_chip *pc = to_rk_pwm_chip(chip); u64 val, div, clk_rate; unsigned long prescale = PWMCR_MIN_PRESCALE, pv, dc; - int ret; u32 on; int conf=0; unsigned long flags; @@ -363,7 +353,6 @@ static int rk_pwm_config_v3(struct pwm_chip *chip, struct pwm_device *pwm, struct rk_pwm_chip *pc = to_rk_pwm_chip(chip); u64 val, div, clk_rate; unsigned long prescale = PWMCR_MIN_PRESCALE, pv, dc; - int ret; u32 on; int conf=0; unsigned long flags; @@ -597,8 +586,7 @@ static int rk_pwm_probe(struct platform_device *pdev) pc->chip.ops = &rk_pwm_ops; pc->chip.base = -1; pc->chip.npwm = NUM_PWM; - pc->lock = __SPIN_LOCK_UNLOCKED(PWM##spinlock_num); - spinlock_num ++; + spin_lock_init(&pc->lock); /* Following enables PWM chip, channels would still be enabled individually through their control register */ DBG("npwm = %d, of_pwm_ncells =%d \n", pc->chip.npwm,pc->chip.of_pwm_n_cells);