This is just a basic linux device driver. This will explain waitqueue in the linux device driver.
Please refer this URL for the complete tutorial of this source code. https://embetronicx.com/tutorials/linux/device-drivers/waitqueue-in-linux-device-driver-tutorial/