Skip to content

Commit

Permalink
Fix incompatible pointer type error in kernel 5.15+
Browse files Browse the repository at this point in the history
By the kernel 5.15+, there are new patches for ethtool.
- https://patchwork.kernel.org/project/netdevbpf/list/?series=534709&state=%2A&archive=both

Adding those two dummy parameters will fix the following compile error
in the kernel 5.14 or below.

```
/home/awesometic/Developer/realtek-r8152-dkms/src/r8152.c:18530:18: error: initialization of ‘int (*)(struct net_device *, struct ethtool_coalesce *, struct kernel_ethtool_coalesce *, struct netlink_ext_ack *)’ from incompatible pointer type ‘int (*)(struct net_device *, struct ethtool_coalesce *)’ [-Werror=incompatible-pointer-types]
18530 |  .get_coalesce = rtl8152_get_coalesce,
      |                  ^~~~~~~~~~~~~~~~~~~~
/home/awesometic/Developer/realtek-r8152-dkms/src/r8152.c:18530:18: note: (near initialization for ‘ops.get_coalesce’)
/home/awesometic/Developer/realtek-r8152-dkms/src/r8152.c:18531:18: error: initialization of ‘int (*)(struct net_device *, struct ethtool_coalesce *, struct kernel_ethtool_coalesce *, struct netlink_ext_ack *)’ from incompatible pointer type ‘int (*)(struct net_device *, struct ethtool_coalesce *)’ [-Werror=incompatible-pointer-types]
18531 |  .set_coalesce = rtl8152_set_coalesce,
      |                  ^~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Deokgyu Yang <[email protected]>
  • Loading branch information
awesometic committed Jan 26, 2022
1 parent 614ee53 commit 07861c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -18336,7 +18336,13 @@ static int rtl8152_nway_reset(struct net_device *dev)
}

static int rtl8152_get_coalesce(struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
struct ethtool_coalesce *coalesce,
struct kernel_ethtool_coalesce *_kernel_coalesce,
struct netlink_ext_ack *_netlink_ack)
#else
struct ethtool_coalesce *coalesce)
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) */
{
struct r8152 *tp = netdev_priv(netdev);

Expand All @@ -18355,7 +18361,13 @@ static int rtl8152_get_coalesce(struct net_device *netdev,
}

static int rtl8152_set_coalesce(struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
struct ethtool_coalesce *coalesce,
struct kernel_ethtool_coalesce *_kernel_coalesce,
struct netlink_ext_ack *_netlink_ack)
#else
struct ethtool_coalesce *coalesce)
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) */
{
struct r8152 *tp = netdev_priv(netdev);
u32 rx_coalesce_nsecs;
Expand Down

0 comments on commit 07861c7

Please sign in to comment.