realtek: Switch to kernel integer types

uint(8|16|32|64)_t and int(8|16|32|64)_t types should not be used in
kernel code. The shorter s(8|16|32|64) and u(8|16|32|64) or the
endianness specific versions (le*, be*) must be used instead.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Sven Eckelmann 2025-11-23 17:16:04 +01:00 committed by Hauke Mehrtens
parent 612f1e6afb
commit 70563e6aa2
6 changed files with 47 additions and 47 deletions

View File

@ -102,9 +102,9 @@ const char *get_system_type(void)
return rtl83xx_system_type;
}
static void __init rtl838x_read_details(uint32_t model)
static void __init rtl838x_read_details(u32 model)
{
uint32_t chip_info, ext_version, tmp;
u32 chip_info, ext_version, tmp;
sw_w32(0x3, RTL838X_INT_RW_CTRL);
sw_w32(0xa << 28, RTL838X_CHIP_INFO);
@ -128,9 +128,9 @@ static void __init rtl838x_read_details(uint32_t model)
}
}
static void __init rtl839x_read_details(uint32_t model)
static void __init rtl839x_read_details(u32 model)
{
uint32_t chip_info;
u32 chip_info;
sw_w32(0xa << 28, RTL839X_CHIP_INFO);
@ -143,9 +143,9 @@ static void __init rtl839x_read_details(uint32_t model)
soc_info.testchip = true;
}
static void __init rtl93xx_read_details(uint32_t model)
static void __init rtl93xx_read_details(u32 model)
{
uint32_t chip_info;
u32 chip_info;
sw_w32(0xa << 16, RTL93XX_CHIP_INFO);
@ -158,9 +158,9 @@ static void __init rtl93xx_read_details(uint32_t model)
soc_info.testchip = true;
}
static uint32_t __init read_model(void)
static u32 __init read_model(void)
{
uint32_t model, id;
u32 model, id;
model = sw_r32(RTL838X_MODEL_NAME_INFO);
id = model >> 16 & 0xffff;
@ -197,7 +197,7 @@ static uint32_t __init read_model(void)
return 0;
}
static void __init parse_model(uint32_t model)
static void __init parse_model(u32 model)
{
int val;
char suffix = 0;
@ -230,7 +230,7 @@ static void __init rtl83xx_set_system_type(void)
void __init prom_init(void)
{
uint32_t model = read_model();
u32 model = read_model();
parse_model(model);
rtl83xx_set_system_type();

View File

@ -963,9 +963,9 @@ static const struct rtldsa_mib_desc *rtldsa_get_mib_desc(struct rtl838x_switch_p
static bool rtldsa_read_mib_item(struct rtl838x_switch_priv *priv, int port,
const struct rtldsa_mib_item *mib_item,
uint64_t *data)
u64 *data)
{
uint32_t high1, high2;
u32 high1, high2;
int reg, reg_offset, addr_low;
switch (mib_item->reg) {
@ -1000,7 +1000,7 @@ static bool rtldsa_read_mib_item(struct rtl838x_switch_priv *priv, int port,
/* Low must have wrapped and overflowed into high, read again */
*data = sw_r32(addr_low);
}
*data |= (uint64_t)high2 << 32;
*data |= (u64)high2 << 32;
} else {
*data = sw_r32(addr_low);
}
@ -1012,8 +1012,8 @@ static void rtldsa_update_counter(struct rtl838x_switch_priv *priv, int port,
struct rtldsa_counter *counter,
const struct rtldsa_mib_item *mib_item)
{
uint64_t val;
uint32_t val32, diff;
u64 val;
u32 val32, diff;
if (!rtldsa_read_mib_item(priv, port, mib_item, &val))
return;
@ -1021,7 +1021,7 @@ static void rtldsa_update_counter(struct rtl838x_switch_priv *priv, int port,
if (mib_item->size == 2) {
counter->val = val;
} else {
val32 = (uint32_t)val;
val32 = (u32)val;
diff = val32 - counter->last;
counter->val += diff;
counter->last = val32;
@ -1254,7 +1254,7 @@ static void rtldsa_get_strings(struct dsa_switch *ds,
}
static void rtldsa_get_ethtool_stats(struct dsa_switch *ds, int port,
uint64_t *data)
u64 *data)
{
struct rtl838x_switch_priv *priv = ds->priv;
const struct rtldsa_mib_desc *mib_desc;

View File

@ -723,8 +723,8 @@ enum pbvlan_mode {
};
struct rtldsa_counter {
uint64_t val;
uint32_t last;
u64 val;
u32 last;
};
struct rtldsa_counter_state {

View File

@ -51,33 +51,33 @@ int rtl83xx_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type
#define RING_BUFFER 1600
struct p_hdr {
uint8_t *buf;
uint16_t reserved;
uint16_t size; /* buffer size */
uint16_t offset;
uint16_t len; /* pkt len */
/* cpu_tag[0] is a reserved uint16_t on RTL83xx */
uint16_t cpu_tag[10];
u8 *buf;
u16 reserved;
u16 size; /* buffer size */
u16 offset;
u16 len; /* pkt len */
/* cpu_tag[0] is a reserved u16 on RTL83xx */
u16 cpu_tag[10];
} __packed __aligned(1);
struct n_event {
uint32_t type:2;
uint32_t fidVid:12;
uint64_t mac:48;
uint32_t slp:6;
uint32_t valid:1;
uint32_t reserved:27;
u32 type:2;
u32 fidVid:12;
u64 mac:48;
u32 slp:6;
u32 valid:1;
u32 reserved:27;
} __packed __aligned(1);
struct ring_b {
uint32_t rx_r[MAX_RXRINGS][MAX_RXLEN];
uint32_t tx_r[TXRINGS][TXRINGLEN];
u32 rx_r[MAX_RXRINGS][MAX_RXLEN];
u32 tx_r[TXRINGS][TXRINGLEN];
struct p_hdr rx_header[MAX_RXRINGS][MAX_RXLEN];
struct p_hdr tx_header[TXRINGS][TXRINGLEN];
uint32_t c_rx[MAX_RXRINGS];
uint32_t c_tx[TXRINGS];
uint8_t tx_space[TXRINGS * TXRINGLEN * RING_BUFFER];
uint8_t *rx_space;
u32 c_rx[MAX_RXRINGS];
u32 c_tx[TXRINGS];
u8 tx_space[TXRINGS * TXRINGLEN * RING_BUFFER];
u8 *rx_space;
};
struct notify_block {
@ -1182,7 +1182,7 @@ static int rtl838x_hw_receive(struct net_device *dev, int r, int budget)
if ((ring->rx_r[r][ring->c_rx[r]] & 0x1)) {
if (&ring->rx_r[r][ring->c_rx[r]] != last) {
netdev_warn(dev, "Ring contention: r: %x, last %x, cur %x\n",
r, (uint32_t)last, (u32) &ring->rx_r[r][ring->c_rx[r]]);
r, (u32)last, (u32) &ring->rx_r[r][ring->c_rx[r]]);
}
break;
}

View File

@ -205,7 +205,7 @@ static struct fw_header *rtl838x_request_fw(struct phy_device *phydev,
struct device *dev = &phydev->mdio.dev;
int err;
struct fw_header *h;
uint32_t checksum, my_checksum;
u32 checksum, my_checksum;
err = request_firmware(&fw, name, dev);
if (err < 0)

View File

@ -1,16 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0-only */
struct __packed part {
uint16_t start;
uint8_t wordsize;
uint8_t words;
u16 start;
u8 wordsize;
u8 words;
};
struct __packed fw_header {
uint32_t magic;
uint32_t phy;
uint32_t checksum;
uint32_t version;
u32 magic;
u32 phy;
u32 checksum;
u32 version;
struct part parts[10];
};