* [PATCH] drm: Remove drm_num_crtcs() helper
@ 2024-02-27 11:20 Thierry Reding
2024-02-27 11:33 ` Jani Nikula
2024-02-27 11:40 ` Javier Martinez Canillas
0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2024-02-27 11:20 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
Cc: David Airlie, Daniel Vetter, Javier Martinez Canillas, dri-devel
From: Thierry Reding <treding@nvidia.com>
The drm_num_crtcs() helper determines the number of CRTCs by iterating
over the list of CRTCs that have been registered with the mode config.
However, we already keep track of that number in the mode config's
num_crtcs field, so we can simply retrieve the value from that and
remove the extra helper function.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/gpu/drm/drm_crtc.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 6795624f16e7..82c665d3e74b 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -107,18 +107,6 @@ int drm_crtc_force_disable(struct drm_crtc *crtc)
return drm_mode_set_config_internal(&set);
}
-static unsigned int drm_num_crtcs(struct drm_device *dev)
-{
- unsigned int num = 0;
- struct drm_crtc *tmp;
-
- drm_for_each_crtc(tmp, dev) {
- num++;
- }
-
- return num;
-}
-
int drm_crtc_register_all(struct drm_device *dev)
{
struct drm_crtc *crtc;
@@ -278,8 +266,7 @@ static int __drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *
if (name) {
crtc->name = kvasprintf(GFP_KERNEL, name, ap);
} else {
- crtc->name = kasprintf(GFP_KERNEL, "crtc-%d",
- drm_num_crtcs(dev));
+ crtc->name = kasprintf(GFP_KERNEL, "crtc-%d", config->num_crtc);
}
if (!crtc->name) {
drm_mode_object_unregister(dev, &crtc->base);
--
2.44.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm: Remove drm_num_crtcs() helper
2024-02-27 11:20 [PATCH] drm: Remove drm_num_crtcs() helper Thierry Reding
@ 2024-02-27 11:33 ` Jani Nikula
2024-02-27 11:40 ` Javier Martinez Canillas
1 sibling, 0 replies; 3+ messages in thread
From: Jani Nikula @ 2024-02-27 11:33 UTC (permalink / raw)
To: Thierry Reding, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann
Cc: David Airlie, Daniel Vetter, Javier Martinez Canillas, dri-devel
On Tue, 27 Feb 2024, Thierry Reding <thierry.reding@gmail.com> wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The drm_num_crtcs() helper determines the number of CRTCs by iterating
> over the list of CRTCs that have been registered with the mode config.
> However, we already keep track of that number in the mode config's
> num_crtcs field, so we can simply retrieve the value from that and
> remove the extra helper function.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/drm_crtc.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 6795624f16e7..82c665d3e74b 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -107,18 +107,6 @@ int drm_crtc_force_disable(struct drm_crtc *crtc)
> return drm_mode_set_config_internal(&set);
> }
>
> -static unsigned int drm_num_crtcs(struct drm_device *dev)
> -{
> - unsigned int num = 0;
> - struct drm_crtc *tmp;
> -
> - drm_for_each_crtc(tmp, dev) {
> - num++;
> - }
> -
> - return num;
> -}
> -
> int drm_crtc_register_all(struct drm_device *dev)
> {
> struct drm_crtc *crtc;
> @@ -278,8 +266,7 @@ static int __drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *
> if (name) {
> crtc->name = kvasprintf(GFP_KERNEL, name, ap);
> } else {
> - crtc->name = kasprintf(GFP_KERNEL, "crtc-%d",
> - drm_num_crtcs(dev));
> + crtc->name = kasprintf(GFP_KERNEL, "crtc-%d", config->num_crtc);
> }
> if (!crtc->name) {
> drm_mode_object_unregister(dev, &crtc->base);
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm: Remove drm_num_crtcs() helper
2024-02-27 11:20 [PATCH] drm: Remove drm_num_crtcs() helper Thierry Reding
2024-02-27 11:33 ` Jani Nikula
@ 2024-02-27 11:40 ` Javier Martinez Canillas
1 sibling, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2024-02-27 11:40 UTC (permalink / raw)
To: Thierry Reding, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann
Cc: David Airlie, Daniel Vetter, dri-devel
Thierry Reding <thierry.reding@gmail.com> writes:
Hello Thierry,
> From: Thierry Reding <treding@nvidia.com>
>
> The drm_num_crtcs() helper determines the number of CRTCs by iterating
> over the list of CRTCs that have been registered with the mode config.
> However, we already keep track of that number in the mode config's
> num_crtcs field, so we can simply retrieve the value from that and
> remove the extra helper function.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/gpu/drm/drm_crtc.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
Indeed. I don't see why this helper would be needed.
Your patch makes sense to me.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-27 11:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 11:20 [PATCH] drm: Remove drm_num_crtcs() helper Thierry Reding
2024-02-27 11:33 ` Jani Nikula
2024-02-27 11:40 ` Javier Martinez Canillas
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.