diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-07 08:13:14 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-13 03:47:47 -0400 |
commit | eb5b35a560510efc6bb62f05c3c82e9596cdfafe (patch) | |
tree | 59d610352e8e0e60de0ce958149fb08dddf6ce82 /drivers/firewire/core-cdev.c | |
parent | 656b7afd40a9f2b0d6cf8ef1972681961b428558 (diff) |
firewire: core: ensure some userspace API constants match corresponding kernel API constants
The FW_ISO_ constants of the in-kernel API of firewire-core and
FW_CDEV_ISO_ constants of the userspace API of firewire-core have
nothing to do with each other --- except that the core-cdev.c
implementation relies on them having the same values.
Hence put some compile-time assertions into core-cdev.c. It's lame but
I prefer it over including the userspace API header into the kernelspace
API header and defining kernelspace API constants from userspace API
constants. Nor do I want to expose the kernelspace constants in one of
the two firewire headers that are exported to userland since this only
concerns the core-cdev.c implementation.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/core-cdev.c')
-rw-r--r-- | drivers/firewire/core-cdev.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index f7559bfeaba3..7a690c466ce9 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/bug.h> | ||
21 | #include <linux/compat.h> | 22 | #include <linux/compat.h> |
22 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
23 | #include <linux/device.h> | 24 | #include <linux/device.h> |
@@ -909,6 +910,9 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg) | |||
909 | struct fw_cdev_create_iso_context *a = &arg->create_iso_context; | 910 | struct fw_cdev_create_iso_context *a = &arg->create_iso_context; |
910 | struct fw_iso_context *context; | 911 | struct fw_iso_context *context; |
911 | 912 | ||
913 | BUILD_BUG_ON(FW_CDEV_ISO_CONTEXT_TRANSMIT != FW_ISO_CONTEXT_TRANSMIT || | ||
914 | FW_CDEV_ISO_CONTEXT_RECEIVE != FW_ISO_CONTEXT_RECEIVE); | ||
915 | |||
912 | if (a->channel > 63) | 916 | if (a->channel > 63) |
913 | return -EINVAL; | 917 | return -EINVAL; |
914 | 918 | ||
@@ -1060,6 +1064,13 @@ static int ioctl_start_iso(struct client *client, union ioctl_arg *arg) | |||
1060 | { | 1064 | { |
1061 | struct fw_cdev_start_iso *a = &arg->start_iso; | 1065 | struct fw_cdev_start_iso *a = &arg->start_iso; |
1062 | 1066 | ||
1067 | BUILD_BUG_ON( | ||
1068 | FW_CDEV_ISO_CONTEXT_MATCH_TAG0 != FW_ISO_CONTEXT_MATCH_TAG0 || | ||
1069 | FW_CDEV_ISO_CONTEXT_MATCH_TAG1 != FW_ISO_CONTEXT_MATCH_TAG1 || | ||
1070 | FW_CDEV_ISO_CONTEXT_MATCH_TAG2 != FW_ISO_CONTEXT_MATCH_TAG2 || | ||
1071 | FW_CDEV_ISO_CONTEXT_MATCH_TAG3 != FW_ISO_CONTEXT_MATCH_TAG3 || | ||
1072 | FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS != FW_ISO_CONTEXT_MATCH_ALL_TAGS); | ||
1073 | |||
1063 | if (client->iso_context == NULL || a->handle != 0) | 1074 | if (client->iso_context == NULL || a->handle != 0) |
1064 | return -EINVAL; | 1075 | return -EINVAL; |
1065 | 1076 | ||