[PATCH net-next v1 1/3] r816e: add a fake driver r816e for RTL8116af

javen posted 3 patches 1 week, 6 days ago
[PATCH net-next v1 1/3] r816e: add a fake driver r816e for RTL8116af
Posted by javen 1 week, 6 days ago
From: Javen Xu <javen_xu@realsil.com.cn>

The driver is for the #fun which DID is 0x816e. The kernel could set
correct power state for #fun through the driver when suspending.

Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
---
 drivers/net/ethernet/realtek/r816e/r816e.c | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 drivers/net/ethernet/realtek/r816e/r816e.c

diff --git a/drivers/net/ethernet/realtek/r816e/r816e.c b/drivers/net/ethernet/realtek/r816e/r816e.c
new file mode 100644
index 000000000000..71674019de2c
--- /dev/null
+++ b/drivers/net/ethernet/realtek/r816e/r816e.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ *  r816e is the Linux device driver released for Realtek RTL8116AF nic
+ *  with PCI-Express interface, which is used for power management.
+ *
+ *  Copyright(c) 2026 Realtek Semiconductor Corp.
+ */
+
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+static struct pci_device_id rtl816e_pci_tbl[] = {
+	{ PCI_VDEVICE(REALTEK, 0x816e), },
+	{ 0, },
+};
+
+MODULE_DEVICE_TABLE(pci, rtl816e_pci_tbl);
+
+static int rtl816e_probe(struct pci_dev *pdev,
+			 const struct pci_device_id *ent)
+{
+	int rc;
+
+	/* enable device (incl. PCI PM wakeup and hotplug setup) */
+	rc = pcim_enable_device(pdev);
+	if (rc < 0)
+		return dev_err_probe(&pdev->dev, rc, "enable failure\n");
+
+	dev_info(&pdev->dev, "enable device\n");
+
+	return rc;
+}
+
+static void rtl816e_remove(struct pci_dev *pdev) {}
+
+static int rtl816e_pm_suspend(struct device *device)
+{
+	return 0;
+}
+
+static int rtl816e_pm_resume(struct device *device)
+{
+	return 0;
+}
+
+static const struct dev_pm_ops rtl816e_pm_ops = {
+	SYSTEM_SLEEP_PM_OPS(rtl816e_pm_suspend, rtl816e_pm_resume)
+};
+
+static struct pci_driver rtl816e_pci_driver = {
+	.name		= "r816e",
+	.id_table	= rtl816e_pci_tbl,
+	.probe		= rtl816e_probe,
+	.remove		= rtl816e_remove,
+#ifdef CONFIG_PM
+	.driver.pm  = pm_ptr(&rtl816e_pm_ops),
+#endif
+};
+
+static int __init rtl816e_init_module(void)
+{
+	return pci_register_driver(&rtl816e_pci_driver);
+}
+
+static void __exit rtl816e_cleanup_module(void)
+{
+	pci_unregister_driver(&rtl816e_pci_driver);
+}
+
+module_init(rtl816e_init_module);
+module_exit(rtl816e_cleanup_module);
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("RealTek RTL816E driver");
-- 
2.43.0
Re: [PATCH net-next v1 1/3] r816e: add a fake driver r816e for RTL8116af
Posted by kernel test robot 1 week, 6 days ago
Hi javen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/javen/r816e-add-a-fake-driver-r816e-for-RTL8116af/20260127-193831
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260127113425.1989-2-javen_xu%40realsil.com.cn
patch subject: [PATCH net-next v1 1/3] r816e: add a fake driver r816e for RTL8116af
reproduce: (https://download.01.org/0day-ci/archive/20260127/202601271822.HvRlrxlv-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601271822.HvRlrxlv-lkp@intel.com/

versioncheck warnings: (new ones prefixed by >>)
   INFO PATH=/opt/cross/rustc-1.88.0-bindgen-0.72.1/cargo/bin:/opt/cross/clang-20/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   /usr/bin/timeout -k 100 3h /usr/bin/make KCFLAGS= -fno-crash-diagnostics -Wno-error=return-type -Wreturn-type -funsigned-char -Wundef -falign-functions=64 W=1 --keep-going LLVM=1 -j32 ARCH=x86_64 versioncheck
   find ./* \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o \
   	-name '*.[hcS]' -type f -print | sort \
   	| xargs perl -w ./scripts/checkversion.pl
>> ./drivers/net/ethernet/realtek/r816e/r816e.c: 10 linux/version.h not needed.
   ./samples/bpf/spintest.bpf.c: 8 linux/version.h not needed.
   ./tools/lib/bpf/bpf_helpers.h: 449: need linux/version.h
   ./tools/testing/selftests/bpf/progs/dev_cgroup.c: 9 linux/version.h not needed.
   ./tools/testing/selftests/bpf/progs/netcnt_prog.c: 3 linux/version.h not needed.
   ./tools/testing/selftests/bpf/progs/test_map_lock.c: 4 linux/version.h not needed.
   ./tools/testing/selftests/bpf/progs/test_send_signal_kern.c: 4 linux/version.h not needed.
   ./tools/testing/selftests/bpf/progs/test_spin_lock.c: 4 linux/version.h not needed.
   ./tools/testing/selftests/bpf/progs/test_tcp_estats.c: 37 linux/version.h not needed.
   ./tools/testing/selftests/wireguard/qemu/init.c: 27 linux/version.h not needed.

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki