public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier
@ 2024-10-28  2:13 linux
  2024-11-28 16:11 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: linux @ 2024-10-28  2:13 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, cw00.choi
  Cc: linux-pm, linux-doc, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

devm_devfreq_register_notifier() and devm_devfreq_unregister_notifier()
have been unused since 2019's
commit 0ef7c7cce43f ("PM / devfreq: passive: Use non-devm notifiers")

Remove them, and the helpers they used.

Note, devm_devfreq_register_notifier() is still used as an example
in Documentation/doc-guide/contributing.rst but that's just
an example of an old doc bug rather than anything about the function
itself.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/devfreq/devfreq.c | 67 ---------------------------------------
 include/linux/devfreq.h   | 23 --------------
 2 files changed, 90 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 98657d3b9435..6c3b241b4458 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -2224,70 +2224,3 @@ int devfreq_unregister_notifier(struct devfreq *devfreq,
 	return ret;
 }
 EXPORT_SYMBOL(devfreq_unregister_notifier);
-
-struct devfreq_notifier_devres {
-	struct devfreq *devfreq;
-	struct notifier_block *nb;
-	unsigned int list;
-};
-
-static void devm_devfreq_notifier_release(struct device *dev, void *res)
-{
-	struct devfreq_notifier_devres *this = res;
-
-	devfreq_unregister_notifier(this->devfreq, this->nb, this->list);
-}
-
-/**
- * devm_devfreq_register_notifier()
- *	- Resource-managed devfreq_register_notifier()
- * @dev:	The devfreq user device. (parent of devfreq)
- * @devfreq:	The devfreq object.
- * @nb:		The notifier block to be unregistered.
- * @list:	DEVFREQ_TRANSITION_NOTIFIER.
- */
-int devm_devfreq_register_notifier(struct device *dev,
-				struct devfreq *devfreq,
-				struct notifier_block *nb,
-				unsigned int list)
-{
-	struct devfreq_notifier_devres *ptr;
-	int ret;
-
-	ptr = devres_alloc(devm_devfreq_notifier_release, sizeof(*ptr),
-				GFP_KERNEL);
-	if (!ptr)
-		return -ENOMEM;
-
-	ret = devfreq_register_notifier(devfreq, nb, list);
-	if (ret) {
-		devres_free(ptr);
-		return ret;
-	}
-
-	ptr->devfreq = devfreq;
-	ptr->nb = nb;
-	ptr->list = list;
-	devres_add(dev, ptr);
-
-	return 0;
-}
-EXPORT_SYMBOL(devm_devfreq_register_notifier);
-
-/**
- * devm_devfreq_unregister_notifier()
- *	- Resource-managed devfreq_unregister_notifier()
- * @dev:	The devfreq user device. (parent of devfreq)
- * @devfreq:	The devfreq object.
- * @nb:		The notifier block to be unregistered.
- * @list:	DEVFREQ_TRANSITION_NOTIFIER.
- */
-void devm_devfreq_unregister_notifier(struct device *dev,
-				      struct devfreq *devfreq,
-				      struct notifier_block *nb,
-				      unsigned int list)
-{
-	WARN_ON(devres_release(dev, devm_devfreq_notifier_release,
-			       devm_devfreq_dev_match, devfreq));
-}
-EXPORT_SYMBOL(devm_devfreq_unregister_notifier);
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index d312ffbac4dd..ea161657ebc6 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -263,14 +263,6 @@ int devfreq_register_notifier(struct devfreq *devfreq,
 int devfreq_unregister_notifier(struct devfreq *devfreq,
 				struct notifier_block *nb,
 				unsigned int list);
-int devm_devfreq_register_notifier(struct device *dev,
-				struct devfreq *devfreq,
-				struct notifier_block *nb,
-				unsigned int list);
-void devm_devfreq_unregister_notifier(struct device *dev,
-				struct devfreq *devfreq,
-				struct notifier_block *nb,
-				unsigned int list);
 struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
 struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
 				const char *phandle_name, int index);
@@ -420,21 +412,6 @@ static inline int devfreq_unregister_notifier(struct devfreq *devfreq,
 	return 0;
 }
 
-static inline int devm_devfreq_register_notifier(struct device *dev,
-					struct devfreq *devfreq,
-					struct notifier_block *nb,
-					unsigned int list)
-{
-	return 0;
-}
-
-static inline void devm_devfreq_unregister_notifier(struct device *dev,
-					struct devfreq *devfreq,
-					struct notifier_block *nb,
-					unsigned int list)
-{
-}
-
 static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
 {
 	return ERR_PTR(-ENODEV);
-- 
2.47.0


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

* Re: [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier
  2024-10-28  2:13 [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier linux
@ 2024-11-28 16:11 ` Dr. David Alan Gilbert
  2024-12-07  5:22   ` MyungJoo Ham
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2024-11-28 16:11 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, linux-doc, linux-kernel

* linux@treblig.org (linux@treblig.org) wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> devm_devfreq_register_notifier() and devm_devfreq_unregister_notifier()
> have been unused since 2019's
> commit 0ef7c7cce43f ("PM / devfreq: passive: Use non-devm notifiers")
> 
> Remove them, and the helpers they used.
> 
> Note, devm_devfreq_register_notifier() is still used as an example
> in Documentation/doc-guide/contributing.rst but that's just
> an example of an old doc bug rather than anything about the function
> itself.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Ping.

Thanks,

Dave
> ---
>  drivers/devfreq/devfreq.c | 67 ---------------------------------------
>  include/linux/devfreq.h   | 23 --------------
>  2 files changed, 90 deletions(-)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 98657d3b9435..6c3b241b4458 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -2224,70 +2224,3 @@ int devfreq_unregister_notifier(struct devfreq *devfreq,
>  	return ret;
>  }
>  EXPORT_SYMBOL(devfreq_unregister_notifier);
> -
> -struct devfreq_notifier_devres {
> -	struct devfreq *devfreq;
> -	struct notifier_block *nb;
> -	unsigned int list;
> -};
> -
> -static void devm_devfreq_notifier_release(struct device *dev, void *res)
> -{
> -	struct devfreq_notifier_devres *this = res;
> -
> -	devfreq_unregister_notifier(this->devfreq, this->nb, this->list);
> -}
> -
> -/**
> - * devm_devfreq_register_notifier()
> - *	- Resource-managed devfreq_register_notifier()
> - * @dev:	The devfreq user device. (parent of devfreq)
> - * @devfreq:	The devfreq object.
> - * @nb:		The notifier block to be unregistered.
> - * @list:	DEVFREQ_TRANSITION_NOTIFIER.
> - */
> -int devm_devfreq_register_notifier(struct device *dev,
> -				struct devfreq *devfreq,
> -				struct notifier_block *nb,
> -				unsigned int list)
> -{
> -	struct devfreq_notifier_devres *ptr;
> -	int ret;
> -
> -	ptr = devres_alloc(devm_devfreq_notifier_release, sizeof(*ptr),
> -				GFP_KERNEL);
> -	if (!ptr)
> -		return -ENOMEM;
> -
> -	ret = devfreq_register_notifier(devfreq, nb, list);
> -	if (ret) {
> -		devres_free(ptr);
> -		return ret;
> -	}
> -
> -	ptr->devfreq = devfreq;
> -	ptr->nb = nb;
> -	ptr->list = list;
> -	devres_add(dev, ptr);
> -
> -	return 0;
> -}
> -EXPORT_SYMBOL(devm_devfreq_register_notifier);
> -
> -/**
> - * devm_devfreq_unregister_notifier()
> - *	- Resource-managed devfreq_unregister_notifier()
> - * @dev:	The devfreq user device. (parent of devfreq)
> - * @devfreq:	The devfreq object.
> - * @nb:		The notifier block to be unregistered.
> - * @list:	DEVFREQ_TRANSITION_NOTIFIER.
> - */
> -void devm_devfreq_unregister_notifier(struct device *dev,
> -				      struct devfreq *devfreq,
> -				      struct notifier_block *nb,
> -				      unsigned int list)
> -{
> -	WARN_ON(devres_release(dev, devm_devfreq_notifier_release,
> -			       devm_devfreq_dev_match, devfreq));
> -}
> -EXPORT_SYMBOL(devm_devfreq_unregister_notifier);
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index d312ffbac4dd..ea161657ebc6 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -263,14 +263,6 @@ int devfreq_register_notifier(struct devfreq *devfreq,
>  int devfreq_unregister_notifier(struct devfreq *devfreq,
>  				struct notifier_block *nb,
>  				unsigned int list);
> -int devm_devfreq_register_notifier(struct device *dev,
> -				struct devfreq *devfreq,
> -				struct notifier_block *nb,
> -				unsigned int list);
> -void devm_devfreq_unregister_notifier(struct device *dev,
> -				struct devfreq *devfreq,
> -				struct notifier_block *nb,
> -				unsigned int list);
>  struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
>  struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
>  				const char *phandle_name, int index);
> @@ -420,21 +412,6 @@ static inline int devfreq_unregister_notifier(struct devfreq *devfreq,
>  	return 0;
>  }
>  
> -static inline int devm_devfreq_register_notifier(struct device *dev,
> -					struct devfreq *devfreq,
> -					struct notifier_block *nb,
> -					unsigned int list)
> -{
> -	return 0;
> -}
> -
> -static inline void devm_devfreq_unregister_notifier(struct device *dev,
> -					struct devfreq *devfreq,
> -					struct notifier_block *nb,
> -					unsigned int list)
> -{
> -}
> -
>  static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
>  {
>  	return ERR_PTR(-ENODEV);
> -- 
> 2.47.0
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

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

* RE: Re: [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier
  2024-11-28 16:11 ` Dr. David Alan Gilbert
@ 2024-12-07  5:22   ` MyungJoo Ham
  2024-12-07 12:47     ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: MyungJoo Ham @ 2024-12-07  5:22 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Kyungmin Park, Chanwoo Choi, linux-pm@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org

>* linux@treblig.org (linux@treblig.org) wrote:
>> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>> 
>> devm_devfreq_register_notifier() and devm_devfreq_unregister_notifier()
>> have been unused since 2019's
>> commit 0ef7c7cce43f ("PM / devfreq: passive: Use non-devm notifiers")
>> 
>> Remove them, and the helpers they used.
>> 
>> Note, devm_devfreq_register_notifier() is still used as an example
>> in Documentation/doc-guide/contributing.rst but that's just
>> an example of an old doc bug rather than anything about the function
>> itself.
>> 
>> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
>
>Ping.
>
>Thanks,
>
>Dave

When I search github, it appears that vendors are using this API.


NVIDIA:
https://github.com/NX-Development/android_kernel_nvidia_nvidia/blob/c9ade3b5e32a12b8cf6f33a632dc39209194e4e8/drivers/devfreq/governor_wmark_active.c#L624

Samsung:
https://github.com/Vaz15k/android_kernel_samsung_a54x/blob/8ac517c37c606746213064857dc240e99eba80d2/drivers/soc/samsung/exynos-llcgov.c#L107

Realtek:
https://github.com/BPI-SINOVOIP/BPI-M4-bsp/blob/25f5b88ec4ba34029f964693dc34028b26e6c67c/linux-rtk/drivers/devfreq/realtek/governor_rtk_ltl.c#L114



Please don't remove ABIs used by vendors even if
they didn't upstream their drivers.

Cheers,
MyungJoo.

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

* Re: [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier
  2024-12-07  5:22   ` MyungJoo Ham
@ 2024-12-07 12:47     ` Dr. David Alan Gilbert
  2024-12-08 12:52       ` Chanwoo Choi
  2024-12-09  5:50       ` MyungJoo Ham
  0 siblings, 2 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2024-12-07 12:47 UTC (permalink / raw)
  To: MyungJoo Ham
  Cc: Kyungmin Park, Chanwoo Choi, linux-pm@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org

* MyungJoo Ham (myungjoo.ham@samsung.com) wrote:
> >* linux@treblig.org (linux@treblig.org) wrote:
> >> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> >> 
> >> devm_devfreq_register_notifier() and devm_devfreq_unregister_notifier()
> >> have been unused since 2019's
> >> commit 0ef7c7cce43f ("PM / devfreq: passive: Use non-devm notifiers")
> >> 
> >> Remove them, and the helpers they used.
> >> 
> >> Note, devm_devfreq_register_notifier() is still used as an example
> >> in Documentation/doc-guide/contributing.rst but that's just
> >> an example of an old doc bug rather than anything about the function
> >> itself.
> >> 
> >> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> >
> >Ping.
> >
> >Thanks,
> >
> >Dave
> 
> When I search github, it appears that vendors are using this API.

Hmm OK.
Of course there's a lot of random junk on github, so it can be tricky
to know what's current/real/relevant.

> NVIDIA:
> https://github.com/NX-Development/android_kernel_nvidia_nvidia/blob/c9ade3b5e32a12b8cf6f33a632dc39209194e4e8/drivers/devfreq/governor_wmark_active.c#L624
> 
> Samsung:
> https://github.com/Vaz15k/android_kernel_samsung_a54x/blob/8ac517c37c606746213064857dc240e99eba80d2/drivers/soc/samsung/exynos-llcgov.c#L107
> 
> Realtek:
> https://github.com/BPI-SINOVOIP/BPI-M4-bsp/blob/25f5b88ec4ba34029f964693dc34028b26e6c67c/linux-rtk/drivers/devfreq/realtek/governor_rtk_ltl.c#L114
> 
> 
> 
> Please don't remove ABIs used by vendors even if
> they didn't upstream their drivers.

Hmm OK.
Do you think they should be using this ABI or do they have the same bug as 
is fixed in 0ef7c7cce43f ?
I guess they don't care.

Dave

> Cheers,
> MyungJoo.
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

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

* Re: [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier
  2024-12-07 12:47     ` Dr. David Alan Gilbert
@ 2024-12-08 12:52       ` Chanwoo Choi
  2024-12-09  5:50       ` MyungJoo Ham
  1 sibling, 0 replies; 6+ messages in thread
From: Chanwoo Choi @ 2024-12-08 12:52 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi,
	linux-pm@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Sat, Dec 7, 2024 at 9:47 PM Dr. David Alan Gilbert <linux@treblig.org> wrote:
>
> * MyungJoo Ham (myungjoo.ham@samsung.com) wrote:
> > >* linux@treblig.org (linux@treblig.org) wrote:
> > >> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > >>
> > >> devm_devfreq_register_notifier() and devm_devfreq_unregister_notifier()
> > >> have been unused since 2019's
> > >> commit 0ef7c7cce43f ("PM / devfreq: passive: Use non-devm notifiers")
> > >>
> > >> Remove them, and the helpers they used.
> > >>
> > >> Note, devm_devfreq_register_notifier() is still used as an example
> > >> in Documentation/doc-guide/contributing.rst but that's just
> > >> an example of an old doc bug rather than anything about the function
> > >> itself.
> > >>
> > >> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> > >
> > >Ping.
> > >
> > >Thanks,
> > >
> > >Dave
> >
> > When I search github, it appears that vendors are using this API.
>
> Hmm OK.
> Of course there's a lot of random junk on github, so it can be tricky
> to know what's current/real/relevant.
>
> > NVIDIA:
> > https://github.com/NX-Development/android_kernel_nvidia_nvidia/blob/c9ade3b5e32a12b8cf6f33a632dc39209194e4e8/drivers/devfreq/governor_wmark_active.c#L624
> >
> > Samsung:
> > https://github.com/Vaz15k/android_kernel_samsung_a54x/blob/8ac517c37c606746213064857dc240e99eba80d2/drivers/soc/samsung/exynos-llcgov.c#L107
> >
> > Realtek:
> > https://github.com/BPI-SINOVOIP/BPI-M4-bsp/blob/25f5b88ec4ba34029f964693dc34028b26e6c67c/linux-rtk/drivers/devfreq/realtek/governor_rtk_ltl.c#L114
> >
> >
> >
> > Please don't remove ABIs used by vendors even if
> > they didn't upstream their drivers.
>
> Hmm OK.
> Do you think they should be using this ABI or do they have the same bug as
> is fixed in 0ef7c7cce43f ?
> I guess they don't care.


According to Myungjoo's comment, I'll keep this code.


Thanks,


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

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

* RE: Re: [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier
  2024-12-07 12:47     ` Dr. David Alan Gilbert
  2024-12-08 12:52       ` Chanwoo Choi
@ 2024-12-09  5:50       ` MyungJoo Ham
  1 sibling, 0 replies; 6+ messages in thread
From: MyungJoo Ham @ 2024-12-09  5:50 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Kyungmin Park, Chanwoo Choi, linux-pm@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org

From: "Dr. David Alan Gilbert" <linux@treblig.org>
>* MyungJoo Ham (myungjoo.ham@samsung.com) wrote:
>> >* linux@treblig.org (linux@treblig.org) wrote:
>> >> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>> >> 
>> >> devm_devfreq_register_notifier() and devm_devfreq_unregister_notifier()
>> >> have been unused since 2019's
>> >> commit 0ef7c7cce43f ("PM / devfreq: passive: Use non-devm notifiers")
>> >> 
>> >> Remove them, and the helpers they used.
>> >> 
>> >> Note, devm_devfreq_register_notifier() is still used as an example
>> >> in Documentation/doc-guide/contributing.rst but that's just
>> >> an example of an old doc bug rather than anything about the function
>> >> itself.
>> >> 
>> >> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
>> >
>> >Ping.
>> >
>> >Thanks,
>> >
>> >Dave
>> 
>> When I search github, it appears that vendors are using this API.
>
>Hmm OK.
>Of course there's a lot of random junk on github, so it can be tricky
>to know what's current/real/relevant.
>
>> NVIDIA:
>> Samsung:
>> Realtek:
>> 
>> Please don't remove ABIs used by vendors even if
>> they didn't upstream their drivers.
>
>Hmm OK.
>Do you think they should be using this ABI or do they have the same bug as 
>is fixed in 0ef7c7cce43f ?
>I guess they don't care.
>
>Dave

They will suffer from the same bugs mentioned in 0ef7x7cce43f.
Anyway, they probably don't care if they build these
code as built-in for their product binries.

Vendors of embedded devices, including mobile phones, usually
do not care upstreaming their device drivers, and we have too many
Linux embedded device vendors.
Even in my affiliation, we have too many different instances of
Linux kernel source repositories and binaries built
simultaneously, and I do not know how they are using the
given devfreq APIs.

Cheers,
MyungJoo

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

end of thread, other threads:[~2024-12-09  5:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28  2:13 [PATCH] PM / devfreq: Remove unused devm_devfreq_(un)register_notifier linux
2024-11-28 16:11 ` Dr. David Alan Gilbert
2024-12-07  5:22   ` MyungJoo Ham
2024-12-07 12:47     ` Dr. David Alan Gilbert
2024-12-08 12:52       ` Chanwoo Choi
2024-12-09  5:50       ` MyungJoo Ham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox