From 09d50ff8a233a39e8697e776b06cf5be2de48bb1 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@suse.de>
Date: Mon, 13 Jul 2009 17:09:34 -0700
Subject: [PATCH] Staging: hv: make the Hyper-V virtual bus code build

The #define KERNEL_2_6_27 needs to be set, and I adjusted the include
directories a bit to get things to build properly.

I also fixed up the direct access of bus_id, as that field is now gone.

The hv_vmbus code should now build properly, with no errors.

Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/hv/Channel.c                 |  4 ++--
 drivers/staging/hv/Channel.h                 |  2 +-
 drivers/staging/hv/ChannelInterface.h        |  2 +-
 drivers/staging/hv/ChannelMgmt.c             |  4 ++--
 drivers/staging/hv/ChannelMgmt.h             |  8 ++++----
 drivers/staging/hv/Connection.c              |  2 +-
 drivers/staging/hv/Hv.c                      |  2 +-
 drivers/staging/hv/Hv.h                      | 16 ++++++++--------
 drivers/staging/hv/RingBuffer.c              |  2 +-
 drivers/staging/hv/RingBuffer.h              |  2 +-
 drivers/staging/hv/Sources.c                 |  1 +
 drivers/staging/hv/Vmbus.c                   |  2 +-
 drivers/staging/hv/VmbusPrivate.h            |  4 ++--
 drivers/staging/hv/include/ChannelMessages.h |  2 +-
 drivers/staging/hv/osd.c                     |  3 ++-
 drivers/staging/hv/vmbus_drv.c               | 15 ++++++++-------
 16 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c
index 0b78604c40bcb..45b8c1b3d2234 100644
--- a/drivers/staging/hv/Channel.c
+++ b/drivers/staging/hv/Channel.c
@@ -22,8 +22,8 @@
  */
 
 
-#include "osd.h"
-#include "logging.h"
+#include "include/osd.h"
+#include "include/logging.h"
 
 #include "VmbusPrivate.h"
 
diff --git a/drivers/staging/hv/Channel.h b/drivers/staging/hv/Channel.h
index 117b2e1bb7c9e..6fa49ce096398 100644
--- a/drivers/staging/hv/Channel.h
+++ b/drivers/staging/hv/Channel.h
@@ -25,7 +25,7 @@
 #ifndef _CHANNEL_H_
 #define _CHANNEL_H_
 
-#include "osd.h"
+#include "include/osd.h"
 #include "ChannelMgmt.h"
 
 #pragma pack(push,1)
diff --git a/drivers/staging/hv/ChannelInterface.h b/drivers/staging/hv/ChannelInterface.h
index 8f5a4a9926971..b9d0446106757 100644
--- a/drivers/staging/hv/ChannelInterface.h
+++ b/drivers/staging/hv/ChannelInterface.h
@@ -25,7 +25,7 @@
 #ifndef _CHANNEL_INTERFACE_H_
 #define _CHANNEL_INTERFACE_H_
 
-#include "VmbusApi.h"
+#include "include/VmbusApi.h"
 
 INTERNAL void
 GetChannelInterface(
diff --git a/drivers/staging/hv/ChannelMgmt.c b/drivers/staging/hv/ChannelMgmt.c
index c058d53321c1f..59c772f1770f1 100644
--- a/drivers/staging/hv/ChannelMgmt.c
+++ b/drivers/staging/hv/ChannelMgmt.c
@@ -22,8 +22,8 @@
  */
 
 
-#include "osd.h"
-#include "logging.h"
+#include "include/osd.h"
+#include "include/logging.h"
 
 #include "VmbusPrivate.h"
 
diff --git a/drivers/staging/hv/ChannelMgmt.h b/drivers/staging/hv/ChannelMgmt.h
index d5ba5d135949e..a8223d0d2456d 100644
--- a/drivers/staging/hv/ChannelMgmt.h
+++ b/drivers/staging/hv/ChannelMgmt.h
@@ -25,12 +25,12 @@
 #ifndef _CHANNEL_MGMT_H_
 #define _CHANNEL_MGMT_H_
 
-#include "osd.h"
-#include "List.h"
+#include "include/osd.h"
+#include "include/List.h"
 #include "RingBuffer.h"
 
-#include "VmbusChannelInterface.h"
-#include "ChannelMessages.h"
+#include "include/VmbusChannelInterface.h"
+#include "include/ChannelMessages.h"
 
 
 
diff --git a/drivers/staging/hv/Connection.c b/drivers/staging/hv/Connection.c
index fba195aa4b9a2..c60ff8e941611 100644
--- a/drivers/staging/hv/Connection.c
+++ b/drivers/staging/hv/Connection.c
@@ -22,7 +22,7 @@
  */
 
 
-#include "logging.h"
+#include "include/logging.h"
 
 #include "VmbusPrivate.h"
 
diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
index 7aec8c94b2eb1..093210713469e 100644
--- a/drivers/staging/hv/Hv.c
+++ b/drivers/staging/hv/Hv.c
@@ -22,7 +22,7 @@
  */
 
 
-#include "logging.h"
+#include "include/logging.h"
 #include "VmbusPrivate.h"
 
 //
diff --git a/drivers/staging/hv/Hv.h b/drivers/staging/hv/Hv.h
index cbc77d2d086a4..beb3b28e793d2 100644
--- a/drivers/staging/hv/Hv.h
+++ b/drivers/staging/hv/Hv.h
@@ -25,23 +25,23 @@
 #ifndef __HV_H__
 #define __HV_H__
 
-#include "osd.h"
+#include "include/osd.h"
 
-#include "HvTypes.h"
-#include "HvStatus.h"
+#include "include/HvTypes.h"
+#include "include/HvStatus.h"
 //#include "HvVmApi.h"
 //#include "HvKeApi.h"
 //#include "HvMmApi.h"
 //#include "HvCpuApi.h"
-#include "HvHalApi.h"
-#include "HvVpApi.h"
+#include "include/HvHalApi.h"
+#include "include/HvVpApi.h"
 //#include "HvTrApi.h"
-#include "HvSynicApi.h"
+#include "include/HvSynicApi.h"
 //#include "HvAmApi.h"
 //#include "HvHkApi.h"
 //#include "HvValApi.h"
-#include "HvHcApi.h"
-#include "HvPtApi.h"
+#include "include/HvHcApi.h"
+#include "include/HvPtApi.h"
 
 enum
 {
diff --git a/drivers/staging/hv/RingBuffer.c b/drivers/staging/hv/RingBuffer.c
index 57d944e883be1..31db6f96c525e 100644
--- a/drivers/staging/hv/RingBuffer.c
+++ b/drivers/staging/hv/RingBuffer.c
@@ -22,7 +22,7 @@
  */
 
 
-#include "logging.h"
+#include "include/logging.h"
 #include "RingBuffer.h"
 
 //
diff --git a/drivers/staging/hv/RingBuffer.h b/drivers/staging/hv/RingBuffer.h
index 9af5df006e37a..99d75c305bc67 100644
--- a/drivers/staging/hv/RingBuffer.h
+++ b/drivers/staging/hv/RingBuffer.h
@@ -25,7 +25,7 @@
 #ifndef _RING_BUFFER_H_
 #define _RING_BUFFER_H_
 
-#include "osd.h"
+#include "include/osd.h"
 
 typedef struct _SG_BUFFER_LIST {
 	PVOID	Data;
diff --git a/drivers/staging/hv/Sources.c b/drivers/staging/hv/Sources.c
index bc154642be763..573700f58d262 100644
--- a/drivers/staging/hv/Sources.c
+++ b/drivers/staging/hv/Sources.c
@@ -21,6 +21,7 @@
  *
  */
 
+#define KERNEL_2_6_27
 
 #include "Vmbus.c"
 #include "Hv.c"
diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c
index 54a120dc05568..ace782471acfc 100644
--- a/drivers/staging/hv/Vmbus.c
+++ b/drivers/staging/hv/Vmbus.c
@@ -22,7 +22,7 @@
  */
 
 
-#include "logging.h"
+#include "include/logging.h"
 #include "VersionInfo.h"
 #include "VmbusPrivate.h"
 
diff --git a/drivers/staging/hv/VmbusPrivate.h b/drivers/staging/hv/VmbusPrivate.h
index 5e86165dea287..9027c8cf70cd9 100644
--- a/drivers/staging/hv/VmbusPrivate.h
+++ b/drivers/staging/hv/VmbusPrivate.h
@@ -30,14 +30,14 @@
 #endif
 
 #include "Hv.h"
-#include "VmbusApi.h"
+#include "include/VmbusApi.h"
 #include "Channel.h"
 #include "ChannelMgmt.h"
 #include "ChannelInterface.h"
 //#include "ChannelMessages.h"
 #include "RingBuffer.h"
 //#include "Packet.h"
-#include "List.h"
+#include "include/List.h"
 
 //
 // Defines
diff --git a/drivers/staging/hv/include/ChannelMessages.h b/drivers/staging/hv/include/ChannelMessages.h
index bd2159bdc2cfc..27a88ea6df5e5 100644
--- a/drivers/staging/hv/include/ChannelMessages.h
+++ b/drivers/staging/hv/include/ChannelMessages.h
@@ -24,7 +24,7 @@
 
 #pragma once
 
-#include <VmbusPacketFormat.h>
+#include "VmbusPacketFormat.h"
 
 #define C_ASSERT(x)
 typedef UINT32 NTSTATUS;
diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c
index 83885252049f9..bfb2c8e97d75b 100644
--- a/drivers/staging/hv/osd.c
+++ b/drivers/staging/hv/osd.c
@@ -21,6 +21,7 @@
  *
  */
 
+#define KERNEL_2_6_27
 
 #include <linux/module.h>
 #include <linux/init.h>
@@ -46,7 +47,7 @@
 #include <asm/kmap_types.h>
 #include <asm/atomic.h>
 
-#include "osd.h"
+#include "include/osd.h"
 
 //
 // Data types
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 0acf42c3566d6..6e85c38eb8426 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -21,6 +21,7 @@
  *
  */
 
+#define KERNEL_2_6_27
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -29,8 +30,8 @@
 #include <linux/interrupt.h>
 #include <linux/sysctl.h>
 
-#include "logging.h"
-#include "vmbus.h"
+#include "include/logging.h"
+#include "include/vmbus.h"
 
 //
 // Defines
@@ -451,7 +452,7 @@ int vmbus_bus_init(PFN_DRIVERINITIALIZE pfn_drv_init)
 		goto cleanup;
 	}
 	//strcpy(dev_ctx->device.bus_id, dev_ctx->device_obj.name);
-	sprintf(dev_ctx->device.bus_id, "vmbus_0_0");
+	dev_set_name(&dev_ctx->device, "vmbus_0_0");
 	memcpy(&dev_ctx->class_id, &dev_ctx->device_obj.deviceType, sizeof(GUID));
 	memcpy(&dev_ctx->device_id, &dev_ctx->device_obj.deviceInstance, sizeof(GUID));
 
@@ -656,16 +657,16 @@ static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OB
 	//
 	// Make sure we are not registered already
 	//
-	if (child_device_ctx->device.bus_id[0] != '\0')
+	if (strlen(dev_name(&child_device_ctx->device)) != 0)
 	{
-		DPRINT_ERR(VMBUS_DRV, "child device (%p) already registered - busid %s", child_device_ctx, child_device_ctx->device.bus_id);
+		DPRINT_ERR(VMBUS_DRV, "child device (%p) already registered - busid %s", child_device_ctx, dev_name(&child_device_ctx->device));
 
 		ret = -1;
 		goto Cleanup;
 	}
 
 	// Set the device bus id. Otherwise, device_register()will fail.
-	sprintf(child_device_ctx->device.bus_id, "vmbus_0_%d", InterlockedIncrement(&device_num));
+	dev_set_name(&child_device_ctx->device, "vmbus_0_%d", InterlockedIncrement(&device_num));
 
 	// The new device belongs to this bus
 	child_device_ctx->device.bus = &g_vmbus_drv.bus; //device->dev.bus;
@@ -924,7 +925,7 @@ static int vmbus_probe(struct device *child_device)
 		ret = device_ctx->probe_error = driver_ctx->probe(child_device);
 		if (ret != 0)
 		{
-			DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s (%p) on driver %s (%d)...", child_device->bus_id, child_device, child_device->driver->name, ret);
+			DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s (%p) on driver %s (%d)...", dev_name(child_device), child_device, child_device->driver->name, ret);
 
 #ifdef KERNEL_2_6_27
 			INIT_WORK(&device_ctx->probe_failed_work_item, vmbus_probe_failed_cb);
-- 
2.30.2