diff mbox

[trivial] xen-hvm: Remove redandant varialbe 'xstate'

Message ID 5461D59C.5020106@gmail.com
State New
Headers show

Commit Message

Chen Gang Nov. 11, 2014, 9:23 a.m. UTC
In xen_hvm_change_state_handler(), can pass 'opaque' with type cast to
xen_main_loop_prepare() directly, need not use additional variable for
it.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 xen-hvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefano Stabellini Nov. 11, 2014, 10:53 a.m. UTC | #1
On Tue, 11 Nov 2014, Chen Gang wrote:
> In xen_hvm_change_state_handler(), can pass 'opaque' with type cast to
> xen_main_loop_prepare() directly, need not use additional variable for
> it.
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  xen-hvm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/xen-hvm.c b/xen-hvm.c
> index 21f1cbb..7548794 100644
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -993,9 +993,8 @@ static void xen_main_loop_prepare(XenIOState *state)
>  static void xen_hvm_change_state_handler(void *opaque, int running,
>                                           RunState rstate)
>  {
> -    XenIOState *xstate = opaque;
>      if (running) {
> -        xen_main_loop_prepare(xstate);
> +        xen_main_loop_prepare((XenIOState *)opaque);
>      }
>  }
>  
> -- 
> 1.8.5.2 (Apple Git-48)
>
Konrad Rzeszutek Wilk Nov. 11, 2014, 2:24 p.m. UTC | #2
On Tue, Nov 11, 2014 at 10:53:01AM +0000, Stefano Stabellini wrote:
> On Tue, 11 Nov 2014, Chen Gang wrote:
> > In xen_hvm_change_state_handler(), can pass 'opaque' with type cast to
> > xen_main_loop_prepare() directly, need not use additional variable for
> > it.

The title of your patch should say 'variable'.
> > 
> > Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> 
> >  xen-hvm.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/xen-hvm.c b/xen-hvm.c
> > index 21f1cbb..7548794 100644
> > --- a/xen-hvm.c
> > +++ b/xen-hvm.c
> > @@ -993,9 +993,8 @@ static void xen_main_loop_prepare(XenIOState *state)
> >  static void xen_hvm_change_state_handler(void *opaque, int running,
> >                                           RunState rstate)
> >  {
> > -    XenIOState *xstate = opaque;
> >      if (running) {
> > -        xen_main_loop_prepare(xstate);
> > +        xen_main_loop_prepare((XenIOState *)opaque);
> >      }
> >  }
> >  
> > -- 
> > 1.8.5.2 (Apple Git-48)
> > 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
Michael Tokarev Nov. 11, 2014, 2:26 p.m. UTC | #3
11.11.2014 12:23, Chen Gang wrote:
> In xen_hvm_change_state_handler(), can pass 'opaque' with type cast to
> xen_main_loop_prepare() directly, need not use additional variable for
> it.

gcc most likely eliminates it anyway, but heck, why not?
Applied to -trivial, thank you!

/mjt
Chen Gang Nov. 11, 2014, 2:32 p.m. UTC | #4
On 11/11/14 22:24, Konrad Rzeszutek Wilk wrote:
> On Tue, Nov 11, 2014 at 10:53:01AM +0000, Stefano Stabellini wrote:
>> On Tue, 11 Nov 2014, Chen Gang wrote:
>>> In xen_hvm_change_state_handler(), can pass 'opaque' with type cast to
>>> xen_main_loop_prepare() directly, need not use additional variable for
>>> it.
> 
> The title of your patch should say 'variable'.

Oh, yes, thanks. If necessary to send patch v2 for it, please let me
know.

Thanks.

>>>
>>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>>
>> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>
>>
>>>  xen-hvm.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/xen-hvm.c b/xen-hvm.c
>>> index 21f1cbb..7548794 100644
>>> --- a/xen-hvm.c
>>> +++ b/xen-hvm.c
>>> @@ -993,9 +993,8 @@ static void xen_main_loop_prepare(XenIOState *state)
>>>  static void xen_hvm_change_state_handler(void *opaque, int running,
>>>                                           RunState rstate)
>>>  {
>>> -    XenIOState *xstate = opaque;
>>>      if (running) {
>>> -        xen_main_loop_prepare(xstate);
>>> +        xen_main_loop_prepare((XenIOState *)opaque);
>>>      }
>>>  }
>>>  
>>> -- 
>>> 1.8.5.2 (Apple Git-48)
>>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
Michael Tokarev Nov. 11, 2014, 2:37 p.m. UTC | #5
11.11.2014 17:32, Chen Gang wrote:
>> The title of your patch should say 'variable'.
> 
> Oh, yes, thanks. If necessary to send patch v2 for it, please let me
> know.

Not only 'varialbe', but also 'redandant'.  I fixed both on commit, plus
fixed grammar in commit message.

Thanks,

/mjt
diff mbox

Patch

diff --git a/xen-hvm.c b/xen-hvm.c
index 21f1cbb..7548794 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -993,9 +993,8 @@  static void xen_main_loop_prepare(XenIOState *state)
 static void xen_hvm_change_state_handler(void *opaque, int running,
                                          RunState rstate)
 {
-    XenIOState *xstate = opaque;
     if (running) {
-        xen_main_loop_prepare(xstate);
+        xen_main_loop_prepare((XenIOState *)opaque);
     }
 }