From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
David Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH] drm/radeon/dpm: Replace one-element array and use struct_size() helper
Date: Fri, 22 May 2020 12:27:36 -0500 [thread overview]
Message-ID: <20200522172736.GE29907@embeddedor> (raw)
In-Reply-To: <753faa45-247c-536c-d85a-5c1385ed0049@amd.com>
On Fri, May 22, 2020 at 09:00:09AM +0200, Christian König wrote:
> > +++ b/drivers/gpu/drm/radeon/ni_dpm.c
> > @@ -2685,11 +2685,12 @@ static int ni_upload_sw_state(struct radeon_device *rdev,
> > struct rv7xx_power_info *pi = rv770_get_pi(rdev);
> > u16 address = pi->state_table_start +
> > offsetof(NISLANDS_SMC_STATETABLE, driverState);
> > - u16 state_size = sizeof(NISLANDS_SMC_SWSTATE) +
> > - ((NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1) * sizeof(NISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> > + NISLANDS_SMC_SWSTATE *smc_state;
> > + u16 state_size = struct_size(smc_state, levels,
> > + NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE);
>
> Probably better to use size_t instead of u16 here. With that fixed feel free
> to stick my rb on the patch.
>
Sure thing. I'll send v2, shortly.
Thanks, Christian.
--
Gustavo
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
David Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org,
Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH] drm/radeon/dpm: Replace one-element array and use struct_size() helper
Date: Fri, 22 May 2020 12:27:36 -0500 [thread overview]
Message-ID: <20200522172736.GE29907@embeddedor> (raw)
In-Reply-To: <753faa45-247c-536c-d85a-5c1385ed0049@amd.com>
On Fri, May 22, 2020 at 09:00:09AM +0200, Christian König wrote:
> > +++ b/drivers/gpu/drm/radeon/ni_dpm.c
> > @@ -2685,11 +2685,12 @@ static int ni_upload_sw_state(struct radeon_device *rdev,
> > struct rv7xx_power_info *pi = rv770_get_pi(rdev);
> > u16 address = pi->state_table_start +
> > offsetof(NISLANDS_SMC_STATETABLE, driverState);
> > - u16 state_size = sizeof(NISLANDS_SMC_SWSTATE) +
> > - ((NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1) * sizeof(NISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> > + NISLANDS_SMC_SWSTATE *smc_state;
> > + u16 state_size = struct_size(smc_state, levels,
> > + NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE);
>
> Probably better to use size_t instead of u16 here. With that fixed feel free
> to stick my rb on the patch.
>
Sure thing. I'll send v2, shortly.
Thanks, Christian.
--
Gustavo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: Re: [PATCH] drm/radeon/dpm: Replace one-element array and use struct_size() helper
Date: Fri, 22 May 2020 12:27:36 -0500 [thread overview]
Message-ID: <20200522172736.GE29907@embeddedor> (raw)
In-Reply-To: <753faa45-247c-536c-d85a-5c1385ed0049@amd.com>
On Fri, May 22, 2020 at 09:00:09AM +0200, Christian König wrote:
> > +++ b/drivers/gpu/drm/radeon/ni_dpm.c
> > @@ -2685,11 +2685,12 @@ static int ni_upload_sw_state(struct radeon_device *rdev,
> > struct rv7xx_power_info *pi = rv770_get_pi(rdev);
> > u16 address = pi->state_table_start +
> > offsetof(NISLANDS_SMC_STATETABLE, driverState);
> > - u16 state_size = sizeof(NISLANDS_SMC_SWSTATE) +
> > - ((NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1) * sizeof(NISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> > + NISLANDS_SMC_SWSTATE *smc_state;
> > + u16 state_size = struct_size(smc_state, levels,
> > + NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE);
>
> Probably better to use size_t instead of u16 here. With that fixed feel free
> to stick my rb on the patch.
>
Sure thing. I'll send v2, shortly.
Thanks, Christian.
--
Gustavo
next prev parent reply other threads:[~2020-05-22 17:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 1:25 [PATCH] drm/radeon/dpm: Replace one-element array and use struct_size() helper Gustavo A. R. Silva
2020-05-22 1:25 ` Gustavo A. R. Silva
2020-05-22 1:25 ` Gustavo A. R. Silva
2020-05-22 7:00 ` Christian König
2020-05-22 7:00 ` Christian König
2020-05-22 7:00 ` Christian König
2020-05-22 17:27 ` Gustavo A. R. Silva [this message]
2020-05-22 17:27 ` Gustavo A. R. Silva
2020-05-22 17:27 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200522172736.GE29907@embeddedor \
--to=gustavoars@kernel.org \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.