From 2115ca573dc16c08c03b5f02c7b387026fe534d5 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 20 Feb 2017 13:30:07 +1100 Subject: [PATCH 08/18] Replace all calls to schedule_timeout_interruptible of potentially under 50ms to use schedule_msec_hrtimeout_interruptible. --- drivers/hwmon/fam15h_power.c | 2 +- drivers/iio/light/tsl2563.c | 6 +----- drivers/media/i2c/msp3400-driver.c | 4 ++-- drivers/media/pci/ivtv/ivtv-gpio.c | 6 +++--- drivers/media/radio/radio-mr800.c | 2 +- drivers/media/radio/radio-tea5777.c | 2 +- drivers/media/radio/tea575x.c | 2 +- drivers/misc/panel.c | 2 +- drivers/parport/ieee1284.c | 2 +- drivers/parport/ieee1284_ops.c | 2 +- drivers/platform/x86/intel_ips.c | 8 ++++---- net/core/pktgen.c | 2 +- sound/soc/codecs/wm8350.c | 12 ++++++------ sound/soc/codecs/wm8900.c | 2 +- sound/soc/codecs/wm9713.c | 4 ++-- 15 files changed, 27 insertions(+), 31 deletions(-) Index: linux-4.11-ck1/drivers/hwmon/fam15h_power.c =================================================================== --- linux-4.11-ck1.orig/drivers/hwmon/fam15h_power.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/hwmon/fam15h_power.c 2017-05-12 13:25:55.385575198 +1000 @@ -237,7 +237,7 @@ static ssize_t power1_average_show(struc prev_ptsc[cu] = data->cpu_sw_pwr_ptsc[cu]; } - leftover = schedule_timeout_interruptible(msecs_to_jiffies(data->power_period)); + leftover = schedule_msec_hrtimeout_interruptible((data->power_period)); if (leftover) return 0; Index: linux-4.11-ck1/drivers/iio/light/tsl2563.c =================================================================== --- linux-4.11-ck1.orig/drivers/iio/light/tsl2563.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/iio/light/tsl2563.c 2017-05-12 13:25:55.395575161 +1000 @@ -282,11 +282,7 @@ static void tsl2563_wait_adc(struct tsl2 default: delay = 402; } - /* - * TODO: Make sure that we wait at least required delay but why we - * have to extend it one tick more? - */ - schedule_timeout_interruptible(msecs_to_jiffies(delay) + 2); + schedule_msec_hrtimeout_interruptible(delay + 1); } static int tsl2563_adjust_gainlevel(struct tsl2563_chip *chip, u16 adc) Index: linux-4.11-ck1/drivers/media/i2c/msp3400-driver.c =================================================================== --- linux-4.11-ck1.orig/drivers/media/i2c/msp3400-driver.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/media/i2c/msp3400-driver.c 2017-05-12 13:25:55.395575161 +1000 @@ -179,7 +179,7 @@ static int msp_read(struct i2c_client *c break; dev_warn(&client->dev, "I/O error #%d (read 0x%02x/0x%02x)\n", err, dev, addr); - schedule_timeout_interruptible(msecs_to_jiffies(10)); + schedule_msec_hrtimeout_interruptible((10)); } if (err == 3) { dev_warn(&client->dev, "resetting chip, sound will go off.\n"); @@ -220,7 +220,7 @@ static int msp_write(struct i2c_client * break; dev_warn(&client->dev, "I/O error #%d (write 0x%02x/0x%02x)\n", err, dev, addr); - schedule_timeout_interruptible(msecs_to_jiffies(10)); + schedule_msec_hrtimeout_interruptible((10)); } if (err == 3) { dev_warn(&client->dev, "resetting chip, sound will go off.\n"); Index: linux-4.11-ck1/drivers/media/pci/ivtv/ivtv-gpio.c =================================================================== --- linux-4.11-ck1.orig/drivers/media/pci/ivtv/ivtv-gpio.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/media/pci/ivtv/ivtv-gpio.c 2017-05-12 13:25:55.395575161 +1000 @@ -117,7 +117,7 @@ void ivtv_reset_ir_gpio(struct ivtv *itv curout = (curout & ~0xF) | 1; write_reg(curout, IVTV_REG_GPIO_OUT); /* We could use something else for smaller time */ - schedule_timeout_interruptible(msecs_to_jiffies(1)); + schedule_msec_hrtimeout_interruptible((1)); curout |= 2; write_reg(curout, IVTV_REG_GPIO_OUT); curdir &= ~0x80; @@ -137,11 +137,11 @@ int ivtv_reset_tuner_gpio(void *dev, int curout = read_reg(IVTV_REG_GPIO_OUT); curout &= ~(1 << itv->card->xceive_pin); write_reg(curout, IVTV_REG_GPIO_OUT); - schedule_timeout_interruptible(msecs_to_jiffies(1)); + schedule_msec_hrtimeout_interruptible((1)); curout |= 1 << itv->card->xceive_pin; write_reg(curout, IVTV_REG_GPIO_OUT); - schedule_timeout_interruptible(msecs_to_jiffies(1)); + schedule_msec_hrtimeout_interruptible((1)); return 0; } Index: linux-4.11-ck1/drivers/media/radio/radio-mr800.c =================================================================== --- linux-4.11-ck1.orig/drivers/media/radio/radio-mr800.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/media/radio/radio-mr800.c 2017-05-12 13:25:55.395575161 +1000 @@ -378,7 +378,7 @@ static int vidioc_s_hw_freq_seek(struct retval = -ENODATA; break; } - if (schedule_timeout_interruptible(msecs_to_jiffies(10))) { + if (schedule_msec_hrtimeout_interruptible((10))) { retval = -ERESTARTSYS; break; } Index: linux-4.11-ck1/drivers/media/radio/radio-tea5777.c =================================================================== --- linux-4.11-ck1.orig/drivers/media/radio/radio-tea5777.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/media/radio/radio-tea5777.c 2017-05-12 13:25:55.395575161 +1000 @@ -245,7 +245,7 @@ static int radio_tea5777_update_read_reg } if (wait) { - if (schedule_timeout_interruptible(msecs_to_jiffies(wait))) + if (schedule_msec_hrtimeout_interruptible((wait))) return -ERESTARTSYS; } Index: linux-4.11-ck1/drivers/media/radio/tea575x.c =================================================================== --- linux-4.11-ck1.orig/drivers/media/radio/tea575x.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/media/radio/tea575x.c 2017-05-12 13:25:55.395575161 +1000 @@ -416,7 +416,7 @@ int snd_tea575x_s_hw_freq_seek(struct fi for (;;) { if (time_after(jiffies, timeout)) break; - if (schedule_timeout_interruptible(msecs_to_jiffies(10))) { + if (schedule_msec_hrtimeout_interruptible((10))) { /* some signal arrived, stop search */ tea->val &= ~TEA575X_BIT_SEARCH; snd_tea575x_set_freq(tea); Index: linux-4.11-ck1/drivers/misc/panel.c =================================================================== --- linux-4.11-ck1.orig/drivers/misc/panel.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/misc/panel.c 2017-05-12 13:25:55.395575161 +1000 @@ -758,7 +758,7 @@ static void long_sleep(int ms) if (in_interrupt()) mdelay(ms); else - schedule_timeout_interruptible(msecs_to_jiffies(ms)); + schedule_msec_hrtimeout_interruptible((ms)); } /* Index: linux-4.11-ck1/drivers/parport/ieee1284.c =================================================================== --- linux-4.11-ck1.orig/drivers/parport/ieee1284.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/parport/ieee1284.c 2017-05-12 13:25:55.395575161 +1000 @@ -215,7 +215,7 @@ int parport_wait_peripheral(struct parpo /* parport_wait_event didn't time out, but the * peripheral wasn't actually ready either. * Wait for another 10ms. */ - schedule_timeout_interruptible(msecs_to_jiffies(10)); + schedule_msec_hrtimeout_interruptible((10)); } } Index: linux-4.11-ck1/drivers/parport/ieee1284_ops.c =================================================================== --- linux-4.11-ck1.orig/drivers/parport/ieee1284_ops.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/parport/ieee1284_ops.c 2017-05-12 13:25:55.395575161 +1000 @@ -536,7 +536,7 @@ size_t parport_ieee1284_ecp_read_data (s /* Yield the port for a while. */ if (count && dev->port->irq != PARPORT_IRQ_NONE) { parport_release (dev); - schedule_timeout_interruptible(msecs_to_jiffies(40)); + schedule_msec_hrtimeout_interruptible((40)); parport_claim_or_block (dev); } else Index: linux-4.11-ck1/drivers/platform/x86/intel_ips.c =================================================================== --- linux-4.11-ck1.orig/drivers/platform/x86/intel_ips.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/drivers/platform/x86/intel_ips.c 2017-05-12 13:25:55.395575161 +1000 @@ -813,7 +813,7 @@ static int ips_adjust(void *data) ips_gpu_lower(ips); sleep: - schedule_timeout_interruptible(msecs_to_jiffies(IPS_ADJUST_PERIOD)); + schedule_msec_hrtimeout_interruptible((IPS_ADJUST_PERIOD)); } while (!kthread_should_stop()); dev_dbg(&ips->dev->dev, "ips-adjust thread stopped\n"); @@ -992,7 +992,7 @@ static int ips_monitor(void *data) seqno_timestamp = get_jiffies_64(); old_cpu_power = thm_readl(THM_CEC); - schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); + schedule_msec_hrtimeout_interruptible((IPS_SAMPLE_PERIOD)); /* Collect an initial average */ for (i = 0; i < IPS_SAMPLE_COUNT; i++) { @@ -1019,7 +1019,7 @@ static int ips_monitor(void *data) mchp_samples[i] = mchp; } - schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); + schedule_msec_hrtimeout_interruptible((IPS_SAMPLE_PERIOD)); if (kthread_should_stop()) break; } @@ -1046,7 +1046,7 @@ static int ips_monitor(void *data) * us to reduce the sample frequency if the CPU and GPU are idle. */ old_cpu_power = thm_readl(THM_CEC); - schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); + schedule_msec_hrtimeout_interruptible((IPS_SAMPLE_PERIOD)); last_sample_period = IPS_SAMPLE_PERIOD; setup_deferrable_timer_on_stack(&timer, monitor_timeout, Index: linux-4.11-ck1/net/core/pktgen.c =================================================================== --- linux-4.11-ck1.orig/net/core/pktgen.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/net/core/pktgen.c 2017-05-12 13:25:55.395575161 +1000 @@ -1992,7 +1992,7 @@ static void pktgen_mark_device(const str mutex_unlock(&pktgen_thread_lock); pr_debug("%s: waiting for %s to disappear....\n", __func__, ifname); - schedule_timeout_interruptible(msecs_to_jiffies(msec_per_try)); + schedule_msec_hrtimeout_interruptible((msec_per_try)); mutex_lock(&pktgen_thread_lock); if (++i >= max_tries) { Index: linux-4.11-ck1/sound/soc/codecs/wm8350.c =================================================================== --- linux-4.11-ck1.orig/sound/soc/codecs/wm8350.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/sound/soc/codecs/wm8350.c 2017-05-12 13:25:55.395575161 +1000 @@ -236,10 +236,10 @@ static void wm8350_pga_work(struct work_ out2->ramp == WM8350_RAMP_UP) { /* delay is longer over 0dB as increases are larger */ if (i >= WM8350_OUTn_0dB) - schedule_timeout_interruptible(msecs_to_jiffies + schedule_msec_hrtimeout_interruptible( (2)); else - schedule_timeout_interruptible(msecs_to_jiffies + schedule_msec_hrtimeout_interruptible( (1)); } else udelay(50); /* doesn't matter if we delay longer */ @@ -1123,7 +1123,7 @@ static int wm8350_set_bias_level(struct (platform->dis_out4 << 6)); /* wait for discharge */ - schedule_timeout_interruptible(msecs_to_jiffies + schedule_msec_hrtimeout_interruptible( (platform-> cap_discharge_msecs)); @@ -1139,7 +1139,7 @@ static int wm8350_set_bias_level(struct WM8350_VBUFEN); /* wait for vmid */ - schedule_timeout_interruptible(msecs_to_jiffies + schedule_msec_hrtimeout_interruptible( (platform-> vmid_charge_msecs)); @@ -1190,7 +1190,7 @@ static int wm8350_set_bias_level(struct wm8350_reg_write(wm8350, WM8350_POWER_MGMT_1, pm1); /* wait */ - schedule_timeout_interruptible(msecs_to_jiffies + schedule_msec_hrtimeout_interruptible( (platform-> vmid_discharge_msecs)); @@ -1208,7 +1208,7 @@ static int wm8350_set_bias_level(struct pm1 | WM8350_OUTPUT_DRAIN_EN); /* wait */ - schedule_timeout_interruptible(msecs_to_jiffies + schedule_msec_hrtimeout_interruptible( (platform->drain_msecs)); pm1 &= ~WM8350_BIASEN; Index: linux-4.11-ck1/sound/soc/codecs/wm8900.c =================================================================== --- linux-4.11-ck1.orig/sound/soc/codecs/wm8900.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/sound/soc/codecs/wm8900.c 2017-05-12 13:25:55.395575161 +1000 @@ -1112,7 +1112,7 @@ static int wm8900_set_bias_level(struct /* Need to let things settle before stopping the clock * to ensure that restart works, see "Stopping the * master clock" in the datasheet. */ - schedule_timeout_interruptible(msecs_to_jiffies(1)); + schedule_msec_hrtimeout_interruptible((1)); snd_soc_write(codec, WM8900_REG_POWER2, WM8900_REG_POWER2_SYSCLK_ENA); break; Index: linux-4.11-ck1/sound/soc/codecs/wm9713.c =================================================================== --- linux-4.11-ck1.orig/sound/soc/codecs/wm9713.c 2017-05-12 13:25:55.395575161 +1000 +++ linux-4.11-ck1/sound/soc/codecs/wm9713.c 2017-05-12 13:25:55.395575161 +1000 @@ -199,7 +199,7 @@ static int wm9713_voice_shutdown(struct /* Gracefully shut down the voice interface. */ snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, 0x0200); - schedule_timeout_interruptible(msecs_to_jiffies(1)); + schedule_msec_hrtimeout_interruptible((1)); snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, 0x0f00); snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x1000, 0x1000); @@ -868,7 +868,7 @@ static int wm9713_set_pll(struct snd_soc wm9713->pll_in = freq_in; /* wait 10ms AC97 link frames for the link to stabilise */ - schedule_timeout_interruptible(msecs_to_jiffies(10)); + schedule_msec_hrtimeout_interruptible((10)); return 0; }