diff mbox series

[7/8] drm/msm/dpu: drop dpu_core_perf_destroy()

Message ID 20230620000846.946925-8-dmitry.baryshkov@linaro.org
State New
Headers show
Series [1/8] drm/msm/dpu: drop enum dpu_core_perf_data_bus_id | expand

Commit Message

Dmitry Baryshkov June 20, 2023, 12:08 a.m. UTC
This function does nothing, just clears several data pointers. Drop it
now.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 ------------
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  6 ------
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  1 -
 3 files changed, 19 deletions(-)

Comments

Abhinav Kumar July 3, 2023, 10:57 p.m. UTC | #1
On 6/19/2023 5:08 PM, Dmitry Baryshkov wrote:
> This function does nothing, just clears several data pointers. Drop it
> now.
> 

This will undo what dpu_core_perf_init() did when an error happens.

Why can we drop that?

> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 ------------
>   drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  6 ------
>   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  1 -
>   3 files changed, 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> index 78a7e3ea27a4..f779ad544347 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> @@ -394,18 +394,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent)
>   }
>   #endif
>   
> -void dpu_core_perf_destroy(struct dpu_core_perf *perf)
> -{
> -	if (!perf) {
> -		DPU_ERROR("invalid parameters\n");
> -		return;
> -	}
> -
> -	perf->max_core_clk_rate = 0;
> -	perf->core_clk = NULL;
> -	perf->dev = NULL;
> -}
> -
>   int dpu_core_perf_init(struct dpu_core_perf *perf,
>   		struct drm_device *dev,
>   		const struct dpu_perf_cfg *perf_cfg,
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> index e8a7916b6f71..e1198c104b5e 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> @@ -69,12 +69,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
>    */
>   void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc);
>   
> -/**
> - * dpu_core_perf_destroy - destroy the given core performance context
> - * @perf: Pointer to core performance context
> - */
> -void dpu_core_perf_destroy(struct dpu_core_perf *perf);
> -
>   /**
>    * dpu_core_perf_init - initialize the given core performance context
>    * @perf: Pointer to core performance context
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 6e62606e32de..4439147d2c35 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -1162,7 +1162,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>   	return 0;
>   
>   drm_obj_init_err:
> -	dpu_core_perf_destroy(&dpu_kms->perf);
>   hw_intr_init_err:
>   perf_err:
>   power_error:
Dmitry Baryshkov July 3, 2023, 10:59 p.m. UTC | #2
On Tue, 4 Jul 2023 at 01:57, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
>
>
> On 6/19/2023 5:08 PM, Dmitry Baryshkov wrote:
> > This function does nothing, just clears several data pointers. Drop it
> > now.
> >
>
> This will undo what dpu_core_perf_init() did when an error happens.
>
> Why can we drop that?

Because nothing will use this data in an error case. There is no need
to clean it.

>
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 ------------
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  6 ------
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  1 -
> >   3 files changed, 19 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> > index 78a7e3ea27a4..f779ad544347 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> > @@ -394,18 +394,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent)
> >   }
> >   #endif
> >
> > -void dpu_core_perf_destroy(struct dpu_core_perf *perf)
> > -{
> > -     if (!perf) {
> > -             DPU_ERROR("invalid parameters\n");
> > -             return;
> > -     }
> > -
> > -     perf->max_core_clk_rate = 0;
> > -     perf->core_clk = NULL;
> > -     perf->dev = NULL;
> > -}
> > -
> >   int dpu_core_perf_init(struct dpu_core_perf *perf,
> >               struct drm_device *dev,
> >               const struct dpu_perf_cfg *perf_cfg,
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> > index e8a7916b6f71..e1198c104b5e 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> > @@ -69,12 +69,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
> >    */
> >   void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc);
> >
> > -/**
> > - * dpu_core_perf_destroy - destroy the given core performance context
> > - * @perf: Pointer to core performance context
> > - */
> > -void dpu_core_perf_destroy(struct dpu_core_perf *perf);
> > -
> >   /**
> >    * dpu_core_perf_init - initialize the given core performance context
> >    * @perf: Pointer to core performance context
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > index 6e62606e32de..4439147d2c35 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > @@ -1162,7 +1162,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> >       return 0;
> >
> >   drm_obj_init_err:
> > -     dpu_core_perf_destroy(&dpu_kms->perf);
> >   hw_intr_init_err:
> >   perf_err:
> >   power_error:
Abhinav Kumar July 4, 2023, 12:19 a.m. UTC | #3
On 7/3/2023 3:59 PM, Dmitry Baryshkov wrote:
> On Tue, 4 Jul 2023 at 01:57, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>>
>>
>>
>> On 6/19/2023 5:08 PM, Dmitry Baryshkov wrote:
>>> This function does nothing, just clears several data pointers. Drop it
>>> now.
>>>
>>
>> This will undo what dpu_core_perf_init() did when an error happens.
>>
>> Why can we drop that?
> 
> Because nothing will use this data in an error case. There is no need
> to clean it.
> 

Usage is one thing for sure but I am still inclined to keep it symmetric 
with dpu_core_perf_init().

>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>>    drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 ------------
>>>    drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  6 ------
>>>    drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  1 -
>>>    3 files changed, 19 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
>>> index 78a7e3ea27a4..f779ad544347 100644
>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
>>> @@ -394,18 +394,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent)
>>>    }
>>>    #endif
>>>
>>> -void dpu_core_perf_destroy(struct dpu_core_perf *perf)
>>> -{
>>> -     if (!perf) {
>>> -             DPU_ERROR("invalid parameters\n");
>>> -             return;
>>> -     }
>>> -
>>> -     perf->max_core_clk_rate = 0;
>>> -     perf->core_clk = NULL;
>>> -     perf->dev = NULL;
>>> -}
>>> -
>>>    int dpu_core_perf_init(struct dpu_core_perf *perf,
>>>                struct drm_device *dev,
>>>                const struct dpu_perf_cfg *perf_cfg,
>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
>>> index e8a7916b6f71..e1198c104b5e 100644
>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
>>> @@ -69,12 +69,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
>>>     */
>>>    void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc);
>>>
>>> -/**
>>> - * dpu_core_perf_destroy - destroy the given core performance context
>>> - * @perf: Pointer to core performance context
>>> - */
>>> -void dpu_core_perf_destroy(struct dpu_core_perf *perf);
>>> -
>>>    /**
>>>     * dpu_core_perf_init - initialize the given core performance context
>>>     * @perf: Pointer to core performance context
>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>>> index 6e62606e32de..4439147d2c35 100644
>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>>> @@ -1162,7 +1162,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>>>        return 0;
>>>
>>>    drm_obj_init_err:
>>> -     dpu_core_perf_destroy(&dpu_kms->perf);
>>>    hw_intr_init_err:
>>>    perf_err:
>>>    power_error:
> 
> 
>
Dmitry Baryshkov July 4, 2023, 2:31 p.m. UTC | #4
On Tue, 4 Jul 2023 at 03:19, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
>
>
> On 7/3/2023 3:59 PM, Dmitry Baryshkov wrote:
> > On Tue, 4 Jul 2023 at 01:57, Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
> >>
> >>
> >>
> >> On 6/19/2023 5:08 PM, Dmitry Baryshkov wrote:
> >>> This function does nothing, just clears several data pointers. Drop it
> >>> now.
> >>>
> >>
> >> This will undo what dpu_core_perf_init() did when an error happens.
> >>
> >> Why can we drop that?
> >
> > Because nothing will use this data in an error case. There is no need
> > to clean it.
> >
>
> Usage is one thing for sure but I am still inclined to keep it symmetric
> with dpu_core_perf_init().

Through the last several years the kernel was more and more inclined
to asymmetry here. For example, consider all the demv_ functions. We
have been removing cleanup and _remove functions all over the place.
So, I think, I will reiterate this patch.

>
> >>
> >>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >>> ---
> >>>    drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 ------------
> >>>    drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  6 ------
> >>>    drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  1 -
> >>>    3 files changed, 19 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> >>> index 78a7e3ea27a4..f779ad544347 100644
> >>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> >>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> >>> @@ -394,18 +394,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent)
> >>>    }
> >>>    #endif
> >>>
> >>> -void dpu_core_perf_destroy(struct dpu_core_perf *perf)
> >>> -{
> >>> -     if (!perf) {
> >>> -             DPU_ERROR("invalid parameters\n");
> >>> -             return;
> >>> -     }
> >>> -
> >>> -     perf->max_core_clk_rate = 0;
> >>> -     perf->core_clk = NULL;
> >>> -     perf->dev = NULL;
> >>> -}
> >>> -
> >>>    int dpu_core_perf_init(struct dpu_core_perf *perf,
> >>>                struct drm_device *dev,
> >>>                const struct dpu_perf_cfg *perf_cfg,
> >>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> >>> index e8a7916b6f71..e1198c104b5e 100644
> >>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> >>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
> >>> @@ -69,12 +69,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
> >>>     */
> >>>    void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc);
> >>>
> >>> -/**
> >>> - * dpu_core_perf_destroy - destroy the given core performance context
> >>> - * @perf: Pointer to core performance context
> >>> - */
> >>> -void dpu_core_perf_destroy(struct dpu_core_perf *perf);
> >>> -
> >>>    /**
> >>>     * dpu_core_perf_init - initialize the given core performance context
> >>>     * @perf: Pointer to core performance context
> >>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> >>> index 6e62606e32de..4439147d2c35 100644
> >>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> >>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> >>> @@ -1162,7 +1162,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> >>>        return 0;
> >>>
> >>>    drm_obj_init_err:
> >>> -     dpu_core_perf_destroy(&dpu_kms->perf);
> >>>    hw_intr_init_err:
> >>>    perf_err:
> >>>    power_error:
> >
> >
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
index 78a7e3ea27a4..f779ad544347 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
@@ -394,18 +394,6 @@  int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent)
 }
 #endif
 
-void dpu_core_perf_destroy(struct dpu_core_perf *perf)
-{
-	if (!perf) {
-		DPU_ERROR("invalid parameters\n");
-		return;
-	}
-
-	perf->max_core_clk_rate = 0;
-	perf->core_clk = NULL;
-	perf->dev = NULL;
-}
-
 int dpu_core_perf_init(struct dpu_core_perf *perf,
 		struct drm_device *dev,
 		const struct dpu_perf_cfg *perf_cfg,
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
index e8a7916b6f71..e1198c104b5e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
@@ -69,12 +69,6 @@  int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
  */
 void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc);
 
-/**
- * dpu_core_perf_destroy - destroy the given core performance context
- * @perf: Pointer to core performance context
- */
-void dpu_core_perf_destroy(struct dpu_core_perf *perf);
-
 /**
  * dpu_core_perf_init - initialize the given core performance context
  * @perf: Pointer to core performance context
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 6e62606e32de..4439147d2c35 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1162,7 +1162,6 @@  static int dpu_kms_hw_init(struct msm_kms *kms)
 	return 0;
 
 drm_obj_init_err:
-	dpu_core_perf_destroy(&dpu_kms->perf);
 hw_intr_init_err:
 perf_err:
 power_error: