2022-09-28 02:01:59

by ZhouJie

[permalink] [raw]
Subject: [PATCH] init:Remove unnecessary (void*) conversions

The void pointer object can be directly assigned to different structure
objects, it does not need to be cast.

Signed-off-by: Zhou jie <[email protected]>
---
init/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/init/main.c b/init/main.c
index 98182c3c2c4b..5494caa24738 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1239,7 +1239,7 @@ __setup("initcall_blacklist=", initcall_blacklist);
static __init_or_module void
trace_initcall_start_cb(void *data, initcall_t fn)
{
- ktime_t *calltime = (ktime_t *)data;
+ ktime_t *calltime = data;

printk(KERN_DEBUG "calling %pS @ %i\n", fn, task_pid_nr(current));
*calltime = ktime_get();
@@ -1248,7 +1248,7 @@ trace_initcall_start_cb(void *data, initcall_t fn)
static __init_or_module void
trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
{
- ktime_t rettime, *calltime = (ktime_t *)data;
+ ktime_t rettime, *calltime = data;

rettime = ktime_get();
printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n",
--
2.18.2


2022-09-30 13:24:07

by Andrew Halaney

[permalink] [raw]
Subject: Re: [PATCH] init:Remove unnecessary (void*) conversions

Hi,

nit: $subject should have a space after init:, i.e "init: Remove".

On Wed, Sep 28, 2022 at 09:45:39AM +0800, Zhou jie wrote:
> The void pointer object can be directly assigned to different structure
> objects, it does not need to be cast.
>
> Signed-off-by: Zhou jie <[email protected]>

With the subject fixed up you can add:

Reviewed-by: Andrew Halaney <[email protected]>

> ---
> init/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/init/main.c b/init/main.c
> index 98182c3c2c4b..5494caa24738 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1239,7 +1239,7 @@ __setup("initcall_blacklist=", initcall_blacklist);
> static __init_or_module void
> trace_initcall_start_cb(void *data, initcall_t fn)
> {
> - ktime_t *calltime = (ktime_t *)data;
> + ktime_t *calltime = data;
>
> printk(KERN_DEBUG "calling %pS @ %i\n", fn, task_pid_nr(current));
> *calltime = ktime_get();
> @@ -1248,7 +1248,7 @@ trace_initcall_start_cb(void *data, initcall_t fn)
> static __init_or_module void
> trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
> {
> - ktime_t rettime, *calltime = (ktime_t *)data;
> + ktime_t rettime, *calltime = data;
>
> rettime = ktime_get();
> printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n",
> --
> 2.18.2
>

2022-10-03 16:33:55

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] init:Remove unnecessary (void*) conversions

On Fri, 30 Sep 2022 08:11:42 -0500
Andrew Halaney <[email protected]> wrote:

> Hi,
>
> nit: $subject should have a space after init:, i.e "init: Remove".
>
> On Wed, Sep 28, 2022 at 09:45:39AM +0800, Zhou jie wrote:
> > The void pointer object can be directly assigned to different structure
> > objects, it does not need to be cast.
> >
> > Signed-off-by: Zhou jie <[email protected]>
>
> With the subject fixed up you can add:
>
> Reviewed-by: Andrew Halaney <[email protected]>

Looks fine to me too.

Andrew Morton, care to take this?

Acked-by: Steven Rostedt (Google) <[email protected]>

-- Steve

>
> > ---
> > init/main.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/init/main.c b/init/main.c
> > index 98182c3c2c4b..5494caa24738 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -1239,7 +1239,7 @@ __setup("initcall_blacklist=", initcall_blacklist);
> > static __init_or_module void
> > trace_initcall_start_cb(void *data, initcall_t fn)
> > {
> > - ktime_t *calltime = (ktime_t *)data;
> > + ktime_t *calltime = data;
> >
> > printk(KERN_DEBUG "calling %pS @ %i\n", fn, task_pid_nr(current));
> > *calltime = ktime_get();
> > @@ -1248,7 +1248,7 @@ trace_initcall_start_cb(void *data, initcall_t fn)
> > static __init_or_module void
> > trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
> > {
> > - ktime_t rettime, *calltime = (ktime_t *)data;
> > + ktime_t rettime, *calltime = data;
> >
> > rettime = ktime_get();
> > printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n",
> > --
> > 2.18.2
> >