I am writing a basic test driver for linux. I have implemented a basic driver_open(), driver_read(), driver_write(), and driver_release() methods in the fops structure, but I have also implemented a simple unlocked_ioctl() method (also in fops) as well.
When I test the driver using echo 'test' >> /dev/mydevice I notice the in addition to the driver_open() and driver_write() methods being called, the unlocked_ioctl() method is also being called?
Is this the expected behaviour? I would have thought unlocked_ioctl() would only have been called if this was called directly using the correct magic number and ioctl() method from a user application?