Trying to add in-tree kernel driver but it doesn't show up in modules.builtin

Hi.

I would interpret from that that the duplicate symbol would be usb_wwan_chars_in_buffer, but then again, at this point I’m not one to trust error messages that much. Are you suggesting that we don’t know if that is the exported symbol, if there could be multiple duplicate exported symbols not mentioned, or if that usb_wwan_chars_in_buffer doesn’t mean anything at all and could be any symbol?

I’m asking this because, you asked if I was certain if the driver did not already exist. I’ve asked myself this as well, as it’s not obvious to me that the driver I attached in the first post (sim8200_wwan.c) is supposed to replace qmi_wwan.c or if it’s suppose to be an independent module. Running a diff check on both files, the similarities are obvious. But the fact that, in the implementation of the sim8200 driver, they remove all devices from the device table and only leave the SIM8200 module (the following snipper):

static const struct usb_device_id products[] = {
	{QMI_FIXED_RAWIP_INTF(0x1e0e, 0x9001, 5)},  /* SIMCOM 8200 */
	{ }					/* END */
};
MODULE_DEVICE_TABLE(usb, products);

And in my head, there’s no reason to remove all other usb_devices from there, other than assuming this is being implemented independently from the original qmi_wwan, thus having those usb_devices, plus the one in the sim8200 driver. With that said, while both drivers do not export any symbol (at least that I can tell), they both have same dependencies, or at least they share usb_wwan as one.
I think that, because they’re both loading that dependency, it’s being loaded twice (I don’t know why it wouldn’t know it’s already loaded), and exporting a duplicate symbol of that dependency (usb_wwan).

Hopefully this made sense to you.

I mean, at this point I could try to merge qmi_wwan.c and sim8200_wwan.c but it wraps back to what we’ve discussed back in the other thread. It could lead to problems down the road when that module has to be updated.

I am simply following these instructions provided by SIMCOM, to use with their module. I understand what you mean and I don’t think the default source code already has a driver for this.
Back in the end of 2020, my company was having the same struggle to add a driver for their 4G modem (sim7600), which would not work without the driver, so I’m going based on that. I’ve also attached that driver on the first post (sim7500_sim7600_wwan-noprobewarning.c) and that driver is loaded separately and worked fine since we’ve been able to successfully added it as a module to the source code.

I can’t say I’m certain of that, but I’m going both on our past experience with the sim7600 driver (that we added the module to the source code), and the instructions provided by SIMCOM for this driver. While these instructions don’t ask to implement the driver directly in the source code, I’m working around that problem we discussed in this thread, where “modprobing” their provided driver yielded exec format error.

I understand I’m working under a lot of assumptions, but otherwise it gets a little overwhelming. I’m going to try to be sure there’s not already a driver in the source code capable of handling this modem to be sure that the sim8200 driver is indeed to be added to the source code.

Do please answer me this.
Is it possible that say, 2 modules have the same dependency, the first module loads (and it’s dependency). Somehow the kernel doesn’t know the dependency is loaded, so when we load the second module, it tries to install the dependency again, and if that dependency exported any symbols, they would be duplicate (thus an error like that one we’ve seen would probably happen, I’m guessing).

Is this scenario possible?