diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2014-05-30 11:35:54 -0600 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2014-05-30 11:35:54 -0600 |
commit | b13460b92093b29347e99d6c3242e350052b62cd (patch) | |
tree | 53950c28dd2468d9a6654edc1c4e837c9b33c391 /include/linux/vfio.h | |
parent | c8dbca165bb090f926996a572ea2b5b577b34b70 (diff) | |
download | linux-b13460b92093b29347e99d6c3242e350052b62cd.tar.gz linux-b13460b92093b29347e99d6c3242e350052b62cd.tar.bz2 linux-b13460b92093b29347e99d6c3242e350052b62cd.zip |
drivers/vfio: Rework offsetofend()
The macro offsetofend() introduces unnecessary temporary variable
"tmp". The patch avoids that and saves a bit memory in stack.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux/vfio.h')
-rw-r--r-- | include/linux/vfio.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h index 81022a52bc34..8ec980b5e3af 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -86,9 +86,8 @@ extern void vfio_unregister_iommu_driver( * from user space. This allows us to easily determine if the provided * structure is sized to include various fields. */ -#define offsetofend(TYPE, MEMBER) ({ \ - TYPE tmp; \ - offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \ +#define offsetofend(TYPE, MEMBER) \ + (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER)) /* * External user API |