The installed read/write functions for SMH_BANK(1) and SMH_BANK(2) never appear to change, though, so it might be a good idea to move
line 42 and
line 45 to a DRIVER_INIT function. There are plenty of examples of how to use DRIVER_INIT in various drivers.