All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drivers/vfio: Rework offsetofend()
@ 2014-03-03  3:24 Gavin Shan
  2014-03-03  3:24 ` [PATCH 2/3] drivers/vfio/pci: Fix wrong MSI interrupt count Gavin Shan
  2014-03-03  3:24 ` [PATCH 3/3] drivers/vfio/pci: Fix MSIx message lost Gavin Shan
  0 siblings, 2 replies; 16+ messages in thread
From: Gavin Shan @ 2014-03-03  3:24 UTC (permalink / raw)
  To: kvm; +Cc: alex.williamson, benh, aik, Gavin Shan

The macro offsetofend() introduces unnecessary temporary variable
"tmp". The patch avoids that and saves a bit memory in stack.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 include/linux/vfio.h |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 24579a0..43f6bf4 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
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH 0/3] VFIO Bug Fixes
@ 2014-03-10  5:46 Gavin Shan
  2014-03-10  5:46 ` [PATCH 3/3] drivers/vfio/pci: Fix MSIx message lost Gavin Shan
  0 siblings, 1 reply; 16+ messages in thread
From: Gavin Shan @ 2014-03-10  5:46 UTC (permalink / raw)
  To: alex.williamson; +Cc: kvm, benh, aik, Gavin Shan

v1 -> v2:
	* Don't change the name of variable "flags" in [PATCH 2/3].
	* Comment and commit log cleanup in [PATCH 3/3].

Gavin Shan (3):
  drivers/vfio: Rework offsetofend()
  drivers/vfio/pci: Fix wrong MSI interrupt count
  drivers/vfio/pci: Fix MSIx message lost

---

 drivers/vfio/pci/vfio_pci.c       |    3 +--
 drivers/vfio/pci/vfio_pci_intrs.c |   11 +++++++++++
 include/linux/vfio.h              |    5 ++---
 3 files changed, 14 insertions(+), 5 deletions(-)

Thanks,
Gavin


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-04-02  1:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-03  3:24 [PATCH 1/3] drivers/vfio: Rework offsetofend() Gavin Shan
2014-03-03  3:24 ` [PATCH 2/3] drivers/vfio/pci: Fix wrong MSI interrupt count Gavin Shan
2014-03-03  4:17   ` Alex Williamson
2014-03-03  3:24 ` [PATCH 3/3] drivers/vfio/pci: Fix MSIx message lost Gavin Shan
2014-03-03  3:51   ` Benjamin Herrenschmidt
2014-03-03  4:43     ` Alexey Kardashevskiy
2014-03-03  5:00       ` Benjamin Herrenschmidt
2014-03-03  4:49     ` Alex Williamson
2014-03-03  5:05       ` Benjamin Herrenschmidt
     [not found]       ` <20140303061036.GA4447@shangw.(null)>
2014-03-03 19:36         ` Alex Williamson
     [not found]           ` <20140304023018.GA21672@shangw.(null)>
2014-03-04 20:45             ` Alex Williamson
  -- strict thread matches above, loose matches on Subject: below --
2014-03-10  5:46 [PATCH 0/3] VFIO Bug Fixes Gavin Shan
2014-03-10  5:46 ` [PATCH 3/3] drivers/vfio/pci: Fix MSIx message lost Gavin Shan
2014-03-17 22:16   ` Alex Williamson
     [not found]     ` <20140318013238.GA9843@shangw.(null)>
2014-03-18 22:44       ` Alex Williamson
2014-04-02  1:16   ` Alexey Kardashevskiy
2014-04-02  1:36     ` Alex Williamson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.