Commit 9e795a52 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by Greg Kroah-Hartman

staging: hv: Convert vmbus driver interface function pointer table to constant

Convert vmbus driver interface function pointer table to constant
The vmbus interface functions are assigned to a constant - vmbus_ops.

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.
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5fee2540
...@@ -2,8 +2,6 @@ TODO: ...@@ -2,8 +2,6 @@ TODO:
- fix remaining checkpatch warnings and errors - fix remaining checkpatch warnings and errors
- audit the vmbus to verify it is working properly with the - audit the vmbus to verify it is working properly with the
driver model 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 - see if the vmbus can be merged with the other virtual busses
in the kernel in the kernel
- audit the network driver - audit the network driver
......
...@@ -97,20 +97,6 @@ static int IVmbusChannelTeardownGpadl(struct hv_device *device, u32 GpadlHandle) ...@@ -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) 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) ...@@ -150,3 +136,18 @@ void GetChannelInfo(struct hv_device *device, struct hv_device_info *info)
info->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead; info->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead;
info->Outbound.BytesAvailToWrite = debugInfo.Outbound.BytesAvailToWrite; 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,
};
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include "vmbus_api.h" #include "vmbus_api.h"
void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface);
void GetChannelInfo(struct hv_device *Device, void GetChannelInfo(struct hv_device *Device,
struct hv_device_info *DeviceInfo); struct hv_device_info *DeviceInfo);
......
...@@ -60,14 +60,6 @@ static void VmbusGetChannelOffers(void) ...@@ -60,14 +60,6 @@ static void VmbusGetChannelOffers(void)
VmbusChannelRequestOffers(); VmbusChannelRequestOffers();
} }
/*
* 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 * VmbusGetChannelInfo - Get the device info for the specified device object
*/ */
...@@ -279,7 +271,6 @@ int VmbusInitialize(struct hv_driver *drv) ...@@ -279,7 +271,6 @@ int VmbusInitialize(struct hv_driver *drv)
driver->OnMsgDpc = VmbusOnMsgDPC; driver->OnMsgDpc = VmbusOnMsgDPC;
driver->OnEventDpc = VmbusOnEventDPC; driver->OnEventDpc = VmbusOnEventDPC;
driver->GetChannelOffers = VmbusGetChannelOffers; driver->GetChannelOffers = VmbusGetChannelOffers;
driver->GetChannelInterface = VmbusGetChannelInterface;
driver->GetChannelInfo = VmbusGetChannelInfo; driver->GetChannelInfo = VmbusGetChannelInfo;
/* Hypervisor initialization...setup hypercall page..etc */ /* Hypervisor initialization...setup hypercall page..etc */
......
...@@ -129,6 +129,9 @@ struct vmbus_channel_interface { ...@@ -129,6 +129,9 @@ struct vmbus_channel_interface {
void (*GetInfo)(struct hv_device *dev, struct hv_device_info *devinfo); void (*GetInfo)(struct hv_device *dev, struct hv_device_info *devinfo);
}; };
extern const struct vmbus_channel_interface vmbus_ops;
/* Base driver object */ /* Base driver object */
struct hv_driver { struct hv_driver {
const char *name; const char *name;
...@@ -183,7 +186,6 @@ struct vmbus_driver { ...@@ -183,7 +186,6 @@ struct vmbus_driver {
void (*OnEventDpc)(struct hv_driver *driver); void (*OnEventDpc)(struct hv_driver *driver);
void (*GetChannelOffers)(void); void (*GetChannelOffers)(void);
void (*GetChannelInterface)(struct vmbus_channel_interface *i);
void (*GetChannelInfo)(struct hv_device *dev, void (*GetChannelInfo)(struct hv_device *dev,
struct hv_device_info *devinfo); struct hv_device_info *devinfo);
}; };
......
...@@ -458,9 +458,7 @@ EXPORT_SYMBOL(vmbus_child_driver_unregister); ...@@ -458,9 +458,7 @@ EXPORT_SYMBOL(vmbus_child_driver_unregister);
*/ */
void vmbus_get_interface(struct vmbus_channel_interface *interface) void vmbus_get_interface(struct vmbus_channel_interface *interface)
{ {
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; *interface = vmbus_ops;
vmbus_drv_obj->GetChannelInterface(interface);
} }
EXPORT_SYMBOL(vmbus_get_interface); EXPORT_SYMBOL(vmbus_get_interface);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment