* [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant
@ 2010-09-08 20:29 Haiyang Zhang
2010-09-08 22:44 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Haiyang Zhang @ 2010-09-08 20:29 UTC (permalink / raw)
To: 'linux-kernel@vger.kernel.org',
'devel@driverdev.osuosl.org',
'virtualization@lists.osdl.org', 'gregkh@suse.de'
Cc: Hank Janssen
From: Haiyang Zhang <haiyangz@microsoft.com>
Convert vmbus driver interface function pointer table to constant
The vmbus interface functions are assigned to a constant - vmbus_ops.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/TODO | 2 --
drivers/staging/hv/channel_interface.c | 29 +++++++++++++++--------------
drivers/staging/hv/channel_interface.h | 2 --
drivers/staging/hv/vmbus.c | 9 ---------
drivers/staging/hv/vmbus_api.h | 4 +++-
drivers/staging/hv/vmbus_drv.c | 4 +---
6 files changed, 19 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/hv/TODO b/drivers/staging/hv/TODO
index 66a89c8..582fd4a 100644
--- a/drivers/staging/hv/TODO
+++ b/drivers/staging/hv/TODO
@@ -2,8 +2,6 @@ TODO:
- fix remaining checkpatch warnings and errors
- audit the vmbus to verify it is working properly with the
driver model
- - convert vmbus driver interface function pointer tables
- to constant, a.k.a vmbus_ops
- see if the vmbus can be merged with the other virtual busses
in the kernel
- audit the network driver
diff --git a/drivers/staging/hv/channel_interface.c b/drivers/staging/hv/channel_interface.c
index d9f51ac..3f6a1cb 100644
--- a/drivers/staging/hv/channel_interface.c
+++ b/drivers/staging/hv/channel_interface.c
@@ -97,20 +97,6 @@ static int IVmbusChannelTeardownGpadl(struct hv_device *device, u32 GpadlHandle)
}
-void GetChannelInterface(struct vmbus_channel_interface *iface)
-{
- iface->Open = IVmbusChannelOpen;
- iface->Close = IVmbusChannelClose;
- iface->SendPacket = IVmbusChannelSendPacket;
- iface->SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer;
- iface->SendPacketMultiPageBuffer =
- IVmbusChannelSendPacketMultiPageBuffer;
- iface->RecvPacket = IVmbusChannelRecvPacket;
- iface->RecvPacketRaw = IVmbusChannelRecvPacketRaw;
- iface->EstablishGpadl = IVmbusChannelEstablishGpadl;
- iface->TeardownGpadl = IVmbusChannelTeardownGpadl;
- iface->GetInfo = GetChannelInfo;
-}
void GetChannelInfo(struct hv_device *device, struct hv_device_info *info)
{
@@ -150,3 +136,18 @@ void GetChannelInfo(struct hv_device *device, struct hv_device_info *info)
info->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead;
info->Outbound.BytesAvailToWrite = debugInfo.Outbound.BytesAvailToWrite;
}
+
+
+/* vmbus interface function pointer table */
+const struct vmbus_channel_interface vmbus_ops = {
+ .Open = IVmbusChannelOpen,
+ .Close = IVmbusChannelClose,
+ .SendPacket = IVmbusChannelSendPacket,
+ .SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer,
+ .SendPacketMultiPageBuffer = IVmbusChannelSendPacketMultiPageBuffer,
+ .RecvPacket = IVmbusChannelRecvPacket,
+ .RecvPacketRaw = IVmbusChannelRecvPacketRaw,
+ .EstablishGpadl = IVmbusChannelEstablishGpadl,
+ .TeardownGpadl = IVmbusChannelTeardownGpadl,
+ .GetInfo = GetChannelInfo,
+};
diff --git a/drivers/staging/hv/channel_interface.h b/drivers/staging/hv/channel_interface.h
index 6acaf6c..ec88219 100644
--- a/drivers/staging/hv/channel_interface.h
+++ b/drivers/staging/hv/channel_interface.h
@@ -27,8 +27,6 @@
#include "vmbus_api.h"
-void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface);
-
void GetChannelInfo(struct hv_device *Device,
struct hv_device_info *DeviceInfo);
diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c
index ca1e18a..db2afa3 100644
--- a/drivers/staging/hv/vmbus.c
+++ b/drivers/staging/hv/vmbus.c
@@ -61,14 +61,6 @@ static void VmbusGetChannelOffers(void)
}
/*
- * VmbusGetChannelInterface - Get the channel interface
- */
-static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface)
-{
- GetChannelInterface(Interface);
-}
-
-/*
* VmbusGetChannelInfo - Get the device info for the specified device object
*/
static void VmbusGetChannelInfo(struct hv_device *DeviceObject,
@@ -279,7 +271,6 @@ int VmbusInitialize(struct hv_driver *drv)
driver->OnMsgDpc = VmbusOnMsgDPC;
driver->OnEventDpc = VmbusOnEventDPC;
driver->GetChannelOffers = VmbusGetChannelOffers;
- driver->GetChannelInterface = VmbusGetChannelInterface;
driver->GetChannelInfo = VmbusGetChannelInfo;
/* Hypervisor initialization...setup hypercall page..etc */
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 4275be3..7f3d7dc 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -129,6 +129,9 @@ struct vmbus_channel_interface {
void (*GetInfo)(struct hv_device *dev, struct hv_device_info *devinfo);
};
+extern const struct vmbus_channel_interface vmbus_ops;
+
+
/* Base driver object */
struct hv_driver {
const char *name;
@@ -183,7 +186,6 @@ struct vmbus_driver {
void (*OnEventDpc)(struct hv_driver *driver);
void (*GetChannelOffers)(void);
- void (*GetChannelInterface)(struct vmbus_channel_interface *i);
void (*GetChannelInfo)(struct hv_device *dev,
struct hv_device_info *devinfo);
};
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 092f02e..ad29887 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -458,9 +458,7 @@ EXPORT_SYMBOL(vmbus_child_driver_unregister);
*/
void vmbus_get_interface(struct vmbus_channel_interface *interface)
{
- struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
-
- vmbus_drv_obj->GetChannelInterface(interface);
+ *interface = vmbus_ops;
}
EXPORT_SYMBOL(vmbus_get_interface);
--
1.6.3.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant
2010-09-08 20:29 [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant Haiyang Zhang
@ 2010-09-08 22:44 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2010-09-08 22:44 UTC (permalink / raw)
To: Haiyang Zhang
Cc: 'linux-kernel@vger.kernel.org',
'devel@driverdev.osuosl.org',
'virtualization@lists.osdl.org',
Hank Janssen
On Wed, Sep 08, 2010 at 08:29:45PM +0000, Haiyang Zhang wrote:
> From: Haiyang Zhang <haiyangz@microsoft.com>
>
> Convert vmbus driver interface function pointer table to constant
> The vmbus interface functions are assigned to a constant - vmbus_ops.
You also remove a function pointer in this patch, why? Please break up
the patch into logical parts, one patch, one thing.
This looks like it should be 2 patches, right?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant
2010-09-09 14:53 Haiyang Zhang
@ 2010-09-14 23:26 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2010-09-14 23:26 UTC (permalink / raw)
To: Haiyang Zhang
Cc: Greg KH, 'devel@driverdev.osuosl.org',
'virtualization@lists.osdl.org',
'linux-kernel@vger.kernel.org'
On Thu, Sep 09, 2010 at 02:53:03PM +0000, Haiyang Zhang wrote:
> > From: Greg KH [mailto:gregkh@suse.de]
> > Sent: Wednesday, September 08, 2010 6:44 PM
> > > Convert vmbus driver interface function pointer table to constant
> > > The vmbus interface functions are assigned to a constant - vmbus_ops.
> >
> > You also remove a function pointer in this patch, why? Please break up
> > the patch into logical parts, one patch, one thing.
> >
> > This looks like it should be 2 patches, right?
>
> Because the vmbus interface function pointer table is converted to a
> constant variable -- vmbus_ops, the function GetChannelInterface(),
> VmbusGetChannelInterface() and pointer GetChannelInterface are no longer
> in use. The deprecated function's work is done by the initialization of
> the newly added constant variable vmbus_ops.
>
> I created the new constant variable vmbus_ops and removed the deprecated
> function pointer GetChannelInterface in one patch.
Great, next time say that in the patch please :)
I'll go edit the wording and apply this...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant
@ 2010-09-09 14:53 Haiyang Zhang
2010-09-14 23:26 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Haiyang Zhang @ 2010-09-09 14:53 UTC (permalink / raw)
To: Greg KH
Cc: 'linux-kernel@vger.kernel.org',
'devel@driverdev.osuosl.org',
'virtualization@lists.osdl.org',
Hank Janssen
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Wednesday, September 08, 2010 6:44 PM
> > Convert vmbus driver interface function pointer table to constant
> > The vmbus interface functions are assigned to a constant - vmbus_ops.
>
> You also remove a function pointer in this patch, why? Please break up
> the patch into logical parts, one patch, one thing.
>
> This looks like it should be 2 patches, right?
Because the vmbus interface function pointer table is converted to a
constant variable -- vmbus_ops, the function GetChannelInterface(),
VmbusGetChannelInterface() and pointer GetChannelInterface are no longer
in use. The deprecated function's work is done by the initialization of
the newly added constant variable vmbus_ops.
I created the new constant variable vmbus_ops and removed the deprecated
function pointer GetChannelInterface in one patch.
Thanks,
- Haiyang
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant
@ 2010-09-08 20:29 Haiyang Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Haiyang Zhang @ 2010-09-08 20:29 UTC (permalink / raw)
To: 'linux-kernel@vger.kernel.org',
'devel@driverdev.osuosl.org',
'virtualization@lists.osdl.org'
From: Haiyang Zhang <haiyangz@microsoft.com>
Convert vmbus driver interface function pointer table to constant
The vmbus interface functions are assigned to a constant - vmbus_ops.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/TODO | 2 --
drivers/staging/hv/channel_interface.c | 29 +++++++++++++++--------------
drivers/staging/hv/channel_interface.h | 2 --
drivers/staging/hv/vmbus.c | 9 ---------
drivers/staging/hv/vmbus_api.h | 4 +++-
drivers/staging/hv/vmbus_drv.c | 4 +---
6 files changed, 19 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/hv/TODO b/drivers/staging/hv/TODO
index 66a89c8..582fd4a 100644
--- a/drivers/staging/hv/TODO
+++ b/drivers/staging/hv/TODO
@@ -2,8 +2,6 @@ TODO:
- fix remaining checkpatch warnings and errors
- audit the vmbus to verify it is working properly with the
driver model
- - convert vmbus driver interface function pointer tables
- to constant, a.k.a vmbus_ops
- see if the vmbus can be merged with the other virtual busses
in the kernel
- audit the network driver
diff --git a/drivers/staging/hv/channel_interface.c b/drivers/staging/hv/channel_interface.c
index d9f51ac..3f6a1cb 100644
--- a/drivers/staging/hv/channel_interface.c
+++ b/drivers/staging/hv/channel_interface.c
@@ -97,20 +97,6 @@ static int IVmbusChannelTeardownGpadl(struct hv_device *device, u32 GpadlHandle)
}
-void GetChannelInterface(struct vmbus_channel_interface *iface)
-{
- iface->Open = IVmbusChannelOpen;
- iface->Close = IVmbusChannelClose;
- iface->SendPacket = IVmbusChannelSendPacket;
- iface->SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer;
- iface->SendPacketMultiPageBuffer =
- IVmbusChannelSendPacketMultiPageBuffer;
- iface->RecvPacket = IVmbusChannelRecvPacket;
- iface->RecvPacketRaw = IVmbusChannelRecvPacketRaw;
- iface->EstablishGpadl = IVmbusChannelEstablishGpadl;
- iface->TeardownGpadl = IVmbusChannelTeardownGpadl;
- iface->GetInfo = GetChannelInfo;
-}
void GetChannelInfo(struct hv_device *device, struct hv_device_info *info)
{
@@ -150,3 +136,18 @@ void GetChannelInfo(struct hv_device *device, struct hv_device_info *info)
info->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead;
info->Outbound.BytesAvailToWrite = debugInfo.Outbound.BytesAvailToWrite;
}
+
+
+/* vmbus interface function pointer table */
+const struct vmbus_channel_interface vmbus_ops = {
+ .Open = IVmbusChannelOpen,
+ .Close = IVmbusChannelClose,
+ .SendPacket = IVmbusChannelSendPacket,
+ .SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer,
+ .SendPacketMultiPageBuffer = IVmbusChannelSendPacketMultiPageBuffer,
+ .RecvPacket = IVmbusChannelRecvPacket,
+ .RecvPacketRaw = IVmbusChannelRecvPacketRaw,
+ .EstablishGpadl = IVmbusChannelEstablishGpadl,
+ .TeardownGpadl = IVmbusChannelTeardownGpadl,
+ .GetInfo = GetChannelInfo,
+};
diff --git a/drivers/staging/hv/channel_interface.h b/drivers/staging/hv/channel_interface.h
index 6acaf6c..ec88219 100644
--- a/drivers/staging/hv/channel_interface.h
+++ b/drivers/staging/hv/channel_interface.h
@@ -27,8 +27,6 @@
#include "vmbus_api.h"
-void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface);
-
void GetChannelInfo(struct hv_device *Device,
struct hv_device_info *DeviceInfo);
diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c
index ca1e18a..db2afa3 100644
--- a/drivers/staging/hv/vmbus.c
+++ b/drivers/staging/hv/vmbus.c
@@ -61,14 +61,6 @@ static void VmbusGetChannelOffers(void)
}
/*
- * VmbusGetChannelInterface - Get the channel interface
- */
-static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface)
-{
- GetChannelInterface(Interface);
-}
-
-/*
* VmbusGetChannelInfo - Get the device info for the specified device object
*/
static void VmbusGetChannelInfo(struct hv_device *DeviceObject,
@@ -279,7 +271,6 @@ int VmbusInitialize(struct hv_driver *drv)
driver->OnMsgDpc = VmbusOnMsgDPC;
driver->OnEventDpc = VmbusOnEventDPC;
driver->GetChannelOffers = VmbusGetChannelOffers;
- driver->GetChannelInterface = VmbusGetChannelInterface;
driver->GetChannelInfo = VmbusGetChannelInfo;
/* Hypervisor initialization...setup hypercall page..etc */
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 4275be3..7f3d7dc 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -129,6 +129,9 @@ struct vmbus_channel_interface {
void (*GetInfo)(struct hv_device *dev, struct hv_device_info *devinfo);
};
+extern const struct vmbus_channel_interface vmbus_ops;
+
+
/* Base driver object */
struct hv_driver {
const char *name;
@@ -183,7 +186,6 @@ struct vmbus_driver {
void (*OnEventDpc)(struct hv_driver *driver);
void (*GetChannelOffers)(void);
- void (*GetChannelInterface)(struct vmbus_channel_interface *i);
void (*GetChannelInfo)(struct hv_device *dev,
struct hv_device_info *devinfo);
};
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 092f02e..ad29887 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -458,9 +458,7 @@ EXPORT_SYMBOL(vmbus_child_driver_unregister);
*/
void vmbus_get_interface(struct vmbus_channel_interface *interface)
{
- struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
-
- vmbus_drv_obj->GetChannelInterface(interface);
+ *interface = vmbus_ops;
}
EXPORT_SYMBOL(vmbus_get_interface);
--
1.6.3.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-14 23:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08 20:29 [PATCH 1/1] staging: hv: Convert vmbus driver interface function pointer table to constant Haiyang Zhang
2010-09-08 22:44 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2010-09-09 14:53 Haiyang Zhang
2010-09-14 23:26 ` Greg KH
2010-09-08 20:29 Haiyang Zhang
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.