Skip to content

Fix compilation on Linux kernel 6.16+#1

Open
philiplinden wants to merge 2 commits intoTime-Appliances-Project:masterfrom
philiplinden:6.16.8-arch3-1
Open

Fix compilation on Linux kernel 6.16+#1
philiplinden wants to merge 2 commits intoTime-Appliances-Project:masterfrom
philiplinden:6.16.8-arch3-1

Conversation

@philiplinden
Copy link

Add ccflags-y declarations alongside EXTRA_CFLAGS for modern kernel build system compatibility. Resolves incompatible pointer type error in ethtool get_ts_info callback.

AX88279 Driver Compilation Fix for Linux Kernel 6.16+

Problem Summary

The ASIX AX88279 USB Ethernet driver (v3.5.16) with PTP support fails to compile on Arch Linux 6.16.8-arch3-1. Two compatibility issues were identified:

  1. Deprecated Makefile syntax: The driver uses EXTRA_CFLAGS which is deprecated in newer kernel build systems
  2. Kernel API change: The ethtool get_ts_info callback signature changed in recent kernels

Error Messages

ax88179a_772d.c:539:27: error: initialization of 'int (*)(struct net_device *, struct kernel_ethtool_ts_info *)' from incompatible pointer type 'int (*)(struct net_device *, struct ethtool_ts_info *)' [-Wincompatible-pointer-types]

Required Changes

1. Makefile (Add ccflags-y alongside EXTRA_CFLAGS)

Update the Makefile to use both EXTRA_CFLAGS (for older kernels) and ccflags-y (for newer kernels). Add ccflags-y declarations for all conditional compilation flags:

Line 19-20: Add ccflags-y initialization

EXTRA_CFLAGS = -fno-pie
ccflags-y = -fno-pie

For each ENABLE_* flag, add ccflags-y alongside EXTRA_CFLAGS

Example pattern:

ifeq ($(ENABLE_PTP_FUNC), y)
	$(TARGET)-objs += ax_ptp.o
	EXTRA_CFLAGS += -DENABLE_PTP_FUNC
	ccflags-y += -DENABLE_PTP_FUNC    # ADD THIS LINE
ifeq ($(ENABLE_PTP_DEBUG), y)
	EXTRA_CFLAGS += -DENABLE_PTP_DEBUG
	ccflags-y += -DENABLE_PTP_DEBUG    # ADD THIS LINE
endif
endif

Apply this pattern to all flags:

  • ENABLE_IOCTL_DEBUG
  • ENABLE_AUTODETACH_FUNC
  • ENABLE_MAC_PASS
  • ENABLE_INT_AGGRESSIVE
  • ENABLE_INT_POLLING
  • ENABLE_AUTOSUSPEND
  • ENABLE_TX_TASKLET
  • ENABLE_RX_TASKLET
  • ENABLE_PTP_FUNC
  • ENABLE_PTP_DEBUG
  • ENABLE_QUEUE_PRIORITY
  • ENABLE_AX88279

2. ax88179a_772d.c (Fix ethtool API signature)

Change the function signature at line 468-469:

BEFORE:

#ifdef ENABLE_PTP_FUNC
static int ax88179a_set_wol_get_ts_info
(struct net_device *dev, struct ethtool_ts_info *info)

AFTER:

#ifdef ENABLE_PTP_FUNC
static int ax88179a_set_wol_get_ts_info
(struct net_device *dev, struct kernel_ethtool_ts_info *info)

Verification

After changes, compilation should succeed:

make clean && make

Expected output should show successful compilation of ax_usb_nic.ko without errors.

Impact

  • No functional changes to driver behavior
  • Pure API compatibility fix for kernel 6.16+
  • Both changes are required for successful compilation
  • The function body remains unchanged; only the type signature updates to match the kernel API

Add ccflags-y declarations alongside EXTRA_CFLAGS for modern kernel build system compatibility. Resolves incompatible pointer type error in ethtool get_ts_info callback.
@philiplinden
Copy link
Author

@ahmadexp anything else to do here before it can be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant