From: 黄涛 Date: Fri, 13 Jun 2014 07:22:58 +0000 (+0800) Subject: i2c: rockchip: fix using smp_processor_id() in preemptible warning X-Git-Tag: firefly_0821_release~5127 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e4cb1d6d7e6298e3c2ecc0da65e8821885c1fdbc;p=firefly-linux-kernel-4.4.55.git i2c: rockchip: fix using smp_processor_id() in preemptible warning 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 --- diff --git a/drivers/i2c/busses/i2c-rockchip.c b/drivers/i2c/busses/i2c-rockchip.c index f1c5d9d2ef2b..061c5da0919c 100644 --- a/drivers/i2c/busses/i2c-rockchip.c +++ b/drivers/i2c/busses/i2c-rockchip.c @@ -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);