2023-06-23 10:36:15

by Sui Jingfeng

[permalink] [raw]
Subject: [PATCH v1 0/8] drm/etnaviv: Various cleanup

From: Sui Jingfeng <[email protected]>

No functional change.

Sui Jingfeng (8):
drm/etnaviv: Using the size_t variable to store the number of pages
drm/etnaviv: Using the unsigned int type to count the number of pages
drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl()
drm/etnaviv: Remove surplus else after return
drm/etnaviv: Keep the curly brace aligned
drm/etnaviv: No indentation by double tabs
drm/etnaviv: Add dedicated functions to create and destroy platform
device
drm/etnaviv: Add a helper to get a pointer to the first available node

drivers/gpu/drm/etnaviv/etnaviv_drv.c | 100 +++++++++++++-------
drivers/gpu/drm/etnaviv/etnaviv_gem.c | 14 +--
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 7 +-
3 files changed, 77 insertions(+), 44 deletions(-)

--
2.25.1



2023-06-23 10:36:19

by Sui Jingfeng

[permalink] [raw]
Subject: [PATCH v1 7/8] drm/etnaviv: Add dedicated functions to create and destroy platform device

From: Sui Jingfeng <[email protected]>

Also rename the virtual master device as etnaviv_platform_device,
for better reflection that it is a platform device, not a DRM device.
Another benefit is that we no longer need to call of_node_put() for three
different cases, Instead, we only need to call it once.

Signed-off-by: Sui Jingfeng <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 56 +++++++++++++++++++--------
1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 14c2e9690ce1..7d0eeab3e8b7 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -655,12 +655,44 @@ static struct platform_driver etnaviv_platform_driver = {
},
};

-static struct platform_device *etnaviv_drm;
+static struct platform_device *etnaviv_platform_device;

-static int __init etnaviv_init(void)
+static int etnaviv_create_platform_device(const char *name,
+ struct platform_device **ppdev)
{
struct platform_device *pdev;
int ret;
+
+ pdev = platform_device_alloc(name, PLATFORM_DEVID_NONE);
+ if (!pdev)
+ return -ENOMEM;
+
+ ret = platform_device_add(pdev);
+ if (ret) {
+ platform_device_put(pdev);
+ return ret;
+ }
+
+ *ppdev = pdev;
+
+ return 0;
+}
+
+static void etnaviv_destroy_platform_device(struct platform_device **ppdev)
+{
+ struct platform_device *pdev = *ppdev;
+
+ if (!pdev)
+ return;
+
+ platform_device_unregister(pdev);
+
+ *ppdev = NULL;
+}
+
+static int __init etnaviv_init(void)
+{
+ int ret;
struct device_node *np;

etnaviv_validate_init();
@@ -680,23 +712,13 @@ static int __init etnaviv_init(void)
for_each_compatible_node(np, NULL, "vivante,gc") {
if (!of_device_is_available(np))
continue;
+ of_node_put(np);

- pdev = platform_device_alloc("etnaviv", PLATFORM_DEVID_NONE);
- if (!pdev) {
- ret = -ENOMEM;
- of_node_put(np);
- goto unregister_platform_driver;
- }
-
- ret = platform_device_add(pdev);
- if (ret) {
- platform_device_put(pdev);
- of_node_put(np);
+ ret = etnaviv_create_platform_device("etnaviv",
+ &etnaviv_platform_device);
+ if (ret)
goto unregister_platform_driver;
- }

- etnaviv_drm = pdev;
- of_node_put(np);
break;
}

@@ -712,7 +734,7 @@ module_init(etnaviv_init);

static void __exit etnaviv_exit(void)
{
- platform_device_unregister(etnaviv_drm);
+ etnaviv_destroy_platform_device(&etnaviv_platform_device);
platform_driver_unregister(&etnaviv_platform_driver);
platform_driver_unregister(&etnaviv_gpu_driver);
}
--
2.25.1


2023-06-23 10:37:57

by Sui Jingfeng

[permalink] [raw]
Subject: [PATCH v1 6/8] drm/etnaviv: No indentation by double tabs

From: Sui Jingfeng <[email protected]>

Single tab should be enough.

Signed-off-by: Sui Jingfeng <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index cef97bb9c99f..14c2e9690ce1 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -231,11 +231,11 @@ static int show_each_gpu(struct seq_file *m, void *arg)
}

static struct drm_info_list etnaviv_debugfs_list[] = {
- {"gpu", show_each_gpu, 0, etnaviv_gpu_debugfs},
- {"gem", show_unlocked, 0, etnaviv_gem_show},
- { "mm", show_unlocked, 0, etnaviv_mm_show },
- {"mmu", show_each_gpu, 0, etnaviv_mmu_show},
- {"ring", show_each_gpu, 0, etnaviv_ring_show},
+ {"gpu", show_each_gpu, 0, etnaviv_gpu_debugfs},
+ {"gem", show_unlocked, 0, etnaviv_gem_show},
+ { "mm", show_unlocked, 0, etnaviv_mm_show },
+ {"mmu", show_each_gpu, 0, etnaviv_mmu_show},
+ {"ring", show_each_gpu, 0, etnaviv_ring_show},
};

static void etnaviv_debugfs_init(struct drm_minor *minor)
--
2.25.1


2023-07-17 09:08:56

by Sui Jingfeng

[permalink] [raw]
Subject: Re: [PATCH v1 0/8] drm/etnaviv: Various cleanup

Hi, Dear etnaviv folks


Would you like to review this cleanup patch set ?

I am asking because I'm wondering that

if I should re-spin my other patch from the code base

which *with* this series applied or from the code base

*without* this series applied.


I think this series looks fine, is it acceptable?


On 2023/6/23 18:08, Sui Jingfeng wrote:
> From: Sui Jingfeng <[email protected]>
>
> No functional change.
>
> Sui Jingfeng (8):
> drm/etnaviv: Using the size_t variable to store the number of pages
> drm/etnaviv: Using the unsigned int type to count the number of pages
> drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl()
> drm/etnaviv: Remove surplus else after return
> drm/etnaviv: Keep the curly brace aligned
> drm/etnaviv: No indentation by double tabs
> drm/etnaviv: Add dedicated functions to create and destroy platform
> device
> drm/etnaviv: Add a helper to get a pointer to the first available node
>
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 100 +++++++++++++-------
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 14 +--
> drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 7 +-
> 3 files changed, 77 insertions(+), 44 deletions(-)
>


2023-07-17 10:32:42

by Lucas Stach

[permalink] [raw]
Subject: Re: [PATCH v1 0/8] drm/etnaviv: Various cleanup

Hi Jingfeng,

Am Montag, dem 17.07.2023 um 16:36 +0800 schrieb suijingfeng:
> Hi, Dear etnaviv folks
>
>
> Would you like to review this cleanup patch set ?
>
> I am asking because I'm wondering that
>
> if I should re-spin my other patch from the code base
>
> which *with* this series applied or from the code base
>
> *without* this series applied.
>
>
> I think this series looks fine, is it acceptable?
>
I've gone through the series and left some comments. All patches that I
didn't comment on look fine to me. I'm generally in favor of taking
this series.

Regards,
Lucas

>
> On 2023/6/23 18:08, Sui Jingfeng wrote:
> > From: Sui Jingfeng <[email protected]>
> >
> > No functional change.
> >
> > Sui Jingfeng (8):
> > drm/etnaviv: Using the size_t variable to store the number of pages
> > drm/etnaviv: Using the unsigned int type to count the number of pages
> > drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl()
> > drm/etnaviv: Remove surplus else after return
> > drm/etnaviv: Keep the curly brace aligned
> > drm/etnaviv: No indentation by double tabs
> > drm/etnaviv: Add dedicated functions to create and destroy platform
> > device
> > drm/etnaviv: Add a helper to get a pointer to the first available node
> >
> > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 100 +++++++++++++-------
> > drivers/gpu/drm/etnaviv/etnaviv_gem.c | 14 +--
> > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 7 +-
> > 3 files changed, 77 insertions(+), 44 deletions(-)
> >
>