diff mbox

PCI Trivial: remove superfluous code

Message ID 1448284752-18538-1-git-send-email-caoj.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Cao jin Nov. 23, 2015, 1:19 p.m. UTC
remove superfluous code in do_pci_register_device(). See its caller:
pci_qdev_realize()

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 hw/pci/pci.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Marcel Apfelbaum Nov. 24, 2015, 6:30 p.m. UTC | #1
On 11/23/2015 03:19 PM, Cao jin wrote:
> remove superfluous code in do_pci_register_device(). See its caller:
> pci_qdev_realize()
>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>   hw/pci/pci.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 168b9cc..4d16da0 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -878,7 +878,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
>          return NULL;
>       }
>
> -    pci_dev->devfn = devfn;

Hi, can you please explain why this line is not needed?
As far as I see if do_pci_register_device is called with devfn -1 (auto assign),
the devfn will be computed by this function and then passed to pci_dev.

Am I missing anything?

Thanks,
Marcel


>       dma_as = pci_device_iommu_address_space(pci_dev);
>
>       memory_region_init_alias(&pci_dev->bus_master_enable_region,
>
Cao jin Nov. 25, 2015, 1:10 a.m. UTC | #2
On 11/25/2015 02:30 AM, Marcel Apfelbaum wrote:
> On 11/23/2015 03:19 PM, Cao jin wrote:
>> remove superfluous code in do_pci_register_device(). See its caller:
>> pci_qdev_realize()
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   hw/pci/pci.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index 168b9cc..4d16da0 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -878,7 +878,6 @@ static PCIDevice *do_pci_register_device(PCIDevice
>> *pci_dev, PCIBus *bus,
>>          return NULL;
>>       }
>>
>> -    pci_dev->devfn = devfn;
>
> Hi, can you please explain why this line is not needed?
> As far as I see if do_pci_register_device is called with devfn -1 (auto
> assign),
> the devfn will be computed by this function and then passed to pci_dev.
>

uh..sorry, my mistake. You remind me... I miss the "auto assign" 
condition. Please forget this patch...

> Am I missing anything?
>
> Thanks,
> Marcel
>
>
>>       dma_as = pci_device_iommu_address_space(pci_dev);
>>
>>       memory_region_init_alias(&pci_dev->bus_master_enable_region,
>>
>
>
diff mbox

Patch

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 168b9cc..4d16da0 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -878,7 +878,6 @@  static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
        return NULL;
     }
 
-    pci_dev->devfn = devfn;
     dma_as = pci_device_iommu_address_space(pci_dev);
 
     memory_region_init_alias(&pci_dev->bus_master_enable_region,