Commit c76be4d6 authored by Pavel Pisa's avatar Pavel Pisa Committed by Ille, Ondrej, Ing.
Browse files

driver: finish full driver separation into ctucanfd, ctucanfd_pci and ctucanfd_platform modules.



Partial separation does did not work if both CONFIG_PCI and CONFIG_OF
are not set. Separation when the ctu_can_fd.o is linked into two drivers
is not elegant either.

The full separation seems only solution to kernel regression
when PCI and platform driver tables definition cannot coexist
in same source file.
Signed-off-by: Pavel Pisa's avatarPavel Pisa <pisa@cmp.felk.cvut.cz>


(cherry picked from commit e5379370)
parent 0b6e2a62
......@@ -44,6 +44,12 @@
#include "ctu_can_fd.h"
#include "ctu_can_fd_regs.h"
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Martin Jerabek");
MODULE_DESCRIPTION("CTU CAN FD interface");
#define DRV_NAME "ctucanfd"
static const char *ctucan_state_strings[] = {
"CAN_STATE_ERROR_ACTIVE",
"CAN_STATE_ERROR_WARNING",
......@@ -954,6 +960,7 @@ int ctucan_suspend(struct device *dev)
return 0;
}
EXPORT_SYMBOL(ctucan_suspend);
int ctucan_resume(struct device *dev)
{
......@@ -971,6 +978,7 @@ int ctucan_resume(struct device *dev)
return 0;
}
EXPORT_SYMBOL(ctucan_resume);
int ctucan_probe_common(struct device *dev, void __iomem *addr,
int irq, unsigned int ntxbufs, unsigned long can_clk_rate,
......@@ -1086,7 +1094,20 @@ err_free:
free_candev(ndev);
return ret;
}
EXPORT_SYMBOL(ctucan_probe_common);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Martin Jerabek");
MODULE_DESCRIPTION("CTU CAN FD interface");
static __init int ctucan_init(void)
{
printk(KERN_INFO "%s CAN netdevice driver\n", DRV_NAME);
return 0;
}
module_init(ctucan_init);
static __exit void ctucan_exit(void)
{
printk(KERN_INFO "%s: driver removed\n", DRV_NAME);
}
module_exit(ctucan_exit);
......@@ -27,6 +27,9 @@
* GNU General Public License for more details.
******************************************************************************/
#ifndef __CTU_CAN_FD__
#define __CTU_CAN_FD__
#include <linux/netdevice.h>
#include <linux/can/dev.h>
#include <linux/list.h>
......@@ -78,3 +81,5 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr,
int ctucan_suspend(struct device *dev) __maybe_unused;
int ctucan_resume(struct device *dev) __maybe_unused;
#endif /*__CTU_CAN_FD__*/
......@@ -32,6 +32,12 @@
#include "ctu_can_fd.h"
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Martin Jerabek");
MODULE_DESCRIPTION("CTU CAN FD for PCI bus");
#define DRV_NAME "ctucanfd_pci"
#ifndef PCI_DEVICE_DATA
#define PCI_DEVICE_DATA(vend, dev, data) \
.vendor = PCI_VENDOR_ID_##vend, \
......
......@@ -35,7 +35,11 @@
#include "ctu_can_fd.h"
#define DRIVER_NAME "ctucanfd"
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Martin Jerabek");
MODULE_DESCRIPTION("CTU CAN FD for platform");
#define DRV_NAME "ctucanfd"
static void ctucan_platform_set_drvdata(struct device *dev,
struct net_device *ndev)
......@@ -135,7 +139,7 @@ static struct platform_driver ctucanfd_driver = {
.probe = ctucan_platform_probe,
.remove = ctucan_platform_remove,
.driver = {
.name = DRIVER_NAME,
.name = DRV_NAME,
.pm = &ctucan_dev_pm_ops,
.of_match_table = ctucan_of_match,
},
......
obj-m := ctucanfd_pci.o ctucanfd_platform.o
ctucanfd_pci-y := ctu_can_fd.o ctu_can_fd_hw.o ctu_can_fd_pci.o
ctucanfd_platform-y := ctu_can_fd.o ctu_can_fd_hw.o ctu_can_fd_platform.o
obj-m := ctucanfd.o
ctucanfd-y := ctu_can_fd.o ctu_can_fd_hw.o
ifneq ($(CONFIG_PCI),)
obj-m += ctucanfd_pci.o
ctucanfd_pci-y := ctu_can_fd_pci.o
endif
ifneq ($(CONFIG_OF),)
obj-m += ctucanfd_platform.o
ctucanfd_platform-y += ctu_can_fd_platform.o
endif
......@@ -27,7 +27,9 @@ default:
$(MAKE) $(MAKEARGS) M=$$PWD
ifneq ($(INSTALL_DIR),)
-rm -f $(INSTALL_DIR)/ctucanfd.ko
-rm -f $(INSTALL_DIR)/ctucanfd_platform.ko
cp ctucanfd.ko $(INSTALL_DIR)/
cp ctucanfd_platform.ko $(INSTALL_DIR)/
endif
CTUCANF_SOURCES = ctu_can_fd.c ctu_can_fd_hw.c ctu_can_fd_frame.h ctu_can_fd_hw.h ctu_can_fd_regs.h ctu_can_fd_platform.c ctu_can_fd_pci.c
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment