diff mbox series

[v2,11/28] soc: fsl: cpm1: qmc: Remove no more needed checks from qmc_check_chans()

Message ID 20230726150225.483464-12-herve.codina@bootlin.com (mailing list archive)
State Superseded
Headers show
Series Add support for QMC HDLC, framer infrastruture and PEF2256 framer | expand

Commit Message

Herve Codina July 26, 2023, 3:02 p.m. UTC
The newly introduced qmc_chan_setup_tsa* functions check that the
channel entries are not already used.
These checks are also performed by qmc_check_chans() and are no more
needed.

Remove them from qmc_check_chans().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 drivers/soc/fsl/qe/qmc.c | 20 --------------------
 1 file changed, 20 deletions(-)

Comments

Christophe Leroy Aug. 8, 2023, 8:05 a.m. UTC | #1
Le 26/07/2023 à 17:02, Herve Codina a écrit :
> The newly introduced qmc_chan_setup_tsa* functions check that the
> channel entries are not already used.
> These checks are also performed by qmc_check_chans() and are no more
> needed.
> 
> Remove them from qmc_check_chans().
> 
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   drivers/soc/fsl/qe/qmc.c | 20 --------------------
>   1 file changed, 20 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qe/qmc.c b/drivers/soc/fsl/qe/qmc.c
> index c5552a0b5b19..33761c39aee1 100644
> --- a/drivers/soc/fsl/qe/qmc.c
> +++ b/drivers/soc/fsl/qe/qmc.c
> @@ -884,10 +884,7 @@ EXPORT_SYMBOL(qmc_chan_reset);
>   static int qmc_check_chans(struct qmc *qmc)
>   {
>   	struct tsa_serial_info info;
> -	bool is_one_table = false;
>   	struct qmc_chan *chan;
> -	u64 tx_ts_mask = 0;
> -	u64 rx_ts_mask = 0;
>   	u64 tx_ts_assigned_mask;
>   	u64 rx_ts_assigned_mask;
>   	int ret;
> @@ -911,7 +908,6 @@ static int qmc_check_chans(struct qmc *qmc)
>   			dev_err(qmc->dev, "Number of TSA Tx/Rx TS assigned are not equal\n");
>   			return -EINVAL;
>   		}
> -		is_one_table = true;
>   	}
>   
>   	tx_ts_assigned_mask = info.nb_tx_ts == 64 ? U64_MAX : (((u64)1) << info.nb_tx_ts) - 1;
> @@ -922,27 +918,11 @@ static int qmc_check_chans(struct qmc *qmc)
>   			dev_err(qmc->dev, "chan %u uses TSA unassigned Tx TS\n", chan->id);
>   			return -EINVAL;
>   		}
> -		if (tx_ts_mask & chan->tx_ts_mask) {
> -			dev_err(qmc->dev, "chan %u uses an already used Tx TS\n", chan->id);
> -			return -EINVAL;
> -		}
>   
>   		if (chan->rx_ts_mask > rx_ts_assigned_mask) {
>   			dev_err(qmc->dev, "chan %u uses TSA unassigned Rx TS\n", chan->id);
>   			return -EINVAL;
>   		}
> -		if (rx_ts_mask & chan->rx_ts_mask) {
> -			dev_err(qmc->dev, "chan %u uses an already used Rx TS\n", chan->id);
> -			return -EINVAL;
> -		}
> -
> -		if (is_one_table && (chan->tx_ts_mask != chan->rx_ts_mask)) {
> -			dev_err(qmc->dev, "chan %u uses different Rx and Tx TS\n", chan->id);
> -			return -EINVAL;
> -		}
> -
> -		tx_ts_mask |= chan->tx_ts_mask;
> -		rx_ts_mask |= chan->rx_ts_mask;
>   	}
>   
>   	return 0;
diff mbox series

Patch

diff --git a/drivers/soc/fsl/qe/qmc.c b/drivers/soc/fsl/qe/qmc.c
index c5552a0b5b19..33761c39aee1 100644
--- a/drivers/soc/fsl/qe/qmc.c
+++ b/drivers/soc/fsl/qe/qmc.c
@@ -884,10 +884,7 @@  EXPORT_SYMBOL(qmc_chan_reset);
 static int qmc_check_chans(struct qmc *qmc)
 {
 	struct tsa_serial_info info;
-	bool is_one_table = false;
 	struct qmc_chan *chan;
-	u64 tx_ts_mask = 0;
-	u64 rx_ts_mask = 0;
 	u64 tx_ts_assigned_mask;
 	u64 rx_ts_assigned_mask;
 	int ret;
@@ -911,7 +908,6 @@  static int qmc_check_chans(struct qmc *qmc)
 			dev_err(qmc->dev, "Number of TSA Tx/Rx TS assigned are not equal\n");
 			return -EINVAL;
 		}
-		is_one_table = true;
 	}
 
 	tx_ts_assigned_mask = info.nb_tx_ts == 64 ? U64_MAX : (((u64)1) << info.nb_tx_ts) - 1;
@@ -922,27 +918,11 @@  static int qmc_check_chans(struct qmc *qmc)
 			dev_err(qmc->dev, "chan %u uses TSA unassigned Tx TS\n", chan->id);
 			return -EINVAL;
 		}
-		if (tx_ts_mask & chan->tx_ts_mask) {
-			dev_err(qmc->dev, "chan %u uses an already used Tx TS\n", chan->id);
-			return -EINVAL;
-		}
 
 		if (chan->rx_ts_mask > rx_ts_assigned_mask) {
 			dev_err(qmc->dev, "chan %u uses TSA unassigned Rx TS\n", chan->id);
 			return -EINVAL;
 		}
-		if (rx_ts_mask & chan->rx_ts_mask) {
-			dev_err(qmc->dev, "chan %u uses an already used Rx TS\n", chan->id);
-			return -EINVAL;
-		}
-
-		if (is_one_table && (chan->tx_ts_mask != chan->rx_ts_mask)) {
-			dev_err(qmc->dev, "chan %u uses different Rx and Tx TS\n", chan->id);
-			return -EINVAL;
-		}
-
-		tx_ts_mask |= chan->tx_ts_mask;
-		rx_ts_mask |= chan->rx_ts_mask;
 	}
 
 	return 0;