X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fstaging%2Folpc_dcon%2Folpc_dcon.c;h=f45b2ef05f481fce35c12e62ee4b792f77ae2edf;hb=e09b41010ba33a20a87472ee821fa407a5b8da36;hp=d115f5c0e3415dcb8f6084fdcc0636522550501c;hpb=9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00;p=kvmfornfv.git diff --git a/kernel/drivers/staging/olpc_dcon/olpc_dcon.c b/kernel/drivers/staging/olpc_dcon/olpc_dcon.c index d115f5c0e..f45b2ef05 100644 --- a/kernel/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/kernel/drivers/staging/olpc_dcon/olpc_dcon.c @@ -60,7 +60,7 @@ static s32 dcon_read(struct dcon_priv *dcon, u8 reg) static int dcon_hw_init(struct dcon_priv *dcon, int is_init) { - uint16_t ver; + u16 ver; int rc = 0; ver = dcon_read(dcon, DCON_REG_ID); @@ -100,7 +100,6 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init) } dcon_write(dcon, DCON_REG_MODE, dcon->disp_mode); - /* Set the scanline to interrupt on during resume */ dcon_write(dcon, DCON_REG_SCAN_INT, resumeline); @@ -238,15 +237,13 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep) */ static void dcon_load_holdoff(struct dcon_priv *dcon) { - struct timespec delta_t, now; + ktime_t delta_t, now; while (1) { - getnstimeofday(&now); - delta_t = timespec_sub(now, dcon->load_time); - if (delta_t.tv_sec != 0 || - delta_t.tv_nsec > NSEC_PER_MSEC * 20) { + now = ktime_get(); + delta_t = ktime_sub(now, dcon->load_time); + if (ktime_to_ns(delta_t) > NSEC_PER_MSEC * 20) break; - } mdelay(4); } } @@ -325,19 +322,19 @@ static void dcon_source_switch(struct work_struct *work) /* And turn off the DCON */ pdata->set_dconload(1); - getnstimeofday(&dcon->load_time); + dcon->load_time = ktime_get(); pr_info("The CPU has control\n"); break; case DCON_SOURCE_DCON: { - struct timespec delta_t; + ktime_t delta_t; pr_info("dcon_source_switch to DCON\n"); /* Clear DCONLOAD - this implies that the DCON is in control */ pdata->set_dconload(0); - getnstimeofday(&dcon->load_time); + dcon->load_time = ktime_get(); wait_event_timeout(dcon->waitq, dcon->switched, HZ/2); @@ -355,14 +352,14 @@ static void dcon_source_switch(struct work_struct *work) * deassert and reassert, and hope for the best. * see http://dev.laptop.org/ticket/9664 */ - delta_t = timespec_sub(dcon->irq_time, dcon->load_time); - if (dcon->switched && delta_t.tv_sec == 0 && - delta_t.tv_nsec < NSEC_PER_MSEC * 20) { + delta_t = ktime_sub(dcon->irq_time, dcon->load_time); + if (dcon->switched && ktime_to_ns(delta_t) + < NSEC_PER_MSEC * 20) { pr_err("missed loading, retrying\n"); pdata->set_dconload(1); mdelay(41); pdata->set_dconload(0); - getnstimeofday(&dcon->load_time); + dcon->load_time = ktime_get(); mdelay(41); } } @@ -619,7 +616,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id) dcon_device = platform_device_alloc("dcon", -1); - if (dcon_device == NULL) { + if (!dcon_device) { pr_err("Unable to create the DCON device\n"); rc = -ENOMEM; goto eirq; @@ -682,7 +679,7 @@ static int dcon_remove(struct i2c_client *client) backlight_device_unregister(dcon->bl_dev); - if (dcon_device != NULL) + if (dcon_device) platform_device_unregister(dcon_device); cancel_work_sync(&dcon->switch_source); @@ -725,7 +722,6 @@ static int dcon_resume(struct device *dev) #endif /* CONFIG_PM */ - irqreturn_t dcon_interrupt(int irq, void *id) { struct dcon_priv *dcon = id; @@ -742,7 +738,7 @@ irqreturn_t dcon_interrupt(int irq, void *id) case 2: /* switch to DCON mode */ case 1: /* switch to CPU mode */ dcon->switched = true; - getnstimeofday(&dcon->irq_time); + dcon->irq_time = ktime_get(); wake_up(&dcon->waitq); break; @@ -756,7 +752,7 @@ irqreturn_t dcon_interrupt(int irq, void *id) */ if (dcon->curr_src != dcon->pending_src && !dcon->switched) { dcon->switched = true; - getnstimeofday(&dcon->irq_time); + dcon->irq_time = ktime_get(); wake_up(&dcon->waitq); pr_debug("switching w/ status 0/0\n"); } else {