[PATCH 134/141] staging: unisys: Hide vbus_hdr_info from public visor_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Don Zickus <dzickus@xxxxxxxxxx>

The vbus_hdr_info is a private struct that is used to communicate
bus info over the channel.  Currently it is public in visorbus.h
and causes compile problems (missing header).

Fix this by allocating memory and turn the public element into
a pointer.

Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/include/visorbus.h       |  3 +--
 drivers/staging/unisys/visorbus/visorbus_main.c | 28 +++++++++++++++++--------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index dc5de471..d60421c 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -38,7 +38,6 @@
 #include "periodic_work.h"
 #include "channel.h"
 #include "controlvmchannel.h"
-#include "vbuschannel.h"
 
 struct visor_driver;
 struct visor_device;
@@ -158,7 +157,7 @@ struct visor_device {
 	u8 *name;
 	u8 *description;
 	struct controlvm_message_header pending_msg_hdr;
-	struct spar_vbus_headerinfo vbus_hdr_info;
+	void *vbus_hdr_info;
 	u32 switch_no;
 	u32 internal_port_no;
 	uuid_le partition_uuid;
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index a79996a..59cf220 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -24,6 +24,7 @@
 #include "vbuschannel.h"
 #include "guestlinuxdebug.h"
 #include "vbusdeviceinfo.h"
+#include "vbuschannel.h"
 #include "controlvmchannel.h"
 
 #define MYDRVNAME "visorbus"
@@ -1188,10 +1189,13 @@ fix_vbus_dev_info(struct visor_device *visordev)
 	struct visorchannel *channel = visordev->visorchannel;
 	struct ultra_vbus_deviceinfo dev_info;
 	const char *chan_type_name = NULL;
+	struct spar_vbus_headerinfo *hdr_info;
 
 	if (!visordev->device.driver)
 			return;
 
+	hdr_info = (struct spar_vbus_headerinfo *)visordev->vbus_hdr_info;
+
 	visordrv = to_visor_driver(visordev->device.driver);
 
 	/* Within the list of device types (by GUID) that the driver
@@ -1211,16 +1215,13 @@ fix_vbus_dev_info(struct visor_device *visordev)
 	bus_device_info_init(&dev_info, chan_type_name,
 			     visordrv->name, visordrv->version,
 			     visordrv->vertag);
-	write_vbus_dev_info(channel,
-			    &visordev->vbus_hdr_info, &dev_info, dev_no);
+	write_vbus_dev_info(channel, hdr_info, &dev_info, dev_no);
 
 	/* Re-write bus+chipset info, because it is possible that this
 	* was previously written by our evil counterpart, virtpci.
 	*/
-	write_vbus_chp_info(channel, &visordev->vbus_hdr_info,
-			    &chipset_driverinfo);
-	write_vbus_bus_info(channel, &visordev->vbus_hdr_info,
-			    &clientbus_driverinfo);
+	write_vbus_chp_info(channel, hdr_info, &chipset_driverinfo);
+	write_vbus_bus_info(channel, hdr_info, &clientbus_driverinfo);
 }
 
 /** Create a device instance for the visor bus itself.
@@ -1230,8 +1231,16 @@ create_bus_instance(struct visor_device *vdev)
 {
 	int rc;
 	u32 id = vdev->chipset_bus_no;
+	struct spar_vbus_headerinfo *hdr_info;
 
 	POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
+
+	hdr_info = kzalloc(sizeof(struct spar_vbus_headerinfo), GFP_KERNEL);
+	if (!hdr_info) {
+		rc = -ENOMEM;
+		goto away;
+	}
+	vdev->vbus_hdr_info = (void *)hdr_info;
 	dev_set_name(&vdev->device, "visorbus%d", id);
 	vdev->device.bus = &visorbus_type;
 	vdev->device.groups = visorbus_groups;
@@ -1245,10 +1254,10 @@ create_bus_instance(struct visor_device *vdev)
 	if (vdev->visorchannel) {
 		struct visorchannel *channel = vdev->visorchannel;
 
-		if (get_vbus_header_info(channel, &vdev->vbus_hdr_info) >= 0) {
-			write_vbus_chp_info(channel, &vdev->vbus_hdr_info,
+		if (get_vbus_header_info(channel, hdr_info) >= 0) {
+			write_vbus_chp_info(channel, hdr_info,
 					    &chipset_driverinfo);
-			write_vbus_bus_info(channel, &vdev->vbus_hdr_info,
+			write_vbus_bus_info(channel, hdr_info,
 					    &clientbus_driverinfo);
 		}
 	}
@@ -1276,6 +1285,7 @@ remove_bus_instance(struct visor_device *dev)
 		visorchannel_destroy(dev->visorchannel);
 		dev->visorchannel = NULL;
 	}
+	kfree(dev->vbus_hdr_info);
 	list_del(&dev->list_all);
 	device_unregister(&dev->device);
 }
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux