Skip to content

Commit

Permalink
net: stmmac: replace the ext_snapshot_en field with a flag
Browse files Browse the repository at this point in the history
Drop the boolean field of the plat_stmmacenet_data structure in favor of a
simple bitfield flag.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Link: https://lore.kernel.org/r/20230710090001.303225-10-brgl@bgdev.pl
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Bartosz Golaszewski authored and Jakub Kicinski committed Jul 14, 2023
1 parent 956c3f0 commit aa5513f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static int intel_crosststamp(ktime_t *device,
/* Both internal crosstimestamping and external triggered event
* timestamping cannot be run concurrently.
*/
if (priv->plat->ext_snapshot_en)
if (priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN)
return -EBUSY;

priv->plat->int_snapshot_en = 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
*/
ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS);

if (!priv->plat->ext_snapshot_en)
if (priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN)
return;

num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >>
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
write_unlock_irqrestore(&priv->ptp_lock, flags);
break;
case PTP_CLK_REQ_EXTTS:
priv->plat->ext_snapshot_en = on;
if (on)
priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN;
else
priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN;
mutex_lock(&priv->aux_ts_lock);
acr_value = readl(ptpaddr + PTP_ACR);
acr_value &= ~PTP_ACR_MASK;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ struct dwmac4_addrs {
#define STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP BIT(5)
#define STMMAC_FLAG_VLAN_FAIL_Q_EN BIT(6)
#define STMMAC_FLAG_MULTI_MSI_EN BIT(7)
#define STMMAC_FLAG_EXT_SNAPSHOT_EN BIT(8)

struct plat_stmmacenet_data {
int bus_id;
Expand Down Expand Up @@ -286,7 +287,6 @@ struct plat_stmmacenet_data {
int int_snapshot_num;
int ext_snapshot_num;
bool int_snapshot_en;
bool ext_snapshot_en;
int msi_mac_vec;
int msi_wol_vec;
int msi_lpi_vec;
Expand Down

0 comments on commit aa5513f

Please sign in to comment.