Re: [PATCH v2 5/9] drm/amd: drop the use of `pci_is_thunderbolt_attached`

Macpaul Lin
2022-02-11T01:32:00Z

On 2/11/22 6:43 AM, Mario Limonciello wrote:
> Currently `pci_is_thunderbolt_attached` is used to indicate a device
> is connected externally.
>
> The PCI core now marks such devices as removable and downstream drivers
> can use this instead.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 1ebb91db2274..6dbf5753b5be 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -161,7 +161,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
> (amdgpu_is_atpx_hybrid() ||
> amdgpu_has_atpx_dgpu_power_cntl()) &&
> ((flags & AMD_IS_APU) == 0) &&
> - !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
> + !dev_is_removable(&adev->pdev->dev))
> flags |= AMD_IS_PX;
>
> parent = pci_upstream_bridge(adev->pdev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
> index ee7cab37dfd5..2c5d74d836f0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
> @@ -382,7 +382,7 @@ static void nbio_v2_3_enable_aspm(struct amdgpu_device *adev,
>
> data |= NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT;
>
> - if (pci_is_thunderbolt_attached(adev->pdev))
> + if (dev_is_removable(&adev->pdev->dev))
> data |= NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;
> else
> data |= NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;
>

Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>

Thanks!

Regards,
Macpaul Lin