Commit 74982610 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: remove function pointer typedefs from VmbusApi.h

function pointer typedefs are allowed in the kernel, but only if they
make sense, which they really do not here, as they are not passed around
with any kind of frequency.  So just spell them all out, it makes the
code smaller and easier to understand overall.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ce9ea4cf
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
static int IVmbusChannelOpen(struct hv_device *device, u32 SendBufferSize, static int IVmbusChannelOpen(struct hv_device *device, u32 SendBufferSize,
u32 RecvRingBufferSize, void *UserData, u32 RecvRingBufferSize, void *UserData,
u32 UserDataLen, u32 UserDataLen,
VMBUS_CHANNEL_CALLBACK ChannelCallback, void (*ChannelCallback)(void *context),
void *Context) void *Context)
{ {
return VmbusChannelOpen(device->context, SendBufferSize, return VmbusChannelOpen(device->context, SendBufferSize,
......
...@@ -58,72 +58,6 @@ struct hv_multipage_buffer { ...@@ -58,72 +58,6 @@ struct hv_multipage_buffer {
struct hv_driver; struct hv_driver;
struct hv_device; struct hv_device;
/* All drivers */
typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device,
void *AdditionalInfo);
typedef int (*PFN_ON_DEVICEREMOVE)(struct hv_device *Device);
typedef char** (*PFN_ON_GETDEVICEIDS)(void);
typedef void (*PFN_ON_CLEANUP)(struct hv_driver *Driver);
/* Vmbus extensions */
typedef int (*PFN_ON_ISR)(struct hv_driver *drv);
typedef void (*PFN_ON_DPC)(struct hv_driver *drv);
typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
typedef struct hv_device * (*PFN_ON_CHILDDEVICE_CREATE)
(struct hv_guid *DeviceType,
struct hv_guid *DeviceInstance,
void *Context);
typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(struct hv_device *Device);
typedef int (*PFN_ON_CHILDDEVICE_ADD)(struct hv_device *RootDevice,
struct hv_device *ChildDevice);
typedef void (*PFN_ON_CHILDDEVICE_REMOVE)(struct hv_device *Device);
/* Vmbus channel interface */
typedef void (*VMBUS_CHANNEL_CALLBACK)(void *context);
typedef int (*VMBUS_CHANNEL_OPEN)(struct hv_device *Device, u32 SendBufferSize,
u32 RecvRingBufferSize,
void *UserData,
u32 UserDataLen,
VMBUS_CHANNEL_CALLBACK ChannelCallback,
void *Context);
typedef void (*VMBUS_CHANNEL_CLOSE)(struct hv_device *Device);
typedef int (*VMBUS_CHANNEL_SEND_PACKET)(struct hv_device *Device,
const void *Buffer,
u32 BufferLen,
u64 RequestId,
u32 Type,
u32 Flags);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(struct hv_device *Device,
struct hv_page_buffer PageBuffers[],
u32 PageCount,
void *Buffer,
u32 BufferLen,
u64 RequestId);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)
(struct hv_device *Device,
struct hv_multipage_buffer *mpb,
void *Buffer,
u32 BufferLen,
u64 RequestId);
typedef int (*VMBUS_CHANNEL_RECV_PACKET)(struct hv_device *Device,
void *Buffer,
u32 BufferLen,
u32 *BufferActualLen,
u64 *RequestId);
typedef int(*VMBUS_CHANNEL_RECV_PACKET_PAW)(struct hv_device *Device,
void *Buffer,
u32 BufferLen,
u32 *BufferActualLen,
u64 *RequestId);
typedef int (*VMBUS_CHANNEL_ESTABLISH_GPADL)(struct hv_device *Device,
void *Buffer,
u32 BufferLen,
u32 *GpadlHandle);
typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)(struct hv_device *Device,
u32 GpadlHandle);
struct hv_dev_port_info { struct hv_dev_port_info {
u32 InterruptMask; u32 InterruptMask;
u32 ReadIndex; u32 ReadIndex;
...@@ -150,24 +84,33 @@ struct hv_device_info { ...@@ -150,24 +84,33 @@ struct hv_device_info {
struct hv_dev_port_info Outbound; struct hv_dev_port_info Outbound;
}; };
typedef void (*VMBUS_GET_CHANNEL_INFO)(struct hv_device *Device,
struct hv_device_info *DeviceInfo);
struct vmbus_channel_interface { struct vmbus_channel_interface {
VMBUS_CHANNEL_OPEN Open; int (*Open)(struct hv_device *Device, u32 SendBufferSize,
VMBUS_CHANNEL_CLOSE Close; u32 RecvRingBufferSize, void *UserData, u32 UserDataLen,
VMBUS_CHANNEL_SEND_PACKET SendPacket; void (*ChannelCallback)(void *context),
VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER SendPacketPageBuffer; void *Context);
VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER SendPacketMultiPageBuffer; void (*Close)(struct hv_device *device);
VMBUS_CHANNEL_RECV_PACKET RecvPacket; int (*SendPacket)(struct hv_device *Device, const void *Buffer,
VMBUS_CHANNEL_RECV_PACKET_PAW RecvPacketRaw; u32 BufferLen, u64 RequestId, u32 Type, u32 Flags);
VMBUS_CHANNEL_ESTABLISH_GPADL EstablishGpadl; int (*SendPacketPageBuffer)(struct hv_device *dev,
VMBUS_CHANNEL_TEARDOWN_GPADL TeardownGpadl; struct hv_page_buffer PageBuffers[],
VMBUS_GET_CHANNEL_INFO GetInfo; u32 PageCount, void *Buffer, u32 BufferLen,
u64 RequestId);
int (*SendPacketMultiPageBuffer)(struct hv_device *device,
struct hv_multipage_buffer *mpb,
void *Buffer,
u32 BufferLen,
u64 RequestId);
int (*RecvPacket)(struct hv_device *dev, void *buf, u32 buflen,
u32 *BufferActualLen, u64 *RequestId);
int (*RecvPacketRaw)(struct hv_device *dev, void *buf, u32 buflen,
u32 *BufferActualLen, u64 *RequestId);
int (*EstablishGpadl)(struct hv_device *dev, void *buf, u32 buflen,
u32 *GpadlHandle);
int (*TeardownGpadl)(struct hv_device *device, u32 GpadlHandle);
void (*GetInfo)(struct hv_device *dev, struct hv_device_info *devinfo);
}; };
typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(struct vmbus_channel_interface *i);
/* Base driver object */ /* Base driver object */
struct hv_driver { struct hv_driver {
const char *name; const char *name;
...@@ -175,12 +118,9 @@ struct hv_driver { ...@@ -175,12 +118,9 @@ struct hv_driver {
/* the device type supported by this driver */ /* the device type supported by this driver */
struct hv_guid deviceType; struct hv_guid deviceType;
PFN_ON_DEVICEADD OnDeviceAdd; int (*OnDeviceAdd)(struct hv_device *device, void *data);
PFN_ON_DEVICEREMOVE OnDeviceRemove; int (*OnDeviceRemove)(struct hv_device *device);
void (*OnCleanup)(struct hv_driver *driver);
/* device ids supported by this driver */
PFN_ON_GETDEVICEIDS OnGetDeviceIds;
PFN_ON_CLEANUP OnCleanup;
struct vmbus_channel_interface VmbusChannelInterface; struct vmbus_channel_interface VmbusChannelInterface;
}; };
...@@ -211,19 +151,23 @@ struct vmbus_driver { ...@@ -211,19 +151,23 @@ struct vmbus_driver {
struct hv_driver Base; struct hv_driver Base;
/* Set by the caller */ /* Set by the caller */
PFN_ON_CHILDDEVICE_CREATE OnChildDeviceCreate; struct hv_device * (*OnChildDeviceCreate)(struct hv_guid *DeviceType,
PFN_ON_CHILDDEVICE_DESTROY OnChildDeviceDestroy; struct hv_guid *DeviceInstance,
PFN_ON_CHILDDEVICE_ADD OnChildDeviceAdd; void *Context);
PFN_ON_CHILDDEVICE_REMOVE OnChildDeviceRemove; void (*OnChildDeviceDestroy)(struct hv_device *device);
int (*OnChildDeviceAdd)(struct hv_device *RootDevice,
struct hv_device *ChildDevice);
void (*OnChildDeviceRemove)(struct hv_device *device);
/* Set by the callee */ /* Set by the callee */
PFN_ON_ISR OnIsr; int (*OnIsr)(struct hv_driver *driver);
PFN_ON_DPC OnMsgDpc; void (*OnMsgDpc)(struct hv_driver *driver);
PFN_ON_DPC OnEventDpc; void (*OnEventDpc)(struct hv_driver *driver);
PFN_GET_CHANNEL_OFFERS GetChannelOffers; void (*GetChannelOffers)(void);
VMBUS_GET_CHANNEL_INTERFACE GetChannelInterface; void (*GetChannelInterface)(struct vmbus_channel_interface *i);
VMBUS_GET_CHANNEL_INFO GetChannelInfo; void (*GetChannelInfo)(struct hv_device *dev,
struct hv_device_info *devinfo);
}; };
int VmbusInitialize(struct hv_driver *drv); int VmbusInitialize(struct hv_driver *drv);
......
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