Re: [PATCH][drm-next] drm/amd/powerplay: fix a few spelling mistakes

From: Joe Perches
Date: Thu Aug 01 2019 - 15:16:32 EST


On Thu, 2019-08-01 at 15:02 -0400, Alex Deucher wrote:
> Applied. thanks!
>
> Alex
>
> On Thu, Aug 1, 2019 at 4:39 AM Colin King <colin.king@xxxxxxxxxxxxx> wrote:
> > From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> >
> > There are a few spelling mistakes "unknow" -> "unknown" and
> > "enabeld" -> "enabled". Fix these.
[]
> > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
[]
> > @@ -39,7 +39,7 @@ static const char* __smu_message_names[] = {
> > const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type)
> > {
> > if (type < 0 || type > SMU_MSG_MAX_COUNT)

This looks like an off-by-one test against
SMU_MSG_MAX_COUNT where type
should be >=

> > - return "unknow smu message";
> > + return "unknown smu message";
> > return __smu_message_names[type];
[]
> > @@ -52,7 +52,7 @@ static const char* __smu_feature_names[] = {
> > const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature)
> > {
> > if (feature < 0 || feature > SMU_FEATURE_COUNT)

here too

> > - return "unknow smu feature";
> > + return "unknown smu feature";
> > return __smu_feature_names[feature];

Perhaps instead it should be against ARRAY_SIZE(__smu_<foo>)

Also, the __SMU_DUMMY_MAP macro is unnecessarily complex.

It might be better to have some direct
index and name struct like

struct enum_name {
int val;
const char *name;
};

And walk that.

Perhaps add a macro like

#define enum_map(e)
{.val = e, .name = #e}