public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Chunyan Zhang <zhang.chunyan@linaro.org>
Cc: Arnd Bergmann <arnd@linaro.org>,
	david@hardeman.nu, uli-lirc@uli-eckhardt.de,
	hans.verkuil@cisco.com, julia.lawall@lip6.fr,
	Himangi Saraogi <himangi774@gmail.com>,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	joe@perches.com, John Stultz <john.stultz@linaro.org>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	Lyra Zhang <zhang.lyra@gmail.com>
Subject: Re: [PATCH] media: rc: Replace timeval with ktime_t in imon.c
Date: Thu, 18 Dec 2014 09:00:53 -0200	[thread overview]
Message-ID: <20141218090053.68a0aad6@recife.lan> (raw)
In-Reply-To: <CAG2=9p9eL6kx8AfrLMw3Ct+eQcsQq5KJt=TkJ8ySmaWsWOmQ5A@mail.gmail.com>

Em Thu, 18 Dec 2014 17:38:14 +0800
Chunyan Zhang <zhang.chunyan@linaro.org> escreveu:

> On Thu, Dec 18, 2014 at 3:50 PM, Arnd Bergmann <arnd@linaro.org> wrote:
> > On Thursday 18 December 2014 11:37:13 Chunyan Zhang wrote:
> >> This patch changes the 32-bit time type (timeval) to the 64-bit one
> >> (ktime_t), since 32-bit time types will break in the year 2038.
> >>
> >> I use ktime_t instead of all uses of timeval in imon.c
> >>
> >> This patch also changes do_gettimeofday() to ktime_get() accordingly,
> >> since ktime_get returns a ktime_t, but do_gettimeofday returns a
> >> struct timeval, and the other reason is that ktime_get() uses
> >> the monotonic clock.
> >>
> >> This patch use a new function which is provided by another patch listed below
> >> to get the millisecond time difference.
> >
> > The patch looks great. Just a few small details that could still be
> > improved:

Yes, patch looks OK. After addressing the bits pointed by Arnd:

Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Feel free to merge via y2038 tree.

> >
> >> http://lkml.iu.edu//hypermail/linux/kernel/1412.2/00625.html
> >>
> >> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> >
> > In general, when you give a mailing list link, use the 'Link' tag
> > under your Signed-off-by line, like
> >
> > Link: http://lkml.iu.edu//hypermail/linux/kernel/1412.2/00625.html
> >
> > It's not used much yet, but getting more popular and seems useful to me.
> >
> > In this particular case, when you have patches that depend on one
> > another, you can make do it even better by sending all three patches
> > as a series with a [PATCH 0/3] cover letter.
> >
> OK, I'll send a patch-set including these three patches
> 
> > If the media maintainers can provide an Ack for this patch, I would
> > suggest to queue it up in the y2038 branch together with your first
> > patch that it depends on.
> >
> >> @@ -1191,16 +1168,16 @@ static inline int tv2int(const struct timeval *a, const struct timeval *b)
> >>   */
> >>  static int stabilize(int a, int b, u16 timeout, u16 threshold)
> >>  {
> >> -     struct timeval ct;
> >> -     static struct timeval prev_time = {0, 0};
> >> -     static struct timeval hit_time  = {0, 0};
> >> +     ktime_t ct;
> >> +     static ktime_t prev_time = {0};
> >> +     static ktime_t hit_time  = {0};
> >>       static int x, y, prev_result, hits;
> >>       int result = 0;
> >
> > The "= {0}" part here is redundant, since static variables are always
> > initialized to zero. Normally, adding the explicit initializer can
> > help readability, but in this case I would leave it out because it shows
> > implementation details of ktime_t that are better hidden from drivers.
> >
> OK, I'll modify them soon
> 
> Thanks,
> Chunyan
> 
> >> @@ -1596,9 +1573,9 @@ static void imon_incoming_packet(struct imon_context *ictx,
> >>       int i;
> >>       u64 scancode;
> >>       int press_type = 0;
> >> -     int msec;
> >> -     struct timeval t;
> >> -     static struct timeval prev_time = { 0, 0 };
> >> +     long msec;
> >> +     ktime_t t;
> >> +     static ktime_t prev_time = {0};
> >>       u8 ktype;
> >
> > Same thing here of course.
> >
> >         Arnd

  reply	other threads:[~2014-12-18 11:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <rcimonv1>
2014-12-18  3:37 ` [PATCH] media: rc: Replace timeval with ktime_t in imon.c Chunyan Zhang
2014-12-18  7:50   ` Arnd Bergmann
2014-12-18  9:38     ` Chunyan Zhang
2014-12-18 11:00       ` Mauro Carvalho Chehab [this message]
2014-12-18 11:39         ` Chunyan Zhang
2017-11-06 14:06 Arnd Bergmann

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=20141218090053.68a0aad6@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=arnd@linaro.org \
    --cc=david@hardeman.nu \
    --cc=hans.verkuil@cisco.com \
    --cc=himangi774@gmail.com \
    --cc=joe@perches.com \
    --cc=john.stultz@linaro.org \
    --cc=julia.lawall@lip6.fr \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=uli-lirc@uli-eckhardt.de \
    --cc=zhang.chunyan@linaro.org \
    --cc=zhang.lyra@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox