linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp()
@ 2024-08-16 13:57 Krzysztof Kozlowski
  2024-08-16 13:57 ` [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths Krzysztof Kozlowski
  2024-08-27 13:57 ` [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp() Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-16 13:57 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Timo Alho, linux-tegra,
	linux-kernel
  Cc: Krzysztof Kozlowski, stable

mbox_client_to_bpmp() is not used, W=1 builds:

  drivers/firmware/tegra/bpmp.c:28:1: error: unused function 'mbox_client_to_bpmp' [-Werror,-Wunused-function]

Fixes: cdfa358b248e ("firmware: tegra: Refactor BPMP driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/firmware/tegra/bpmp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
index c1590d3aa9cb..c3a1dc344961 100644
--- a/drivers/firmware/tegra/bpmp.c
+++ b/drivers/firmware/tegra/bpmp.c
@@ -24,12 +24,6 @@
 #define MSG_RING	BIT(1)
 #define TAG_SZ		32
 
-static inline struct tegra_bpmp *
-mbox_client_to_bpmp(struct mbox_client *client)
-{
-	return container_of(client, struct tegra_bpmp, mbox.client);
-}
-
 static inline const struct tegra_bpmp_ops *
 channel_to_ops(struct tegra_bpmp_channel *channel)
 {
-- 
2.43.0


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

* [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths
  2024-08-16 13:57 [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp() Krzysztof Kozlowski
@ 2024-08-16 13:57 ` Krzysztof Kozlowski
  2024-10-01 20:34   ` Krzysztof Kozlowski
  2024-08-27 13:57 ` [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp() Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-16 13:57 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Timo Alho, linux-tegra,
	linux-kernel
  Cc: Krzysztof Kozlowski

Obtain the device node reference with scoped/cleanup.h to reduce error
handling and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/firmware/tegra/bpmp.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
index c3a1dc344961..2edc3838538e 100644
--- a/drivers/firmware/tegra/bpmp.c
+++ b/drivers/firmware/tegra/bpmp.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2016, NVIDIA CORPORATION.  All rights reserved.
  */
 
+#include <linux/cleanup.h>
 #include <linux/clk/tegra.h>
 #include <linux/genalloc.h>
 #include <linux/mailbox_client.h>
@@ -36,27 +37,22 @@ struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
 {
 	struct platform_device *pdev;
 	struct tegra_bpmp *bpmp;
-	struct device_node *np;
 
-	np = of_parse_phandle(dev->of_node, "nvidia,bpmp", 0);
+	struct device_node *np __free(device_node) = of_parse_phandle(dev->of_node,
+								      "nvidia,bpmp", 0);
 	if (!np)
 		return ERR_PTR(-ENOENT);
 
 	pdev = of_find_device_by_node(np);
-	if (!pdev) {
-		bpmp = ERR_PTR(-ENODEV);
-		goto put;
-	}
+	if (!pdev)
+		return ERR_PTR(-ENODEV);
 
 	bpmp = platform_get_drvdata(pdev);
 	if (!bpmp) {
-		bpmp = ERR_PTR(-EPROBE_DEFER);
 		put_device(&pdev->dev);
-		goto put;
+		return ERR_PTR(-EPROBE_DEFER);
 	}
 
-put:
-	of_node_put(np);
 	return bpmp;
 }
 EXPORT_SYMBOL_GPL(tegra_bpmp_get);
-- 
2.43.0


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

* Re: [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp()
  2024-08-16 13:57 [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp() Krzysztof Kozlowski
  2024-08-16 13:57 ` [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths Krzysztof Kozlowski
@ 2024-08-27 13:57 ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2024-08-27 13:57 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Timo Alho, linux-tegra,
	linux-kernel, Krzysztof Kozlowski
  Cc: stable

From: Thierry Reding <treding@nvidia.com>


On Fri, 16 Aug 2024 15:57:21 +0200, Krzysztof Kozlowski wrote:
> mbox_client_to_bpmp() is not used, W=1 builds:
> 
>   drivers/firmware/tegra/bpmp.c:28:1: error: unused function 'mbox_client_to_bpmp' [-Werror,-Wunused-function]
> 
> 

Applied, thanks!

[1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp()
      commit: 6aa3ed11978d55f6d0377fdc58f1ef19dbd03af7
[2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths
      commit: d281ecc22a0da7f2f067f61f563c3475d9d90059

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths
  2024-08-16 13:57 ` [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths Krzysztof Kozlowski
@ 2024-10-01 20:34   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-01 20:34 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Timo Alho, linux-tegra,
	linux-kernel

On 16/08/2024 15:57, Krzysztof Kozlowski wrote:
> Obtain the device node reference with scoped/cleanup.h to reduce error
> handling and make the code a bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/firmware/tegra/bpmp.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
> index c3a1dc344961..2edc3838538e 100644
> --- a/drivers/firmware/tegra/bpmp.c
> +++ b/drivers/firmware/tegra/bpmp.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2016, NVIDIA CORPORATION.  All rights reserved.
>   */
>  
> +#include <linux/cleanup.h>
>  #include <linux/clk/tegra.h>
>  #include <linux/genalloc.h>
>  #include <linux/mailbox_client.h>
> @@ -36,27 +37,22 @@ struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
>  {
>  	struct platform_device *pdev;
>  	struct tegra_bpmp *bpmp;
> -	struct device_node *np;
>  
> -	np = of_parse_phandle(dev->of_node, "nvidia,bpmp", 0);
> +	struct device_node *np __free(device_node) = of_parse_phandle(dev->of_node,
> +								      "nvidia,bpmp", 0);

Uhhh, this is very strange.

Above is correct code which I sent.

But look what was applied:

 struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
 {
+       struct device_node *np __free(device_node);

That's very different.

See commit 8812b8689ee6 ("firmware: tegra: bpmp: Use scoped device node
handling to simplify error paths").

Commit msg does not explain at all why my code was changed. It is not
only a courtesy but also requirement to mark changes done to commits
when applying.

Shall I assume more of my patches were silently changed when applied,
including adding questionable code there?


Best regards,
Krzysztof


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

end of thread, other threads:[~2024-10-01 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 13:57 [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp() Krzysztof Kozlowski
2024-08-16 13:57 ` [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths Krzysztof Kozlowski
2024-10-01 20:34   ` Krzysztof Kozlowski
2024-08-27 13:57 ` [PATCH 1/2] firmware: tegra: bpmp: drop unused mbox_client_to_bpmp() Thierry Reding

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).