mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 10:41:49 +02:00
bnxt_en: Refactor bnxt_get_module_eeprom_by_page()
In preparation for adding .set_module_eeprom_by_page(), extract the common error checking done in bnxt_get_module_eeprom_by_page() into a new common function that can be re-used for .set_module_eeprom_by_page(). Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250310183129.3154117-7-michael.chan@broadcom.com Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
17596d239f
commit
1b64544d63
|
|
@ -4541,11 +4541,11 @@ static int bnxt_get_module_status(struct bnxt *bp, struct netlink_ext_ack *extac
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int bnxt_get_module_eeprom_by_page(struct net_device *dev,
|
||||
const struct ethtool_module_eeprom *page_data,
|
||||
struct netlink_ext_ack *extack)
|
||||
static int
|
||||
bnxt_mod_eeprom_by_page_precheck(struct bnxt *bp,
|
||||
const struct ethtool_module_eeprom *page_data,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
int rc;
|
||||
|
||||
if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
|
||||
|
|
@ -4567,6 +4567,19 @@ static int bnxt_get_module_eeprom_by_page(struct net_device *dev,
|
|||
NL_SET_ERR_MSG_MOD(extack, "Firmware not capable for bank selection");
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bnxt_get_module_eeprom_by_page(struct net_device *dev,
|
||||
const struct ethtool_module_eeprom *page_data,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
int rc;
|
||||
|
||||
rc = bnxt_mod_eeprom_by_page_precheck(bp, page_data, extack);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = bnxt_read_sfp_module_eeprom_info(bp, page_data->i2c_address << 1,
|
||||
page_data->page, page_data->bank,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user