linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: remove unnecessary (void*) conversions
@ 2023-05-15  1:34 Su Hui
  2023-05-15  7:17 ` Dan Carpenter
  2023-05-15 21:37 ` Alex Deucher
  0 siblings, 2 replies; 5+ messages in thread
From: Su Hui @ 2023-05-15  1:34 UTC (permalink / raw)
  To: Alex Deucher, christian.koenig, Xinhui.Pan, David Airlie, Daniel Vetter
  Cc: amd-gfx, dri-devel, linux-kernel, kernel-janitors, Su Hui

No need cast (void*) to (struct amdgpu_device *).

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c      | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c     | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index f60753f97ac5..c837e0bf2cfc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1470,7 +1470,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
 
 static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 	struct drm_device *dev = adev_to_drm(adev);
 	int r = 0, i;
 
@@ -1581,7 +1581,7 @@ static int amdgpu_debugfs_benchmark(void *data, u64 val)
 
 static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 	struct drm_device *dev = adev_to_drm(adev);
 	struct drm_file *file;
 	int r;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index f52d0ba91a77..f0615a43b3cc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -835,7 +835,7 @@ static const struct dma_fence_ops amdgpu_job_fence_ops = {
 #if defined(CONFIG_DEBUG_FS)
 static int amdgpu_debugfs_fence_info_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 	int i;
 
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 863cb668e000..28f79cf8c3fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -948,7 +948,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 #if defined(CONFIG_DEBUG_FS)
 static int amdgpu_debugfs_gem_info_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 	struct drm_device *dev = adev_to_drm(adev);
 	struct drm_file *file;
 	int r;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 4ff348e10e4d..49a4238a120e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -436,7 +436,7 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
 
 static int amdgpu_debugfs_sa_info_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 
 	seq_printf(m, "--------------------- DELAYED --------------------- \n");
 	amdgpu_sa_bo_dump_debug_info(&adev->ib_pools[AMDGPU_IB_POOL_DELAYED],
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 0efb38539d70..9f9274249b57 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1441,7 +1441,7 @@ void amdgpu_disable_vblank_kms(struct drm_crtc *crtc)
 
 static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 	struct drm_amdgpu_info_firmware fw_info;
 	struct drm_amdgpu_query_fw query_fw;
 	struct atom_context *ctx = adev->mode_info.atom_context;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 2cd081cbf706..21f340ed4cca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2164,7 +2164,7 @@ int amdgpu_ttm_evict_resources(struct amdgpu_device *adev, int mem_type)
 
 static int amdgpu_ttm_page_pool_show(struct seq_file *m, void *unused)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+	struct amdgpu_device *adev = m->private;
 
 	return ttm_pool_debugfs(&adev->mman.bdev.pool, m);
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: remove unnecessary (void*) conversions
  2023-05-15  1:34 [PATCH] drm/amdgpu: remove unnecessary (void*) conversions Su Hui
@ 2023-05-15  7:17 ` Dan Carpenter
  2023-05-15 14:11   ` Alex Deucher
  2023-05-15 21:37 ` Alex Deucher
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2023-05-15  7:17 UTC (permalink / raw)
  To: Su Hui
  Cc: Alex Deucher, christian.koenig, Xinhui.Pan, David Airlie,
	Daniel Vetter, amd-gfx, dri-devel, linux-kernel, kernel-janitors

On Mon, May 15, 2023 at 09:34:28AM +0800, Su Hui wrote:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index f60753f97ac5..c837e0bf2cfc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1470,7 +1470,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
>  
>  static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
>  {
> -	struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +	struct amdgpu_device *adev = m->private;
>  	struct drm_device *dev = adev_to_drm(adev);
>  	int r = 0, i;
>  

This declaration block was originally written in reverse Christmas tree
order:

	long long long variable name;
	medium length name;
	short name;

So you probably want to change the order now that the lengths have
changed.  Same in the other places as well.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: remove unnecessary (void*) conversions
  2023-05-15  7:17 ` Dan Carpenter
@ 2023-05-15 14:11   ` Alex Deucher
  2023-05-15 14:42     ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2023-05-15 14:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Su Hui, Xinhui.Pan, kernel-janitors, linux-kernel, amd-gfx,
	dri-devel, Alex Deucher, christian.koenig

On Mon, May 15, 2023 at 3:17 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> On Mon, May 15, 2023 at 09:34:28AM +0800, Su Hui wrote:
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > index f60753f97ac5..c837e0bf2cfc 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > @@ -1470,7 +1470,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> >
> >  static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
> >  {
> > -     struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> > +     struct amdgpu_device *adev = m->private;
> >       struct drm_device *dev = adev_to_drm(adev);
> >       int r = 0, i;
> >
>
> This declaration block was originally written in reverse Christmas tree
> order:
>
>         long long long variable name;
>         medium length name;
>         short name;
>
> So you probably want to change the order now that the lengths have
> changed.  Same in the other places as well.

I don't think it's possible due to the variable dependencies unless
you separate the declarations and assignments which doesn't seem like
a net win to me.

Alex

>
> regards,
> dan carpenter
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: remove unnecessary (void*) conversions
  2023-05-15 14:11   ` Alex Deucher
@ 2023-05-15 14:42     ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-05-15 14:42 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Su Hui, Xinhui.Pan, kernel-janitors, linux-kernel, amd-gfx,
	dri-devel, Alex Deucher, christian.koenig

On Mon, May 15, 2023 at 10:11:39AM -0400, Alex Deucher wrote:
> On Mon, May 15, 2023 at 3:17 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > On Mon, May 15, 2023 at 09:34:28AM +0800, Su Hui wrote:
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > index f60753f97ac5..c837e0bf2cfc 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > @@ -1470,7 +1470,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> > >
> > >  static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
> > >  {
> > > -     struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> > > +     struct amdgpu_device *adev = m->private;
> > >       struct drm_device *dev = adev_to_drm(adev);
> > >       int r = 0, i;
> > >
> >
> > This declaration block was originally written in reverse Christmas tree
> > order:
> >
> >         long long long variable name;
> >         medium length name;
> >         short name;
> >
> > So you probably want to change the order now that the lengths have
> > changed.  Same in the other places as well.
> 
> I don't think it's possible due to the variable dependencies unless
> you separate the declarations and assignments which doesn't seem like
> a net win to me.

Gar.  I'm dumb.  Sorry for the noise.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: remove unnecessary (void*) conversions
  2023-05-15  1:34 [PATCH] drm/amdgpu: remove unnecessary (void*) conversions Su Hui
  2023-05-15  7:17 ` Dan Carpenter
@ 2023-05-15 21:37 ` Alex Deucher
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2023-05-15 21:37 UTC (permalink / raw)
  To: Su Hui
  Cc: Alex Deucher, christian.koenig, Xinhui.Pan, David Airlie,
	Daniel Vetter, kernel-janitors, dri-devel, amd-gfx, linux-kernel

Applied.  Thanks!

Alex

On Mon, May 15, 2023 at 3:18 AM Su Hui <suhui@nfschina.com> wrote:
>
> No need cast (void*) to (struct amdgpu_device *).
>
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c      | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c     | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index f60753f97ac5..c837e0bf2cfc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1470,7 +1470,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
>
>  static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>         struct drm_device *dev = adev_to_drm(adev);
>         int r = 0, i;
>
> @@ -1581,7 +1581,7 @@ static int amdgpu_debugfs_benchmark(void *data, u64 val)
>
>  static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>         struct drm_device *dev = adev_to_drm(adev);
>         struct drm_file *file;
>         int r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index f52d0ba91a77..f0615a43b3cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -835,7 +835,7 @@ static const struct dma_fence_ops amdgpu_job_fence_ops = {
>  #if defined(CONFIG_DEBUG_FS)
>  static int amdgpu_debugfs_fence_info_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>         int i;
>
>         for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 863cb668e000..28f79cf8c3fb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -948,7 +948,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
>  #if defined(CONFIG_DEBUG_FS)
>  static int amdgpu_debugfs_gem_info_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>         struct drm_device *dev = adev_to_drm(adev);
>         struct drm_file *file;
>         int r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index 4ff348e10e4d..49a4238a120e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -436,7 +436,7 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
>
>  static int amdgpu_debugfs_sa_info_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>
>         seq_printf(m, "--------------------- DELAYED --------------------- \n");
>         amdgpu_sa_bo_dump_debug_info(&adev->ib_pools[AMDGPU_IB_POOL_DELAYED],
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 0efb38539d70..9f9274249b57 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1441,7 +1441,7 @@ void amdgpu_disable_vblank_kms(struct drm_crtc *crtc)
>
>  static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>         struct drm_amdgpu_info_firmware fw_info;
>         struct drm_amdgpu_query_fw query_fw;
>         struct atom_context *ctx = adev->mode_info.atom_context;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 2cd081cbf706..21f340ed4cca 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -2164,7 +2164,7 @@ int amdgpu_ttm_evict_resources(struct amdgpu_device *adev, int mem_type)
>
>  static int amdgpu_ttm_page_pool_show(struct seq_file *m, void *unused)
>  {
> -       struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
> +       struct amdgpu_device *adev = m->private;
>
>         return ttm_pool_debugfs(&adev->mman.bdev.pool, m);
>  }
> --
> 2.30.2
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-15 21:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15  1:34 [PATCH] drm/amdgpu: remove unnecessary (void*) conversions Su Hui
2023-05-15  7:17 ` Dan Carpenter
2023-05-15 14:11   ` Alex Deucher
2023-05-15 14:42     ` Dan Carpenter
2023-05-15 21:37 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).