public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] time: correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64
  2022-07-12  9:47 ` [PATCH] time: correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64 Youngmin Nam
@ 2022-07-12  9:25   ` Arnd Bergmann
  2022-08-02  6:19     ` Youngmin Nam
  2022-08-09 18:04   ` [tip: timers/urgent] time: Correct " tip-bot2 for Youngmin Nam
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2022-07-12  9:25 UTC (permalink / raw)
  To: Youngmin Nam
  Cc: Arnd Bergmann, John Stultz, Thomas Gleixner, Stephen Boyd,
	Linux Kernel Mailing List, Chanho Park, hajun.sung, hosung0.kim,
	d7271.choe

On Tue, Jul 12, 2022 at 11:47 AM Youngmin Nam <youngmin.nam@samsung.com> wrote:
>
> In ns_to_kernel_old_timeval() definition,
> the function argument is defined with const identifier in kernel/time/time.c,
> but the prototype in include/linux/time32.h looks different.
>
> - The function is defined in kernel/time/time.c as below:
> struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)
>
> - The function is decalared in include/linux/time32.h as below:
> extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);
>
> Because the variable of arithmethic types isn't modified in the calling scope,
> there's no need to mark arguments as const.
> And there is a review in Link[1] why it was omitted during review stage,
> so they should be matched.
>
> Likewise, we can remove the "const" keyword in both definition and declaration
> of ns_to_timespec64() as it was metentined below Link[2] and Link[3].
>
> Link[1]: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1637458.html
> Link[2]: https://lore.kernel.org/all/20220531064346.51677-1-chanho61.park@samsung.com/T/
> Link[3]: https://lore.kernel.org/lkml/CAK8P3a3nknJgEDESGdJH91jMj6R_xydFqWASd8r5BbesdvMBgA@mail.gmail.com
> Fixes: a84d1169164b ("y2038: Introduce struct __kernel_old_timeval")
> Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] time: correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64
       [not found] <CGME20220712091922epcas2p34d7c89f02780afa58950b103a62eb59a@epcas2p3.samsung.com>
@ 2022-07-12  9:47 ` Youngmin Nam
  2022-07-12  9:25   ` Arnd Bergmann
  2022-08-09 18:04   ` [tip: timers/urgent] time: Correct " tip-bot2 for Youngmin Nam
  0 siblings, 2 replies; 4+ messages in thread
From: Youngmin Nam @ 2022-07-12  9:47 UTC (permalink / raw)
  To: arnd, jstultz, tglx
  Cc: sboyd, linux-kernel, youngmin.nam, chanho61.park, hajun.sung,
	hosung0.kim, d7271.choe

In ns_to_kernel_old_timeval() definition,
the function argument is defined with const identifier in kernel/time/time.c,
but the prototype in include/linux/time32.h looks different.

- The function is defined in kernel/time/time.c as below:
struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)

- The function is decalared in include/linux/time32.h as below:
extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);

Because the variable of arithmethic types isn't modified in the calling scope,
there's no need to mark arguments as const.
And there is a review in Link[1] why it was omitted during review stage,
so they should be matched.

Likewise, we can remove the "const" keyword in both definition and declaration
of ns_to_timespec64() as it was metentined below Link[2] and Link[3].

Link[1]: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1637458.html
Link[2]: https://lore.kernel.org/all/20220531064346.51677-1-chanho61.park@samsung.com/T/
Link[3]: https://lore.kernel.org/lkml/CAK8P3a3nknJgEDESGdJH91jMj6R_xydFqWASd8r5BbesdvMBgA@mail.gmail.com
Fixes: a84d1169164b ("y2038: Introduce struct __kernel_old_timeval")
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
---
 include/linux/time64.h | 2 +-
 kernel/time/time.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/time64.h b/include/linux/time64.h
index 81b9686a2079..ee021da0966e 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -142,7 +142,7 @@ static inline s64 timespec64_to_ns(const struct timespec64 *ts)
  *
  * Returns the timespec64 representation of the nsec parameter.
  */
-extern struct timespec64 ns_to_timespec64(const s64 nsec);
+extern struct timespec64 ns_to_timespec64(s64 nsec);
 
 /**
  * timespec64_add_ns - Adds nanoseconds to a timespec64
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 29923b20e0e4..526257b3727c 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -449,7 +449,7 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0,
 }
 EXPORT_SYMBOL(mktime64);
 
-struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)
+struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec)
 {
 	struct timespec64 ts = ns_to_timespec64(nsec);
 	struct __kernel_old_timeval tv;
@@ -503,7 +503,7 @@ EXPORT_SYMBOL(set_normalized_timespec64);
  *
  * Returns the timespec64 representation of the nsec parameter.
  */
-struct timespec64 ns_to_timespec64(const s64 nsec)
+struct timespec64 ns_to_timespec64(s64 nsec)
 {
 	struct timespec64 ts = { 0, 0 };
 	s32 rem;
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] time: correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64
  2022-07-12  9:25   ` Arnd Bergmann
@ 2022-08-02  6:19     ` Youngmin Nam
  0 siblings, 0 replies; 4+ messages in thread
From: Youngmin Nam @ 2022-08-02  6:19 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner
  Cc: Arnd Bergmann, Stephen Boyd, Linux Kernel Mailing List,
	Chanho Park, hajun.sung, hosung0.kim, d7271.choe, youngmin.nam

[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]

Hi Jone, Thomas.

Could you consider applying this patch ?

Thanks

On Tue, Jul 12, 2022 at 11:25:22AM +0200, Arnd Bergmann wrote:
> On Tue, Jul 12, 2022 at 11:47 AM Youngmin Nam <youngmin.nam@samsung.com> wrote:
> >
> > In ns_to_kernel_old_timeval() definition,
> > the function argument is defined with const identifier in kernel/time/time.c,
> > but the prototype in include/linux/time32.h looks different.
> >
> > - The function is defined in kernel/time/time.c as below:
> > struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)
> >
> > - The function is decalared in include/linux/time32.h as below:
> > extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);
> >
> > Because the variable of arithmethic types isn't modified in the calling scope,
> > there's no need to mark arguments as const.
> > And there is a review in Link[1] why it was omitted during review stage,
> > so they should be matched.
> >
> > Likewise, we can remove the "const" keyword in both definition and declaration
> > of ns_to_timespec64() as it was metentined below Link[2] and Link[3].
> >
> > Link[1]: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1637458.html
> > Link[2]: https://lore.kernel.org/all/20220531064346.51677-1-chanho61.park@samsung.com/T/
> > Link[3]: https://lore.kernel.org/lkml/CAK8P3a3nknJgEDESGdJH91jMj6R_xydFqWASd8r5BbesdvMBgA@mail.gmail.com
> > Fixes: a84d1169164b ("y2038: Introduce struct __kernel_old_timeval")
> > Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> 

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: timers/urgent] time: Correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64
  2022-07-12  9:47 ` [PATCH] time: correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64 Youngmin Nam
  2022-07-12  9:25   ` Arnd Bergmann
@ 2022-08-09 18:04   ` tip-bot2 for Youngmin Nam
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Youngmin Nam @ 2022-08-09 18:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Youngmin Nam, Thomas Gleixner, Arnd Bergmann, x86, linux-kernel

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     46dae32fe625a75f549c3a70edc77b778197bb05
Gitweb:        https://git.kernel.org/tip/46dae32fe625a75f549c3a70edc77b778197bb05
Author:        Youngmin Nam <youngmin.nam@samsung.com>
AuthorDate:    Tue, 12 Jul 2022 18:47:15 +09:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 09 Aug 2022 20:02:13 +02:00

time: Correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64

In ns_to_kernel_old_timeval() definition, the function argument is defined
with const identifier in kernel/time/time.c, but the prototype in
include/linux/time32.h looks different.

- The function is defined in kernel/time/time.c as below:
  struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)

- The function is decalared in include/linux/time32.h as below:
  extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);

Because the variable of arithmethic types isn't modified in the calling scope,
there's no need to mark arguments as const, which was already mentioned during 
review (Link[1) of the original patch.

Likewise remove the "const" keyword in both definition and declaration of
ns_to_timespec64() as requested by Arnd (Link[2]).

Fixes: a84d1169164b ("y2038: Introduce struct __kernel_old_timeval")
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/all/20220712094715.2918823-1-youngmin.nam@samsung.com
Link[1]: https://lore.kernel.org/all/20180310081123.thin6wphgk7tongy@gmail.com/
Link[2]: https://lore.kernel.org/all/CAK8P3a3nknJgEDESGdJH91jMj6R_xydFqWASd8r5BbesdvMBgA@mail.gmail.com/

---
 include/linux/time64.h | 2 +-
 kernel/time/time.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/time64.h b/include/linux/time64.h
index 2fb8232..f1bcea8 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -145,7 +145,7 @@ static inline s64 timespec64_to_ns(const struct timespec64 *ts)
  *
  * Returns the timespec64 representation of the nsec parameter.
  */
-extern struct timespec64 ns_to_timespec64(const s64 nsec);
+extern struct timespec64 ns_to_timespec64(s64 nsec);
 
 /**
  * timespec64_add_ns - Adds nanoseconds to a timespec64
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 29923b2..526257b 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -449,7 +449,7 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0,
 }
 EXPORT_SYMBOL(mktime64);
 
-struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)
+struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec)
 {
 	struct timespec64 ts = ns_to_timespec64(nsec);
 	struct __kernel_old_timeval tv;
@@ -503,7 +503,7 @@ EXPORT_SYMBOL(set_normalized_timespec64);
  *
  * Returns the timespec64 representation of the nsec parameter.
  */
-struct timespec64 ns_to_timespec64(const s64 nsec)
+struct timespec64 ns_to_timespec64(s64 nsec)
 {
 	struct timespec64 ts = { 0, 0 };
 	s32 rem;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-09 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20220712091922epcas2p34d7c89f02780afa58950b103a62eb59a@epcas2p3.samsung.com>
2022-07-12  9:47 ` [PATCH] time: correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64 Youngmin Nam
2022-07-12  9:25   ` Arnd Bergmann
2022-08-02  6:19     ` Youngmin Nam
2022-08-09 18:04   ` [tip: timers/urgent] time: Correct " tip-bot2 for Youngmin Nam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox