I am very new to device driver implementation and I am doing it on Linux. I read that IO ports can be requested for a device using request_region. Depending on the architecture, it can be memory mapped or IO mapped IO.
But how does the corresponding hardware device know the IO ports or memory regions that are assigned to driver by the kernel?

Please bear with this basic doubt and ur reply would greatly help my understanding