mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] wifi: cfg80211: simplify the code
@ 2025-08-25  5:51 tanzheng
  2025-08-25 18:50 ` Arend van Spriel
  0 siblings, 1 reply; 3+ messages in thread
From: tanzheng @ 2025-08-25  5:51 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, linux-kernel, tanzheng

Simplifying the code makes it more readable:
1.Use dev_name instead of pdev->driver->name.
2.There is no need to call wiphy_dev again.

Signed-off-by: Zheng tan <tanzheng@kylinos.cn>
---
 net/wireless/ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
index 2613d6ac0fda..0acfdc44b479 100644
--- a/net/wireless/ethtool.c
+++ b/net/wireless/ethtool.c
@@ -10,7 +10,7 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 	struct device *pdev = wiphy_dev(wdev->wiphy);
 
 	if (pdev->driver)
-		strscpy(info->driver, pdev->driver->name,
+		strscpy(info->driver, dev_name(pdev),
 			sizeof(info->driver));
 	else
 		strscpy(info->driver, "N/A", sizeof(info->driver));
@@ -23,7 +23,7 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 	else
 		strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
 
-	strscpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
+	strscpy(info->bus_info, dev_name(pdev),
 		sizeof(info->bus_info));
 }
 EXPORT_SYMBOL(cfg80211_get_drvinfo);
-- 
2.25.1


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

* Re: [PATCH v1] wifi: cfg80211: simplify the code
  2025-08-25  5:51 [PATCH v1] wifi: cfg80211: simplify the code tanzheng
@ 2025-08-25 18:50 ` Arend van Spriel
  2025-08-26  3:16   ` tanzheng
  0 siblings, 1 reply; 3+ messages in thread
From: Arend van Spriel @ 2025-08-25 18:50 UTC (permalink / raw)
  To: tanzheng, johannes; +Cc: linux-wireless, linux-kernel

On 8/25/2025 7:51 AM, tanzheng wrote:
> Simplifying the code makes it more readable:
> 1.Use dev_name instead of pdev->driver->name.
> 2.There is no need to call wiphy_dev again.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>

> Signed-off-by: Zheng tan <tanzheng@kylinos.cn>
> ---
>   net/wireless/ethtool.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
> index 2613d6ac0fda..0acfdc44b479 100644
> --- a/net/wireless/ethtool.c
> +++ b/net/wireless/ethtool.c
> @@ -10,7 +10,7 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
>   	struct device *pdev = wiphy_dev(wdev->wiphy);
>   
>   	if (pdev->driver)
> -		strscpy(info->driver, pdev->driver->name,
> +		strscpy(info->driver, dev_name(pdev),
Did you test this with some wifi device before and after applying the 
patch. This is not correct as pdev->driver->name is the name of the 
*driver* and dev_name(pdev) is the name of the *device*. Those are two 
different things.

>   			sizeof(info->driver));
>   	else
>   		strscpy(info->driver, "N/A", sizeof(info->driver));
> @@ -23,7 +23,7 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
>   	else
>   		strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
>   
> -	strscpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
> +	strscpy(info->bus_info, dev_name(pdev),

This makes sense.

>   		sizeof(info->bus_info));
>   }
>   EXPORT_SYMBOL(cfg80211_get_drvinfo);

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

* Re: [PATCH v1] wifi: cfg80211: simplify the code
  2025-08-25 18:50 ` Arend van Spriel
@ 2025-08-26  3:16   ` tanzheng
  0 siblings, 0 replies; 3+ messages in thread
From: tanzheng @ 2025-08-26  3:16 UTC (permalink / raw)
  To: arend.vanspriel; +Cc: johannes, linux-kernel, linux-wireless, tanzheng

Hi Arend,

This is my mistake. Here I confused driver name and device name.After you 
reviewed the code, I tested it and found that it was wrong. 

Thank you for your correction.I will remove the wrongly modified code and 
submit a new patch for modification.

Best regards,
Zheng tan

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

end of thread, other threads:[~2025-08-26  3:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-25  5:51 [PATCH v1] wifi: cfg80211: simplify the code tanzheng
2025-08-25 18:50 ` Arend van Spriel
2025-08-26  3:16   ` tanzheng

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

all inboxes | Powered by JetHome®