* [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min()
@ 2023-06-27 4:31 You Kangren
2023-06-29 11:44 ` David Laight
2023-06-29 20:05 ` Simon Horman
0 siblings, 2 replies; 3+ messages in thread
From: You Kangren @ 2023-06-27 4:31 UTC (permalink / raw)
To: Kalle Valo, Dongliang Mu, You Kangren, Simon Horman,
Christophe JAILLET,
open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER, open list
Cc: opensource.kernel
Replace the ternary conditional operator with min_t() to simplify the code
Signed-off-by: You Kangren <youkangren@vivo.com>
---
drivers/net/wireless/legacy/ray_cs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
index 8ace797ce951..25edbc655738 100644
--- a/drivers/net/wireless/legacy/ray_cs.c
+++ b/drivers/net/wireless/legacy/ray_cs.c
@@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
rx_data(dev, prcs, pkt_addr, rx_len);
copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr,
- rx_len < sizeof(struct beacon_rx) ?
- rx_len : sizeof(struct beacon_rx));
+ min_t(size_t, rx_len, sizeof(struct beacon_rx));
local->beacon_rxed = 1;
/* Get the statistics so the card counters never overflow */
--
2.39.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min()
2023-06-27 4:31 [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min() You Kangren
@ 2023-06-29 11:44 ` David Laight
2023-06-29 20:05 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: David Laight @ 2023-06-29 11:44 UTC (permalink / raw)
To: 'You Kangren', Kalle Valo, Dongliang Mu, Simon Horman,
Christophe JAILLET,
open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER, open list
Cc: opensource.kernel@vivo.com
From: You Kangren <youkangren@vivo.com>
> Sent: 27 June 2023 05:32
>
> Replace the ternary conditional operator with min_t() to simplify the code
>
> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---
> drivers/net/wireless/legacy/ray_cs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
> index 8ace797ce951..25edbc655738 100644
> --- a/drivers/net/wireless/legacy/ray_cs.c
> +++ b/drivers/net/wireless/legacy/ray_cs.c
> @@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
> rx_data(dev, prcs, pkt_addr, rx_len);
>
> copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr,
> - rx_len < sizeof(struct beacon_rx) ?
> - rx_len : sizeof(struct beacon_rx));
> + min_t(size_t, rx_len, sizeof(struct beacon_rx));
You should really consider changing the type of rx_len
before using min_t().
David
>
> local->beacon_rxed = 1;
> /* Get the statistics so the card counters never overflow */
> --
> 2.39.0
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min()
2023-06-27 4:31 [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min() You Kangren
2023-06-29 11:44 ` David Laight
@ 2023-06-29 20:05 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-06-29 20:05 UTC (permalink / raw)
To: You Kangren
Cc: Kalle Valo, Dongliang Mu, Christophe JAILLET,
open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER, open list,
opensource.kernel
On Tue, Jun 27, 2023 at 12:31:48PM +0800, You Kangren wrote:
> Replace the ternary conditional operator with min_t() to simplify the code
>
> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---
> drivers/net/wireless/legacy/ray_cs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
> index 8ace797ce951..25edbc655738 100644
> --- a/drivers/net/wireless/legacy/ray_cs.c
> +++ b/drivers/net/wireless/legacy/ray_cs.c
> @@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
> rx_data(dev, prcs, pkt_addr, rx_len);
>
> copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr,
> - rx_len < sizeof(struct beacon_rx) ?
> - rx_len : sizeof(struct beacon_rx));
> + min_t(size_t, rx_len, sizeof(struct beacon_rx));
Hi You Kangen,
unfortunately this patch doesn't seem to compile.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-29 20:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-27 4:31 [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min() You Kangren
2023-06-29 11:44 ` David Laight
2023-06-29 20:05 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).