[PATCH] drm/amd/powerplay: convert the sclk/mclk into Mhz for comparation

Quan, Evan Evan.Quan at amd.com
Thu Jul 12 02:58:38 UTC 2018


> You could simplify this to:
> (clocks.data[i].clocks_in_khz / 10 == now) ? "*" : "");
>
It cannot be simplified as this. Since we need to do comparation in Mhz.
Otherwise we will miss the 'equal' situation.

Regards,
Evan
> -----Original Message-----
> From: Alex Deucher [mailto:alexdeucher at gmail.com]
> Sent: Wednesday, July 11, 2018 11:35 PM
> To: Quan, Evan <Evan.Quan at amd.com>
> Cc: amd-gfx list <amd-gfx at lists.freedesktop.org>
> Subject: Re: [PATCH] drm/amd/powerplay: convert the sclk/mclk into Mhz
> for comparation
> 
> On Wed, Jul 11, 2018 at 4:26 AM, Evan Quan <evan.quan at amd.com> wrote:
> > Convert the clocks into right Mhz unit. Otherwise, it will miss the
> > equal situation.
> >
> > Change-Id: I80e1af975715712f5ddef4ca6a6e356d90932613
> > Signed-off-by: Evan Quan <evan.quan at amd.com>
> > ---
> >  drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
> > b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
> > index cae76fe65881..c0ceb69a23b0 100644
> > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
> > @@ -1881,7 +1881,7 @@ static int vega12_print_clock_levels(struct
> pp_hwmgr *hwmgr,
> >                 for (i = 0; i < clocks.num_levels; i++)
> >                         size += sprintf(buf + size, "%d: %uMhz %s\n",
> >                                 i, clocks.data[i].clocks_in_khz / 1000,
> > -                               (clocks.data[i].clocks_in_khz / 1000 == now) ? "*" : "");
> > +                               (clocks.data[i].clocks_in_khz / 1000
> > + == now / 100) ? "*" : "");
> 
> 
> You could simplify this to:
> (clocks.data[i].clocks_in_khz / 10 == now) ? "*" : "");
> 
> >                 break;
> >
> >         case PP_MCLK:
> > @@ -1897,7 +1897,7 @@ static int vega12_print_clock_levels(struct
> pp_hwmgr *hwmgr,
> >                 for (i = 0; i < clocks.num_levels; i++)
> >                         size += sprintf(buf + size, "%d: %uMhz %s\n",
> >                                 i, clocks.data[i].clocks_in_khz / 1000,
> > -                               (clocks.data[i].clocks_in_khz / 1000 == now) ? "*" : "");
> > +                               (clocks.data[i].clocks_in_khz / 1000
> > + == now / 100) ? "*" : "");
> 
> Same here.  Either way:
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> 
> >                 break;
> >
> >         case PP_PCIE:
> > --
> > 2.18.0
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list