Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Haiyang Zhang and committed by
Greg Kroah-Hartman
9e795a52 5fee2540

+19 -31
-2
drivers/staging/hv/TODO
··· 2 2 - fix remaining checkpatch warnings and errors 3 3 - audit the vmbus to verify it is working properly with the 4 4 driver model 5 - - convert vmbus driver interface function pointer tables 6 - to constant, a.k.a vmbus_ops 7 5 - see if the vmbus can be merged with the other virtual busses 8 6 in the kernel 9 7 - audit the network driver
+15 -14
drivers/staging/hv/channel_interface.c
··· 97 97 98 98 } 99 99 100 - void GetChannelInterface(struct vmbus_channel_interface *iface) 101 - { 102 - iface->Open = IVmbusChannelOpen; 103 - iface->Close = IVmbusChannelClose; 104 - iface->SendPacket = IVmbusChannelSendPacket; 105 - iface->SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer; 106 - iface->SendPacketMultiPageBuffer = 107 - IVmbusChannelSendPacketMultiPageBuffer; 108 - iface->RecvPacket = IVmbusChannelRecvPacket; 109 - iface->RecvPacketRaw = IVmbusChannelRecvPacketRaw; 110 - iface->EstablishGpadl = IVmbusChannelEstablishGpadl; 111 - iface->TeardownGpadl = IVmbusChannelTeardownGpadl; 112 - iface->GetInfo = GetChannelInfo; 113 - } 114 100 115 101 void GetChannelInfo(struct hv_device *device, struct hv_device_info *info) 116 102 { ··· 136 150 info->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead; 137 151 info->Outbound.BytesAvailToWrite = debugInfo.Outbound.BytesAvailToWrite; 138 152 } 153 + 154 + 155 + /* vmbus interface function pointer table */ 156 + const struct vmbus_channel_interface vmbus_ops = { 157 + .Open = IVmbusChannelOpen, 158 + .Close = IVmbusChannelClose, 159 + .SendPacket = IVmbusChannelSendPacket, 160 + .SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer, 161 + .SendPacketMultiPageBuffer = IVmbusChannelSendPacketMultiPageBuffer, 162 + .RecvPacket = IVmbusChannelRecvPacket, 163 + .RecvPacketRaw = IVmbusChannelRecvPacketRaw, 164 + .EstablishGpadl = IVmbusChannelEstablishGpadl, 165 + .TeardownGpadl = IVmbusChannelTeardownGpadl, 166 + .GetInfo = GetChannelInfo, 167 + };
-2
drivers/staging/hv/channel_interface.h
··· 27 27 28 28 #include "vmbus_api.h" 29 29 30 - void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface); 31 - 32 30 void GetChannelInfo(struct hv_device *Device, 33 31 struct hv_device_info *DeviceInfo); 34 32
-9
drivers/staging/hv/vmbus.c
··· 61 61 } 62 62 63 63 /* 64 - * VmbusGetChannelInterface - Get the channel interface 65 - */ 66 - static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface) 67 - { 68 - GetChannelInterface(Interface); 69 - } 70 - 71 - /* 72 64 * VmbusGetChannelInfo - Get the device info for the specified device object 73 65 */ 74 66 static void VmbusGetChannelInfo(struct hv_device *DeviceObject, ··· 271 279 driver->OnMsgDpc = VmbusOnMsgDPC; 272 280 driver->OnEventDpc = VmbusOnEventDPC; 273 281 driver->GetChannelOffers = VmbusGetChannelOffers; 274 - driver->GetChannelInterface = VmbusGetChannelInterface; 275 282 driver->GetChannelInfo = VmbusGetChannelInfo; 276 283 277 284 /* Hypervisor initialization...setup hypercall page..etc */
+3 -1
drivers/staging/hv/vmbus_api.h
··· 129 129 void (*GetInfo)(struct hv_device *dev, struct hv_device_info *devinfo); 130 130 }; 131 131 132 + extern const struct vmbus_channel_interface vmbus_ops; 133 + 134 + 132 135 /* Base driver object */ 133 136 struct hv_driver { 134 137 const char *name; ··· 186 183 void (*OnEventDpc)(struct hv_driver *driver); 187 184 void (*GetChannelOffers)(void); 188 185 189 - void (*GetChannelInterface)(struct vmbus_channel_interface *i); 190 186 void (*GetChannelInfo)(struct hv_device *dev, 191 187 struct hv_device_info *devinfo); 192 188 };
+1 -3
drivers/staging/hv/vmbus_drv.c
··· 458 458 */ 459 459 void vmbus_get_interface(struct vmbus_channel_interface *interface) 460 460 { 461 - struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; 462 - 463 - vmbus_drv_obj->GetChannelInterface(interface); 461 + *interface = vmbus_ops; 464 462 } 465 463 EXPORT_SYMBOL(vmbus_get_interface); 466 464