diff mbox series

[1/2] pc-dimm: remove check on pc-dimm hotpluggable

Message ID 20190219060719.8211-2-richardw.yang@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series PCDIMM cleanup | expand

Commit Message

Wei Yang Feb. 19, 2019, 6:07 a.m. UTC
Function acpi_memory_plug_cb() is only invoked when dev is a PCDIMM,
which is hotpluggable. This means it is not necessary to check this
property again.

This patch removes this check.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 hw/acpi/memory_hotplug.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 19, 2019, 12:26 p.m. UTC | #1
On 2/19/19 7:07 AM, Wei Yang wrote:
> Function acpi_memory_plug_cb() is only invoked when dev is a PCDIMM,
> which is hotpluggable. This means it is not necessary to check this
> property again.
> 
> This patch removes this check.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  hw/acpi/memory_hotplug.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index 8c7c1013f3..b19673d337 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -266,10 +266,6 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,

This is also obvious because it takes a HotplugHandler argument.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>      MemStatus *mdev;
>      DeviceClass *dc = DEVICE_GET_CLASS(dev);
>  
> -    if (!dc->hotpluggable) {
> -        return;
> -    }
> -
>      mdev = acpi_memory_slot_status(mem_st, dev, errp);
>      if (!mdev) {
>          return;
>
Philippe Mathieu-Daudé Feb. 19, 2019, 12:29 p.m. UTC | #2
On 2/19/19 7:07 AM, Wei Yang wrote:
> Function acpi_memory_plug_cb() is only invoked when dev is a PCDIMM,
> which is hotpluggable. This means it is not necessary to check this
> property again.
> 
> This patch removes this check.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  hw/acpi/memory_hotplug.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index 8c7c1013f3..b19673d337 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -266,10 +266,6 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
>      MemStatus *mdev;
>      DeviceClass *dc = DEVICE_GET_CLASS(dev);

You have to remove the 'dc' variable now:

  CC      hw/acpi/memory_hotplug.o
hw/acpi/memory_hotplug.c: In function ‘acpi_memory_plug_cb’:
hw/acpi/memory_hotplug.c:267:18: error: unused variable ‘dc’
[-Werror=unused-variable]
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
                  ^~

Once removed:
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>  
> -    if (!dc->hotpluggable) {
> -        return;
> -    }
> -
>      mdev = acpi_memory_slot_status(mem_st, dev, errp);
>      if (!mdev) {
>          return;
>
Wei Yang Feb. 19, 2019, 1:02 p.m. UTC | #3
On Tue, Feb 19, 2019 at 01:29:38PM +0100, Philippe Mathieu-Daudé wrote:
>On 2/19/19 7:07 AM, Wei Yang wrote:
>> Function acpi_memory_plug_cb() is only invoked when dev is a PCDIMM,
>> which is hotpluggable. This means it is not necessary to check this
>> property again.
>> 
>> This patch removes this check.
>> 
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> ---
>>  hw/acpi/memory_hotplug.c | 4 ----
>>  1 file changed, 4 deletions(-)
>> 
>> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
>> index 8c7c1013f3..b19673d337 100644
>> --- a/hw/acpi/memory_hotplug.c
>> +++ b/hw/acpi/memory_hotplug.c
>> @@ -266,10 +266,6 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
>>      MemStatus *mdev;
>>      DeviceClass *dc = DEVICE_GET_CLASS(dev);
>
>You have to remove the 'dc' variable now:
>
>  CC      hw/acpi/memory_hotplug.o
>hw/acpi/memory_hotplug.c: In function ‘acpi_memory_plug_cb’:
>hw/acpi/memory_hotplug.c:267:18: error: unused variable ‘dc’
>[-Werror=unused-variable]
>     DeviceClass *dc = DEVICE_GET_CLASS(dev);
>                  ^~

Thanks, I didn't notice this warning.

>
>Once removed:
>Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
>>  
>> -    if (!dc->hotpluggable) {
>> -        return;
>> -    }
>> -
>>      mdev = acpi_memory_slot_status(mem_st, dev, errp);
>>      if (!mdev) {
>>          return;
>>
Igor Mammedov Feb. 21, 2019, 2:30 p.m. UTC | #4
On Tue, 19 Feb 2019 13:26:47 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On 2/19/19 7:07 AM, Wei Yang wrote:
> > Function acpi_memory_plug_cb() is only invoked when dev is a PCDIMM,
> > which is hotpluggable. This means it is not necessary to check this
> > property again.
> > 
> > This patch removes this check.
> > 
> > Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> > ---
> >  hw/acpi/memory_hotplug.c | 4 ----
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> > index 8c7c1013f3..b19673d337 100644
> > --- a/hw/acpi/memory_hotplug.c
> > +++ b/hw/acpi/memory_hotplug.c
> > @@ -266,10 +266,6 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,  
> 
> This is also obvious because it takes a HotplugHandler argument.
                                          ^^^^
that's a sort of atavism, handler also takes care of coldplug wiring nowdays.
(it's just nobody came up with new name and fixed it up)


> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> >      MemStatus *mdev;
> >      DeviceClass *dc = DEVICE_GET_CLASS(dev);
> >  
> > -    if (!dc->hotpluggable) {
> > -        return;
> > -    }
> > -
> >      mdev = acpi_memory_slot_status(mem_st, dev, errp);
> >      if (!mdev) {
> >          return;
> >   
>
diff mbox series

Patch

diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 8c7c1013f3..b19673d337 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -266,10 +266,6 @@  void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
     MemStatus *mdev;
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
 
-    if (!dc->hotpluggable) {
-        return;
-    }
-
     mdev = acpi_memory_slot_status(mem_st, dev, errp);
     if (!mdev) {
         return;