From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: "Jasmin J." <jasmin@anw.at>
Cc: linux-media@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] media: Revert cleanup ktime_set() usage
Date: Mon, 16 Apr 2018 06:54:15 -0300 [thread overview]
Message-ID: <20180416065415.38f5ef37@vento.lan> (raw)
In-Reply-To: <1523662294-17971-1-git-send-email-jasmin@anw.at>
Em Sat, 14 Apr 2018 01:31:34 +0200
"Jasmin J." <jasmin@anw.at> escreveu:
> From: Jasmin Jessich <jasmin@anw.at>
>
> This reverts 8b0e195314fa, because this will not compile for Kernels
> older than 4.10.
This patch looks fine, but not for the above-mentioned.
The thing is that it is not consistent to have some places with
things like:
timeout = ktime_set(1, ir->polling * 1000000);
and others with:
timeout = ir->polling * 1000000;
We should either use ktime_set() everywhere or remove it as a whole.
My preference is to keep using it, as it makes it better documented.
In any case, gcc should be smart enough to discard multiply by a
zero constant when evaluating ktime_set() macro (if not, it is a gcc
issue).
The fact that it makes maintainership of the media_build backport
tree easier is just a plus, but it makes no sense upstream.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Jasmin Jessich <jasmin@anw.at>
> ---
> drivers/media/dvb-core/dmxdev.c | 2 +-
> drivers/media/pci/cx88/cx88-input.c | 6 ++++--
> drivers/media/pci/pt3/pt3.c | 2 +-
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
> index 61a750f..cb078d6 100644
> --- a/drivers/media/dvb-core/dmxdev.c
> +++ b/drivers/media/dvb-core/dmxdev.c
> @@ -622,7 +622,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev,
> struct dmxdev_filter *filter,
> struct dmxdev_feed *feed)
> {
> - ktime_t timeout = 0;
> + ktime_t timeout = ktime_set(0, 0);
> struct dmx_pes_filter_params *para = &filter->params.pes;
> enum dmx_output otype;
> int ret;
> diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
> index 6f4e692..b13243d 100644
> --- a/drivers/media/pci/cx88/cx88-input.c
> +++ b/drivers/media/pci/cx88/cx88-input.c
> @@ -180,7 +180,8 @@ static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer)
> struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
>
> cx88_ir_handle_key(ir);
> - missed = hrtimer_forward_now(&ir->timer, ir->polling * 1000000LL);
> + missed = hrtimer_forward_now(&ir->timer,
> + ktime_set(0, ir->polling * 1000000));
> if (missed > 1)
> ir_dprintk("Missed ticks %ld\n", missed - 1);
>
> @@ -200,7 +201,8 @@ static int __cx88_ir_start(void *priv)
> if (ir->polling) {
> hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> ir->timer.function = cx88_ir_work;
> - hrtimer_start(&ir->timer, ir->polling * 1000000LL,
> + hrtimer_start(&ir->timer,
> + ktime_set(0, ir->polling * 1000000),
> HRTIMER_MODE_REL);
> }
> if (ir->sampling) {
> diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c
> index da74828..8ced807 100644
> --- a/drivers/media/pci/pt3/pt3.c
> +++ b/drivers/media/pci/pt3/pt3.c
> @@ -464,7 +464,7 @@ static int pt3_fetch_thread(void *data)
>
> pt3_proc_dma(adap);
>
> - delay = PT3_FETCH_DELAY * NSEC_PER_MSEC;
> + delay = ktime_set(0, PT3_FETCH_DELAY * NSEC_PER_MSEC);
> set_current_state(TASK_UNINTERRUPTIBLE);
> freezable_schedule_hrtimeout_range(&delay,
> PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
Thanks,
Mauro
next prev parent reply other threads:[~2018-04-16 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-13 23:31 [PATCH] media: Revert cleanup ktime_set() usage Jasmin J.
2018-04-16 9:54 ` Mauro Carvalho Chehab [this message]
2018-04-27 18:15 ` Jasmin J.
2018-04-27 18:47 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180416065415.38f5ef37@vento.lan \
--to=mchehab@s-opensource.com \
--cc=jasmin@anw.at \
--cc=linux-media@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.