As you say, the device matching doesn't work properly, and doesn't allow you to use more than one of these encoders at once.
What you need to do is to match against Device Tree entries. This is a subject too big for a single answer, but thankfully there's a good introduction to Device Trees on the Raspberry Pi site that shows how to create DT overlays.
For the kernel side of things, the best advice is to crib from existing modules that match against DT entries. Look for the users of the MODULE_DEVICE_TABLE
macro (ignore the fact that the search tool's parser misclassifies the usage as being a prototype). You're interested in the invocations where the first argument is of
files that contain of_device_id
(i.e. OpenFirmwareOpenFirmware device identifier) for examples of how to match specific devices.