[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL V2 06/44] e1000e: Introduce E1000E_LOW_BITS_SET_FUNC
From: |
Jason Wang |
Subject: |
[PULL V2 06/44] e1000e: Introduce E1000E_LOW_BITS_SET_FUNC |
Date: |
Fri, 10 Mar 2023 17:34:48 +0800 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
e1000e_set_16bit and e1000e_set_12bit look so similar so define a
generic macro.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/e1000e_core.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 181c1e0..1cafc38 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -2440,17 +2440,15 @@ e1000e_set_fcrtl(E1000ECore *core, int index, uint32_t
val)
core->mac[FCRTL] = val & 0x8000FFF8;
}
-static inline void
-e1000e_set_16bit(E1000ECore *core, int index, uint32_t val)
-{
- core->mac[index] = val & 0xffff;
-}
+#define E1000E_LOW_BITS_SET_FUNC(num) \
+ static void \
+ e1000e_set_##num##bit(E1000ECore *core, int index, uint32_t val) \
+ { \
+ core->mac[index] = val & (BIT(num) - 1); \
+ }
-static void
-e1000e_set_12bit(E1000ECore *core, int index, uint32_t val)
-{
- core->mac[index] = val & 0xfff;
-}
+E1000E_LOW_BITS_SET_FUNC(12)
+E1000E_LOW_BITS_SET_FUNC(16)
static void
e1000e_set_vet(E1000ECore *core, int index, uint32_t val)
--
2.7.4
- [PULL V2 00/44] Net patches, Jason Wang, 2023/03/10
- [PULL V2 01/44] e1000e: Fix the code style, Jason Wang, 2023/03/10
- [PULL V2 02/44] hw/net: Add more MII definitions, Jason Wang, 2023/03/10
- [PULL V2 03/44] fsl_etsec: Use hw/net/mii.h, Jason Wang, 2023/03/10
- [PULL V2 05/44] e1000: Mask registers when writing, Jason Wang, 2023/03/10
- [PULL V2 04/44] e1000: Use hw/net/mii.h, Jason Wang, 2023/03/10
- [PULL V2 07/44] e1000e: Mask registers when writing, Jason Wang, 2023/03/10
- [PULL V2 06/44] e1000e: Introduce E1000E_LOW_BITS_SET_FUNC,
Jason Wang <=
- [PULL V2 08/44] e1000: Use more constant definitions, Jason Wang, 2023/03/10
- [PULL V2 09/44] e1000e: Use more constant definitions, Jason Wang, 2023/03/10
- [PULL V2 10/44] e1000: Use memcpy to intialize registers, Jason Wang, 2023/03/10
- [PULL V2 11/44] e1000e: Use memcpy to intialize registers, Jason Wang, 2023/03/10
- [PULL V2 12/44] e1000e: Remove pending interrupt flags, Jason Wang, 2023/03/10
- [PULL V2 13/44] e1000e: Improve software reset, Jason Wang, 2023/03/10
- [PULL V2 14/44] e1000: Configure ResettableClass, Jason Wang, 2023/03/10
- [PULL V2 15/44] e1000e: Configure ResettableClass, Jason Wang, 2023/03/10
- [PULL V2 17/44] e1000e: Set MII_ANER_NWAY, Jason Wang, 2023/03/10
- [PULL V2 16/44] e1000e: Introduce e1000_rx_desc_union, Jason Wang, 2023/03/10