net: dsa: microchip: make ksz_is_port_mac_global_usable() static

ksz_is_port_mac_global_usable() is exposed in ksz_common.h while it's
only used internally.

Make ksz_is_port_mac_global_usable() static.
Move its definition above its first call.

Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20260702-clean-ksz-4th-v1-3-93441e695fa4@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Bastien Curutchet (Schneider Electric) 2026-07-02 11:07:25 +02:00 committed by Paolo Abeni
parent 18a856b236
commit caf5d68b51
2 changed files with 28 additions and 29 deletions

View File

@ -3670,6 +3670,34 @@ int ksz_handle_wake_reason(struct ksz_device *dev, int port)
pme_status);
}
/**
* ksz_is_port_mac_global_usable - Check if the MAC address on a given port
* can be used as a global address.
* @ds: Pointer to the DSA switch structure.
* @port: The port number on which the MAC address is to be checked.
*
* This function examines the MAC address set on the specified port and
* determines if it can be used as a global address for the switch.
*
* Return: true if the port's MAC address can be used as a global address, false
* otherwise.
*/
static bool ksz_is_port_mac_global_usable(struct dsa_switch *ds, int port)
{
struct net_device *user = dsa_to_port(ds, port)->user;
const unsigned char *addr = user->dev_addr;
struct ksz_switch_macaddr *switch_macaddr;
struct ksz_device *dev = ds->priv;
ASSERT_RTNL();
switch_macaddr = dev->switch_macaddr;
if (switch_macaddr && !ether_addr_equal(switch_macaddr->addr, addr))
return false;
return true;
}
/**
* ksz_get_wol - Get Wake-on-LAN settings for a specified port.
* @ds: The dsa_switch structure.
@ -3863,34 +3891,6 @@ int ksz_port_set_mac_address(struct dsa_switch *ds, int port,
return 0;
}
/**
* ksz_is_port_mac_global_usable - Check if the MAC address on a given port
* can be used as a global address.
* @ds: Pointer to the DSA switch structure.
* @port: The port number on which the MAC address is to be checked.
*
* This function examines the MAC address set on the specified port and
* determines if it can be used as a global address for the switch.
*
* Return: true if the port's MAC address can be used as a global address, false
* otherwise.
*/
bool ksz_is_port_mac_global_usable(struct dsa_switch *ds, int port)
{
struct net_device *user = dsa_to_port(ds, port)->user;
const unsigned char *addr = user->dev_addr;
struct ksz_switch_macaddr *switch_macaddr;
struct ksz_device *dev = ds->priv;
ASSERT_RTNL();
switch_macaddr = dev->switch_macaddr;
if (switch_macaddr && !ether_addr_equal(switch_macaddr->addr, addr))
return false;
return true;
}
/**
* ksz_switch_macaddr_get - Program the switch's MAC address register.
* @ds: DSA switch instance.

View File

@ -393,7 +393,6 @@ int ksz_switch_resume(struct device *dev);
void ksz_teardown(struct dsa_switch *ds);
void ksz_init_mib_timer(struct ksz_device *dev);
bool ksz_is_port_mac_global_usable(struct dsa_switch *ds, int port);
void ksz_r_mib_stats64(struct ksz_device *dev, int port);
void ksz88xx_r_mib_stats64(struct ksz_device *dev, int port);
void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state);