Message ID | 20240822065746.1336545-1-11162571@vivo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1] drivers:smumgr:Use min macro | expand |
Sorry, please ignore this patch. Because the corresponding header file is not included, there may be compilation errors. 在 2024/8/22 14:57, Yang Ruibin 写道: > Instead of using the min() implementation of > the ternary operator, use real macros. > > Signed-off-by: Yang Ruibin <11162571@vivo.com> > --- > drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c | 5 +---- > drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 7 ++----- > drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c | 5 +---- > 3 files changed, 4 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > index 5e43ad2b2..8bf80f65f 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c > @@ -1067,10 +1067,7 @@ static int fiji_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) > (1 << (lowest_pcie_level_enabled + 1 + count))) == 0)) > count++; > > - mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) < > - hightest_pcie_level_enabled ? > - (lowest_pcie_level_enabled + 1 + count) : > - hightest_pcie_level_enabled; > + mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count, > + hightest_pcie_level_enabled); > > /* set pcieDpmLevel to hightest_pcie_level_enabled */ > for (i = 2; i < dpm_table->sclk_table.count; i++) > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c > index ff6b563ec..62d9156ef 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c > @@ -1127,11 +1127,8 @@ static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) > (1 << (lowest_pcie_level_enabled + 1 + count))) == 0)) > count++; > > - mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) < > - hightest_pcie_level_enabled ? > - (lowest_pcie_level_enabled + 1 + count) : > - hightest_pcie_level_enabled; > - > + mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count, > + hightest_pcie_level_enabled); > > /* set pcieDpmLevel to hightest_pcie_level_enabled */ > for (i = 2; i < dpm_table->sclk_table.count; i++) > levels[i].pcieDpmLevel = hightest_pcie_level_enabled; > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c > index 34c9f59b8..4616c3261 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c > @@ -938,10 +938,7 @@ static int vegam_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) > (1 << (lowest_pcie_level_enabled + 1 + count))) == 0)) > count++; > > - mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) < > - hightest_pcie_level_enabled ? > - (lowest_pcie_level_enabled + 1 + count) : > - hightest_pcie_level_enabled; > + mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count, > + hightest_pcie_level_enabled); > > /* set pcieDpmLevel to hightest_pcie_level_enabled */ > for (i = 2; i < dpm_table->sclk_table.count; i++)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c index 5e43ad2b2..8bf80f65f 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c @@ -1067,10 +1067,7 @@ static int fiji_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) (1 << (lowest_pcie_level_enabled + 1 + count))) == 0)) count++; - mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) < - hightest_pcie_level_enabled ? - (lowest_pcie_level_enabled + 1 + count) : - hightest_pcie_level_enabled; + mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count, + hightest_pcie_level_enabled); /* set pcieDpmLevel to hightest_pcie_level_enabled */ for (i = 2; i < dpm_table->sclk_table.count; i++) diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c index ff6b563ec..62d9156ef 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c @@ -1127,11 +1127,8 @@ static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) (1 << (lowest_pcie_level_enabled + 1 + count))) == 0)) count++; - mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) < - hightest_pcie_level_enabled ? - (lowest_pcie_level_enabled + 1 + count) : - hightest_pcie_level_enabled; - + mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count, + hightest_pcie_level_enabled); /* set pcieDpmLevel to hightest_pcie_level_enabled */ for (i = 2; i < dpm_table->sclk_table.count; i++) levels[i].pcieDpmLevel = hightest_pcie_level_enabled; diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c index 34c9f59b8..4616c3261 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c @@ -938,10 +938,7 @@ static int vegam_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) (1 << (lowest_pcie_level_enabled + 1 + count))) == 0)) count++; - mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) < - hightest_pcie_level_enabled ? - (lowest_pcie_level_enabled + 1 + count) : - hightest_pcie_level_enabled; + mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count, + hightest_pcie_level_enabled); /* set pcieDpmLevel to hightest_pcie_level_enabled */ for (i = 2; i < dpm_table->sclk_table.count; i++)
Instead of using the min() implementation of the ternary operator, use real macros. Signed-off-by: Yang Ruibin <11162571@vivo.com> --- drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c | 5 +---- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 7 ++----- drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c | 5 +---- 3 files changed, 4 insertions(+), 13 deletions(-)