i2c: rockchip: fix using smp_processor_id() in preemptible warning
author黄涛 <huangtao@rock-chips.com>
Fri, 13 Jun 2014 07:22:58 +0000 (15:22 +0800)
committer黄涛 <huangtao@rock-chips.com>
Fri, 13 Jun 2014 07:25:29 +0000 (15:25 +0800)
Fix this warning when DEBUG_PREEMPT is selected:
BUG: using smp_processor_id() in preemptible [00000000] code: cfinteractive/72
caller is rockchip_i2c_doxfer+0x58/0x3cc

drivers/i2c/busses/i2c-rockchip.c

index f1c5d9d2ef2b7770dfae68b367012831121e5155..061c5da0919ca4c1509e3750e2564b11937c8e88 100644 (file)
@@ -625,7 +625,6 @@ static int rockchip_i2c_doxfer(struct rockchip_i2c *i2c,
         */
        int msleep_time = 400 * 1000 / i2c->scl_rate;   // ms
        int can_sleep = !(in_atomic() || irqs_disabled());
-       int cpu = smp_processor_id();
 
        if (i2c->suspended) {
                dev_err(i2c->dev, "i2c is suspended\n");
@@ -678,6 +677,7 @@ static int rockchip_i2c_doxfer(struct rockchip_i2c *i2c,
                }
                timeout = ret;
        } else {
+               int cpu = raw_smp_processor_id();
                int tmo = I2C_WAIT_TIMEOUT * USEC_PER_MSEC;
                while (tmo-- && i2c->is_busy != 0) {
                        spin_unlock_irqrestore(&i2c->lock, flags);