wifi: cfg80211: use sysfs_emit_at() in addresses_show

This is now the standard way to print data for sysfs read
callbacks.

Assisted-by: GitHubCopilot:GPT-5.3-Codex
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260922135556.49646df6da77.If5066fce4d8f42221009e77d76c68132e18c6a0d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Emmanuel Grumbach 2026-09-22 13:56:19 +03:00 committed by Johannes Berg
parent 6c05e2aac5
commit cb578a044d

View File

@ -5,7 +5,7 @@
*
* Copyright 2005-2006 Jiri Benc <jbenc@suse.cz>
* Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
* Copyright (C) 2020-2021, 2023-2024 Intel Corporation
* Copyright (C) 2020-2021, 2023-2024, 2026 Intel Corporation
*/
#include <linux/device.h>
@ -52,16 +52,16 @@ static ssize_t addresses_show(struct device *dev,
char *buf)
{
struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
char *start = buf;
int i;
int i, len = 0;
if (!wiphy->addresses)
return sprintf(buf, "%pM\n", wiphy->perm_addr);
return sysfs_emit(buf, "%pM\n", wiphy->perm_addr);
for (i = 0; i < wiphy->n_addresses; i++)
buf += sprintf(buf, "%pM\n", wiphy->addresses[i].addr);
len += sysfs_emit_at(buf, len, "%pM\n",
wiphy->addresses[i].addr);
return buf - start;
return len;
}
static DEVICE_ATTR_RO(addresses);