summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/uapi-test.c
Commit message (Collapse)AuthorAgeFilesLines
* firewire: fix build failure due to missing module licenseTakashi Sakamoto2023-05-301-0/+2
| | | | | | | | | | | | | The added KUnit test has no MODULE_LICENSE even if built for tristate. It brings build failure in linux-next integration. This commit releases the test under GPL and fixes the bug. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Closes: https://lore.kernel.org/lkml/20230530122450.1603af75@canb.auug.org.au/ Fixes: dc7c51638f46 ("firewire: add KUnit test to check layout of UAPI structures") Link: https://lore.kernel.org/r/20230530102532.56386-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
* firewire: cdev: add new event to notify phy packet with time stampTakashi Sakamoto2023-05-301-0/+14
| | | | | | | | | | | | | | | | | | | This commit adds new event to notify event of phy packet with time stamp field. Unlike the fw_cdev_event_request3 and fw_cdev_event_response2, the size of new structure, fw_cdev_event_phy_packet2, is multiples of 8, thus padding is not required to keep the same size between System V ABI for different architectures. It is noticeable that for the case of ping request 1394 OHCI controller does not record the isochronous cycle at which the packet was sent for the request subaction. Instead, it records round-trip count measured by hardware at 42.195 MHz resolution. Cc: kunit-dev@googlegroups.com Link: https://lore.kernel.org/r/20230529113406.986289-12-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
* firewire: cdev: add new event to notify response subaction with time stampTakashi Sakamoto2023-05-301-0/+15
| | | | | | | | | | | | | | | | | | | | This commit adds new event to notify event of response subaction with time stamp field. Current compiler implementation of System V ABI selects one of structure members which has the maximum alignment size in the structure to decide the size of structure. In the case of fw_cdev_event_request3 structure, it is closure member which has 8 byte storage. The size of alignment for the type of 8 byte storage differs depending on architectures; 4 byte for i386 architecture and 8 byte for the others including x32 architecture. It is inconvenient to device driver developer to use structure layout which varies between architectures since the developer takes care of ioctl compat layer. This commit adds 32 bit member for padding to keep the size of structure as multiples of 8. Cc: kunit-dev@googlegroups.com Link: https://lore.kernel.org/r/20230529113406.986289-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
* firewire: cdev: add new event to notify request subaction with time stampTakashi Sakamoto2023-05-301-0/+20
| | | | | | | | | | | | | | | | | | | | This commit adds new event to notify event of request subaction with time stamp field. Current compiler implementation of System V ABI selects one of structure members which has the maximum alignment size in the structure to decide the size of structure. In the case of fw_cdev_event_request3 structure, it is closure member which has 8 byte storage. The size of alignment for the type of 8 byte storage differs depending on architectures; 4 byte for i386 architecture and 8 byte for the others including x32 architecture. It is inconvenient to device driver developer to use structure layout which varies between architectures since the developer takes care of ioctl compat layer. This commit adds 32 bit member for padding to keep the size of structure as multiples of 8. Cc: kunit-dev@googlegroups.com Link: https://lore.kernel.org/r/20230529113406.986289-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
* firewire: add KUnit test to check layout of UAPI structuresTakashi Sakamoto2023-05-301-0/+38
In future commits, some new structure will be added to express new type of event. They are exposed to user space as the part of UAPI. It is likely to get trouble in ioctl compatibility layer for 32 bit binaries in 64 bit host machine since the layout of structure could differ depending on System V ABI for these architectures. Actually the subsystem already got such trouble at v2.6.27. It is preferable to decide the layout of structure carefully so that the layer is free from such trouble. This commit utilizes KUnit framework to check the layout of structure for the purpose. A test is added for the existent issue. Cc: kunit-dev@googlegroups.com Link: https://lore.kernel.org/r/20230529113406.986289-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>