Re: [PATCH iwl-net v1 2/4] igc: Fix reset adapter logics when tx mode change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




---
  drivers/net/ethernet/intel/igc/igc_tsn.c | 26 +++++++++++++++++++++---
  1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index 02dd41aff634..61f047ebf34d 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -49,6 +49,13 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)
  	return new_flags;
  }
+static bool igc_tsn_is_tx_mode_in_tsn(struct igc_adapter *adapter)
+{
+	struct igc_hw *hw = &adapter->hw;
+
+	return (bool)(rd32(IGC_TQAVCTRL) & IGC_TQAVCTRL_TRANSMIT_MODE_TSN);

Perhaps it is more a question of taste than anything else.
But my preference, FIIW, is to avoid casts.
And I think in this case using !! is a common pattern.

(Completely untested!)

	return !!(rd32(IGC_TQAVCTRL) & IGC_TQAVCTRL_TRANSMIT_MODE_TSN);


Sure, will update.

+
+	if ((any_tsn_enabled && !igc_tsn_is_tx_mode_in_tsn(adapter)) ||
+	    (!any_tsn_enabled && igc_tsn_is_tx_mode_in_tsn(adapter)))
+		return true;
+	else
+		return false;

Likewise, this is probably more a matter of taste than anything else.
But I think this could be expressed as:

(Completely untested!)

	return (any_tsn_enabled && !igc_tsn_is_tx_mode_in_tsn(adapter)) ||
		(!any_tsn_enabled && igc_tsn_is_tx_mode_in_tsn(adapter));

Similarly in the previous patch of this series.


Will update, your suggestion is better, lesser parenthesis.
Thanks.




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux