Operating systems differ in how they link a device to its driver.
In Windows, the link is performed by the INF file, which registers the device
to work with the driver. This association is performed before the
DriverEntry routine is called. The operating system recognizes the
device, looks up in its database which INF file is associated with the device,
and according to the INF file, calls the driver's entry point.
In Linux, the link between a device and its driver is defined in the
init_module routine. The init_module routine
includes a callback which states what hardware the driver is designated to
handle. The operating system calls the driver's entry point, based on the
definition in the code.