All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/13] Continued continued unisys driver update
@ 2015-06-04 13:22 Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 01/13] staging: unisys: Migrate bus from devdata to visor_device Benjamin Romer
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh; +Cc: Jes.Sorensen, sparmaintainer, driverdev-devel, Benjamin Romer

This patch set contains the remaining changes from our driver cleanup
efforts. No functional changes have been made, only a rebase so that the
patches would apply.

David Kershner (4):
  staging: unisys: Update diag serverity enum
  staging: unisys: Remove unneeded fields in diagchannel.h
  staging: unisys: Clean up diag_serverity enum
  staging: unisys: Add the bus device to the visor device list.

Don Zickus (8):
  staging: unisys: Migrate bus from devdata to visor_device
  staging: unisys: Remove unused cruft
  staging: unisys: Remove server flags
  staging: unisys: Do not use 0 as the default bus root device number
  staging: unisys: Convert bus creation to use visor_device
  staging: unisys: Convert device creation to use visor_device
  staging: unisys: Fix double sysfs create for module version
  staging: unisys: Fix clean up path

Jes Sorensen (1):
  staging: unisys: Removed unused entries from struct
    visor_channeltype_descriptor

 drivers/staging/unisys/include/diagchannel.h       | 420 +------------------
 drivers/staging/unisys/include/visorbus.h          |  17 +-
 drivers/staging/unisys/visorbus/visorbus_main.c    | 466 +++++----------------
 drivers/staging/unisys/visorbus/visorbus_private.h |  97 +----
 drivers/staging/unisys/visorbus/visorchipset.c     | 296 +++----------
 5 files changed, 202 insertions(+), 1094 deletions(-)

-- 
2.1.4

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v5 01/13] staging: unisys: Migrate bus from devdata to visor_device
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 02/13] staging: unisys: Remove unused cruft Benjamin Romer
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Don Zickus, Jes.Sorensen, sparmaintainer, driverdev-devel,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

The bus device and regular device were using two different
structs.  Let's combine them as they are not entirely different
from one another.

This allows us to move this creation up the stack later and
actually remove bus/dev_info easily.

Most of the churn is just renaming devdata -> dev and 'struct
visorbus_devdata' to 'struct visor_device'.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 127 +++++++++++-------------
 1 file changed, 57 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index c7db681..380ea62 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -36,18 +36,6 @@ static int visorbus_devicetest;
 static int visorbus_debugref;
 #define SERIALLOOPBACKCHANADDR (100 * 1024 * 1024)
 
-/** This is the private data that we store for each bus device instance.
- */
-struct visorbus_devdata {
-	int devno;		/* this is the chipset busNo */
-	struct list_head list_all;
-	struct device dev;
-	struct kobject kobj;
-	struct visorchannel *chan;	/* channel area for bus itself */
-	bool vbus_valid;
-	void *vbus_hdr_info;
-};
-
 #define CURRENT_FILE_PC VISOR_BUS_PC_visorbus_main_c
 #define POLLJIFFIES_TESTWORK         100
 #define POLLJIFFIES_NORMALCHANNEL     10
@@ -137,7 +125,7 @@ static struct ultra_vbus_deviceinfo chipset_driverinfo;
 /* filled in with info about this driver, wrt it servicing client busses */
 static struct ultra_vbus_deviceinfo clientbus_driverinfo;
 
-/** list of visorbus_devdata structs, linked via .list_all */
+/** list of visor_device structs, linked via .list_all */
 static LIST_HEAD(list_all_bus_instances);
 /** list of visor_device structs, linked via .list_all */
 static LIST_HEAD(list_all_device_instances);
@@ -195,10 +183,10 @@ away:
 static void
 visorbus_release_busdevice(struct device *xdev)
 {
-	struct visorbus_devdata *devdata = dev_get_drvdata(xdev);
+	struct visor_device *dev = dev_get_drvdata(xdev);
 
 	dev_set_drvdata(xdev, NULL);
-	kfree(devdata);
+	kfree(dev);
 	kfree(xdev);
 }
 
@@ -524,9 +512,6 @@ static const struct attribute_group *visorbus_dev_groups[] = {
 
 /* end implementation of specific channel attributes */
 
-#define to_visorbus_devdata(obj) \
-	container_of(obj, struct visorbus_devdata, dev)
-
 /*  BUS instance attributes
  *
  *  define & implement display of bus attributes under
@@ -1008,7 +993,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
  *  device.
  */
 static int
-create_visor_device(struct visorbus_devdata *devdata,
+create_visor_device(struct visor_device *bdev,
 		    struct visorchipset_device_info *dev_info,
 		    u64 partition_handle)
 {
@@ -1032,7 +1017,7 @@ create_visor_device(struct visorbus_devdata *devdata,
 	dev->channel_type_guid = dev_info->channel_type_guid;
 	dev->chipset_bus_no = chipset_bus_no;
 	dev->chipset_dev_no = chipset_dev_no;
-	dev->device.parent = &devdata->dev;
+	dev->device.parent = &bdev->device;
 	sema_init(&dev->visordriver_callback_lock, 1);	/* unlocked */
 	dev->device.bus = &visorbus_type;
 	dev->device.groups = visorbus_dev_groups;
@@ -1270,7 +1255,7 @@ fix_vbus_dev_info(struct visor_device *visordev)
 {
 	int i;
 	struct visorchipset_bus_info bus_info;
-	struct visorbus_devdata *devdata = NULL;
+	struct visor_device *dev = NULL;
 	struct visor_driver *visordrv;
 	int bus_no = visordev->chipset_bus_no;
 	int dev_no = visordev->chipset_dev_no;
@@ -1287,8 +1272,8 @@ fix_vbus_dev_info(struct visor_device *visordev)
 	if (!visorchipset_get_bus_info(bus_no, &bus_info))
 			return;
 
-	devdata = (struct visorbus_devdata *)(bus_info.bus_driver_context);
-	if (!devdata)
+	dev = (struct visor_device *)(bus_info.bus_driver_context);
+	if (!dev)
 			return;
 
 	if (!hdr_info)
@@ -1311,28 +1296,28 @@ 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(devdata->chan, hdr_info, &dev_info, dev_no);
+	write_vbus_dev_info(dev->visorchannel, 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(devdata->chan, hdr_info, &chipset_driverinfo);
-	write_vbus_bus_info(devdata->chan, hdr_info, &clientbus_driverinfo);
+	write_vbus_chp_info(dev->visorchannel, hdr_info, &chipset_driverinfo);
+	write_vbus_bus_info(dev->visorchannel, hdr_info, &clientbus_driverinfo);
 }
 
 /** Create a device instance for the visor bus itself.
  */
-static struct visorbus_devdata *
+static struct visor_device *
 create_bus_instance(struct visorchipset_bus_info *bus_info)
 {
-	struct visorbus_devdata *rc = NULL;
-	struct visorbus_devdata *devdata = NULL;
+	struct visor_device *rc = NULL;
+	struct visor_device *dev = NULL;
 	int id = bus_info->bus_no;
 	struct spar_vbus_headerinfo *hdr_info;
 
 	POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	devdata = kzalloc(sizeof(*devdata), GFP_KERNEL);
-	if (!devdata) {
+	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+	if (!dev) {
 		POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR);
 		rc = NULL;
 		goto away;
@@ -1344,41 +1329,43 @@ create_bus_instance(struct visorchipset_bus_info *bus_info)
 		goto away_mem;
 	}
 
-	dev_set_name(&devdata->dev, "visorbus%d", id);
-	devdata->dev.bus = &visorbus_type;
-	devdata->dev.groups = visorbus_groups;
-	devdata->dev.release = visorbus_release_busdevice;
-	if (device_register(&devdata->dev) < 0) {
+	dev_set_name(&dev->device, "visorbus%d", id);
+	dev->device.bus = &visorbus_type;
+	dev->device.groups = visorbus_groups;
+	dev->device.release = visorbus_release_busdevice;
+	if (device_register(&dev->device) < 0) {
 		POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, id,
 				 POSTCODE_SEVERITY_ERR);
 		rc = NULL;
 		goto away_mem2;
 	}
-	devdata->devno = id;
-	devdata->chan = bus_info->visorchannel;
+	dev->chipset_bus_no = id;
+	dev->visorchannel = bus_info->visorchannel;
 	if (bus_info->flags.server) {
-		init_vbus_channel(devdata->chan);
+		init_vbus_channel(dev->visorchannel);
 	} else {
-		if (get_vbus_header_info(devdata->chan, hdr_info) >= 0) {
-			devdata->vbus_hdr_info = (void *)hdr_info;
-			write_vbus_chp_info(devdata->chan, hdr_info,
+		if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) {
+			dev->vbus_hdr_info = (void *)hdr_info;
+			write_vbus_chp_info(dev->visorchannel, hdr_info,
 					    &chipset_driverinfo);
-			write_vbus_bus_info(devdata->chan, hdr_info,
+			write_vbus_bus_info(dev->visorchannel, hdr_info,
 					    &clientbus_driverinfo);
+		} else {
+			kfree(hdr_info);
 		}
 	}
 	bus_count++;
-	list_add_tail(&devdata->list_all, &list_all_bus_instances);
+	list_add_tail(&dev->list_all, &list_all_bus_instances);
 	if (id == 0)
-			devdata = devdata;	/* for testing ONLY */
-	dev_set_drvdata(&devdata->dev, devdata);
-	rc = devdata;
+			dev = dev;	/* for testing ONLY */
+	dev_set_drvdata(&dev->device, dev);
+	rc = dev;
 	return rc;
 
 away_mem2:
 	kfree(hdr_info);
 away_mem:
-	kfree(devdata);
+	kfree(dev);
 away:
 	return rc;
 }
@@ -1386,23 +1373,23 @@ away:
 /** Remove a device instance for the visor bus itself.
  */
 static void
-remove_bus_instance(struct visorbus_devdata *devdata)
+remove_bus_instance(struct visor_device *dev)
 {
 	/* Note that this will result in the release method for
-	 * devdata->dev being called, which will call
+	 * dev->dev being called, which will call
 	 * visorbus_release_busdevice().  This has something to do with
 	 * the put_device() done in device_unregister(), but I have never
 	 * successfully been able to trace thru the code to see where/how
 	 * release() gets called.  But I know it does.
 	 */
 	bus_count--;
-	if (devdata->chan) {
-		visorchannel_destroy(devdata->chan);
-		devdata->chan = NULL;
+	if (dev->visorchannel) {
+		visorchannel_destroy(dev->visorchannel);
+		dev->visorchannel = NULL;
 	}
-	kfree(devdata->vbus_hdr_info);
-	list_del(&devdata->list_all);
-	device_unregister(&devdata->dev);
+	kfree(dev->vbus_hdr_info);
+	list_del(&dev->list_all);
+	device_unregister(&dev->device);
 }
 
 /** Create and register the one-and-only one instance of
@@ -1449,15 +1436,15 @@ static unsigned long test_dev_nos[MAXDEVICETEST];
 static void
 chipset_bus_create(struct visorchipset_bus_info *bus_info)
 {
-	struct visorbus_devdata *devdata;
+	struct visor_device *dev;
 	int rc = -1;
 	u32 bus_no = bus_info->bus_no;
 
 	POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO);
-	devdata = create_bus_instance(bus_info);
-	if (!devdata)
+	dev = create_bus_instance(bus_info);
+	if (!dev)
 		goto away;
-	if (!visorchipset_set_bus_context(bus_info, devdata))
+	if (!visorchipset_set_bus_context(bus_info, dev))
 		goto away;
 	POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO);
 	rc = 0;
@@ -1476,13 +1463,13 @@ away:
 static void
 chipset_bus_destroy(struct visorchipset_bus_info *bus_info)
 {
-	struct visorbus_devdata *devdata;
+	struct visor_device *dev;
 	int rc = -1;
 
-	devdata = (struct visorbus_devdata *)(bus_info->bus_driver_context);
-	if (!devdata)
+	dev = (struct visor_device *)(bus_info->bus_driver_context);
+	if (!dev)
 		goto away;
-	remove_bus_instance(devdata);
+	remove_bus_instance(dev);
 	if (!visorchipset_set_bus_context(bus_info, NULL))
 		goto away;
 	rc = 0;
@@ -1497,7 +1484,7 @@ static void
 chipset_device_create(struct visorchipset_device_info *dev_info)
 {
 	struct visorchipset_bus_info bus_info;
-	struct visorbus_devdata *devdata = NULL;
+	struct visor_device *dev = NULL;
 	int rc = -1;
 	u32 bus_no = dev_info->bus_no;
 	u32 dev_no = dev_info->dev_no;
@@ -1525,8 +1512,8 @@ away:
 				 POSTCODE_SEVERITY_ERR);
 		return;
 	}
-	devdata = (struct visorbus_devdata *)(bus_info.bus_driver_context);
-	rc = create_visor_device(devdata, dev_info, bus_info.partition_handle);
+	dev = (struct visor_device *)(bus_info.bus_driver_context);
+	rc = create_visor_device(dev, dev_info, bus_info.partition_handle);
 	POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 	if (rc < 0)
@@ -1758,11 +1745,11 @@ visorbus_exit(void)
 	}
 
 	list_for_each_safe(listentry, listtmp, &list_all_bus_instances) {
-		struct visorbus_devdata *devdata = list_entry(listentry,
+		struct visor_device *dev = list_entry(listentry,
 							      struct
-							      visorbus_devdata,
+							      visor_device,
 							      list_all);
-		remove_bus_instance(devdata);
+		remove_bus_instance(dev);
 	}
 	remove_bus_type();
 }
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 02/13] staging: unisys: Remove unused cruft
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 01/13] staging: unisys: Migrate bus from devdata to visor_device Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 03/13] staging: unisys: Remove server flags Benjamin Romer
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Don Zickus, Jes.Sorensen, sparmaintainer, driverdev-devel,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

Removing stuff that isn't being used.  Another prepartion patch to
allow us to use visor_device everywhere without the baggage of
bus/dev_info.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c    | 71 ----------------------
 drivers/staging/unisys/visorbus/visorbus_private.h | 13 ----
 2 files changed, 84 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 380ea62..b43e732 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -31,8 +31,6 @@
 static int visorbus_debug;
 static int visorbus_forcematch;
 static int visorbus_forcenomatch;
-#define MAXDEVICETEST 4
-static int visorbus_devicetest;
 static int visorbus_debugref;
 #define SERIALLOOPBACKCHANADDR (100 * 1024 * 1024)
 
@@ -93,7 +91,6 @@ static struct delayed_work periodic_work;
 static struct workqueue_struct *periodic_test_workqueue;
 static struct workqueue_struct *periodic_dev_workqueue;
 static long long bus_count;	/** number of bus instances */
-static long long total_devices_created;
 					/** ever-increasing */
 
 static void chipset_bus_create(struct visorchipset_bus_info *bus_info);
@@ -462,33 +459,12 @@ static ssize_t typename_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%s\n", drv->channel_types[i - 1].name);
 }
 
-static ssize_t dump_show(struct device *dev, struct device_attribute *attr,
-			 char *buf)
-{
-/* TODO: replace this with debugfs code
-	struct visor_device *vdev = to_visor_device(dev);
-	int count = 0;
-	struct seq_file *m = NULL;
-	if (vdev->visorchannel == NULL)
-		return 0;
-	m = visor_seq_file_new_buffer(buf, PAGE_SIZE - 1);
-	if (m == NULL)
-		return 0;
-	visorchannel_debug(vdev->visorchannel, 1, m, 0);
-	count = m->count;
-	visor_seq_file_done_buffer(m);
-	m = NULL;
-*/
-	return 0;
-}
-
 static DEVICE_ATTR_RO(physaddr);
 static DEVICE_ATTR_RO(nbytes);
 static DEVICE_ATTR_RO(clientpartition);
 static DEVICE_ATTR_RO(typeguid);
 static DEVICE_ATTR_RO(zoneguid);
 static DEVICE_ATTR_RO(typename);
-static DEVICE_ATTR_RO(dump);
 
 static struct attribute *channel_attrs[] = {
 		&dev_attr_physaddr.attr,
@@ -497,7 +473,6 @@ static struct attribute *channel_attrs[] = {
 		&dev_attr_typeguid.attr,
 		&dev_attr_zoneguid.attr,
 		&dev_attr_typename.attr,
-		&dev_attr_dump.attr,
 };
 
 static struct attribute_group channel_attr_grp = {
@@ -702,25 +677,6 @@ unregister_driver_attributes(struct visor_driver *drv)
 	driver_remove_file(&drv->driver, &drv->version_attr);
 }
 
-/*  DEVICE attributes
- *
- *  define & implement display of device attributes under
- *  /sys/bus/visorbus/devices/<devicename>.
- *
- */
-
-#define DEVATTR(nam, func) { \
-	.attr = { .name = __stringify(nam), \
-		  .mode = 0444, \
-		  .owner = THIS_MODULE },	\
-	.show = func, \
-}
-
-static struct device_attribute visor_device_attrs[] = {
-	/* DEVATTR(channel_nbytes, DEVICE_ATTR_channel_nbytes), */
-	__ATTR_NULL
-};
-
 static void
 dev_periodic_work(void *xdev)
 {
@@ -1088,7 +1044,6 @@ away:
 			put_device(&dev->device);
 		kfree(dev);
 	} else {
-		total_devices_created++;
 		list_add_tail(&dev->list_all, &list_all_device_instances);
 	}
 	return rc;
@@ -1400,7 +1355,6 @@ create_bus_type(void)
 {
 	int rc = 0;
 
-	visorbus_type.dev_attrs = visor_device_attrs;
 	rc = bus_register(&visorbus_type);
 	return rc;
 }
@@ -1428,11 +1382,6 @@ remove_all_visor_devices(void)
 	}
 }
 
-static bool entered_testing_mode;
-static struct visorchannel *test_channel_infos[MAXDEVICETEST];
-static unsigned long test_bus_nos[MAXDEVICETEST];
-static unsigned long test_dev_nos[MAXDEVICETEST];
-
 static void
 chipset_bus_create(struct visorchipset_bus_info *bus_info)
 {
@@ -1492,17 +1441,8 @@ chipset_device_create(struct visorchipset_device_info *dev_info)
 	POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 
-	if (entered_testing_mode)
-		return;
 	if (!visorchipset_get_bus_info(bus_no, &bus_info))
 		goto away;
-	if (visorbus_devicetest)
-		if (total_devices_created < MAXDEVICETEST) {
-			test_channel_infos[total_devices_created] =
-			    dev_info->visorchannel;
-			test_bus_nos[total_devices_created] = bus_no;
-			test_dev_nos[total_devices_created] = dev_no;
-		}
 	POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 	rc = 0;
@@ -1527,8 +1467,6 @@ chipset_device_destroy(struct visorchipset_device_info *dev_info)
 	struct visor_device *dev;
 	int rc = -1;
 
-	if (entered_testing_mode)
-		return;
 	dev = find_visor_device_by_channel(dev_info->visorchannel);
 	if (!dev)
 		goto away;
@@ -1691,11 +1629,6 @@ visorbus_init(void)
 			     "clientbus", "visorbus",
 			     VERSION, NULL);
 
-	/* process module options */
-
-	if (visorbus_devicetest > MAXDEVICETEST)
-			visorbus_devicetest = MAXDEVICETEST;
-
 	rc = create_bus_type();
 	if (rc < 0) {
 		POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, DIAG_SEVERITY_ERR);
@@ -1765,10 +1698,6 @@ module_param_named(forcenomatch, visorbus_forcenomatch, int, S_IRUGO);
 MODULE_PARM_DESC(visorbus_forcenomatch,
 		 "1 to force an UNsuccessful dev <--> drv match");
 
-module_param_named(devicetest, visorbus_devicetest, int, S_IRUGO);
-MODULE_PARM_DESC(visorbus_devicetest,
-		 "non-0 to just test device creation and destruction");
-
 module_param_named(debugref, visorbus_debugref, int, S_IRUGO);
 MODULE_PARM_DESC(visorbus_debugref, "1 to debug reference counting");
 
diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index f371f9d..57db062 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -27,19 +27,6 @@
 
 struct visorchannel;
 
-enum visorchipset_addresstype {
-	/** address is guest physical, but outside of the physical memory
-	 *  region that is controlled by the running OS (this is the normal
-	 *  address type for Supervisor channels)
-	 */
-	ADDRTYPE_LOCALPHYSICAL,
-
-	/** address is guest physical, and withIN the confines of the
-	 *  physical memory controlled by the running OS.
-	 */
-	ADDRTYPE_LOCALTEST,
-};
-
 /** Attributes for a particular Supervisor device.
  *  Any visorchipset client can query these attributes using
  *  visorchipset_get_client_device_info() or
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 03/13] staging: unisys: Remove server flags
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 01/13] staging: unisys: Migrate bus from devdata to visor_device Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 02/13] staging: unisys: Remove unused cruft Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number Benjamin Romer
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Don Zickus, Jes.Sorensen, sparmaintainer, driverdev-devel,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

The bus driver doesn't work in server mode, just remove the left over
pieces.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c    | 66 +++-------------------
 drivers/staging/unisys/visorbus/visorbus_private.h |  5 --
 drivers/staging/unisys/visorbus/visorchipset.c     |  2 -
 3 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index b43e732..19bb355 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1074,54 +1074,6 @@ find_visor_device_by_channel(struct visorchannel *channel)
 }
 
 static int
-init_vbus_channel(struct visorchannel *chan)
-{
-	int rc = -1;
-	unsigned long allocated_bytes = visorchannel_get_nbytes(chan);
-	struct spar_vbus_channel_protocol *x =
-		kmalloc(sizeof(struct spar_vbus_channel_protocol),
-			GFP_KERNEL);
-
-	POSTCODE_LINUX_3(VBUS_CHANNEL_ENTRY_PC, rc, POSTCODE_SEVERITY_INFO);
-
-	if (x) {
-		POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		goto away;
-	}
-	if (visorchannel_clear(chan, 0, 0, allocated_bytes) < 0) {
-		POSTCODE_LINUX_2(VBUS_CHANNEL_FAILURE_PC,
-				 POSTCODE_SEVERITY_ERR);
-		goto away;
-	}
-	if (visorchannel_read
-	    (chan, 0, x, sizeof(struct spar_vbus_channel_protocol)) < 0) {
-		POSTCODE_LINUX_2(VBUS_CHANNEL_FAILURE_PC,
-				 POSTCODE_SEVERITY_ERR);
-		goto away;
-	}
-	if (!SPAR_VBUS_CHANNEL_OK_SERVER(allocated_bytes)) {
-		POSTCODE_LINUX_2(VBUS_CHANNEL_FAILURE_PC,
-				 POSTCODE_SEVERITY_ERR);
-		goto away;
-	}
-
-	if (visorchannel_write
-	    (chan, 0, x, sizeof(struct spar_vbus_channel_protocol)) < 0) {
-		POSTCODE_LINUX_3(VBUS_CHANNEL_FAILURE_PC, chan,
-				 POSTCODE_SEVERITY_ERR);
-		goto away;
-	}
-
-	POSTCODE_LINUX_3(VBUS_CHANNEL_EXIT_PC, chan, POSTCODE_SEVERITY_INFO);
-	rc = 0;
-
-away:
-	kfree(x);
-	x = NULL;
-	return rc;
-}
-
-static int
 get_vbus_header_info(struct visorchannel *chan,
 		     struct spar_vbus_headerinfo *hdr_info)
 {
@@ -1296,18 +1248,14 @@ create_bus_instance(struct visorchipset_bus_info *bus_info)
 	}
 	dev->chipset_bus_no = id;
 	dev->visorchannel = bus_info->visorchannel;
-	if (bus_info->flags.server) {
-		init_vbus_channel(dev->visorchannel);
+	if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) {
+		dev->vbus_hdr_info = (void *)hdr_info;
+		write_vbus_chp_info(dev->visorchannel, hdr_info,
+				    &chipset_driverinfo);
+		write_vbus_bus_info(dev->visorchannel, hdr_info,
+				    &clientbus_driverinfo);
 	} else {
-		if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) {
-			dev->vbus_hdr_info = (void *)hdr_info;
-			write_vbus_chp_info(dev->visorchannel, hdr_info,
-					    &chipset_driverinfo);
-			write_vbus_bus_info(dev->visorchannel, hdr_info,
-					    &clientbus_driverinfo);
-		} else {
-			kfree(hdr_info);
-		}
+		kfree(hdr_info);
 	}
 	bus_count++;
 	list_add_tail(&dev->list_all, &list_all_bus_instances);
diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index 57db062..af71809 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -66,11 +66,6 @@ struct visorchipset_bus_info {
 	u8 *description;	/* UTF8 */
 	u64 reserved1;
 	u32 reserved2;
-	struct {
-		u32 server:1;
-		/* Add new fields above. */
-		/* Remaining bits in this 32-bit word are unused. */
-	} flags;
 	struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM MsgHdr */
 	/** For private use by the bus driver */
 	void *bus_driver_context;
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 2478889..4dd0a07 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1228,8 +1228,6 @@ bus_create(struct controlvm_message *inmsg)
 
 	POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO);
 
-	bus_info->flags.server = inmsg->hdr.flags.server;
-
 	visorchannel = visorchannel_create(cmd->create_bus.channel_addr,
 					   cmd->create_bus.channel_bytes,
 					   GFP_KERNEL,
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (2 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 03/13] staging: unisys: Remove server flags Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 14:19   ` Dan Carpenter
  2015-06-04 13:22 ` [PATCH v5 05/13] staging: unisys: Convert bus creation to use visor_device Benjamin Romer
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Don Zickus, Jes.Sorensen, sparmaintainer, driverdev-devel,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

I used 0 as the device id for the bus root, neglecting the fact that
device 0 is a valid id in Unisys's configuration.  Modify this to
use UINT_MAX instead as a unique number.

As fallout from this change it was noticed the bus_no and dev_no was not
defined the same way consistently.  Fix visorbus.h to use u32 there.  Fix
the resulting printk warning too.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h       | 4 ++--
 drivers/staging/unisys/visorbus/visorbus_main.c | 2 +-
 drivers/staging/unisys/visorbus/visorchipset.c  | 6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 3152ba4..c60f7d4 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -150,8 +150,8 @@ struct visor_device {
 	struct semaphore visordriver_callback_lock;
 	bool pausing;
 	bool resuming;
-	unsigned long chipset_bus_no;
-	unsigned long chipset_dev_no;
+	u32 chipset_bus_no;
+	u32 chipset_dev_no;
 	struct visorchipset_state state;
 	uuid_le type;
 	uuid_le inst;
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 19bb355..ec3022b 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -572,7 +572,7 @@ static ssize_t client_bus_info_show(struct device *dev,
 		if (vdev->name)
 			partition_name = vdev->name;
 		x = snprintf(p, remain,
-			     "Client device / client driver info for %s partition (vbus #%ld):\n",
+			     "Client device / client driver info for %s partition (vbus #%d):\n",
 			     partition_name, vdev->chipset_dev_no);
 		p += x;
 		remain -= x;
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 4dd0a07..618732b 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -56,6 +56,8 @@
 #define UNISYS_SPAR_ID_ECX 0x70537379
 #define UNISYS_SPAR_ID_EDX 0x34367261
 
+#define BUS_ROOT_DEVICE	UINT_MAX
+
 /*
  * Module parameters
  */
@@ -727,8 +729,8 @@ static int match_visorbus_dev_by_id(struct device *dev, void *data)
 	u32 bus_no = id->bus_no;
 	u32 dev_no = id->dev_no;
 
-	if (((bus_no == -1) || (vdev->chipset_bus_no == bus_no)) &&
-	    ((dev_no == -1) || (vdev->chipset_dev_no == dev_no)))
+	if ((vdev->chipset_bus_no == bus_no) &&
+	    (vdev->chipset_dev_no == dev_no))
 		return 1;
 
 	return 0;
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 05/13] staging: unisys: Convert bus creation to use visor_device
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (3 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 06/13] staging: unisys: Convert device " Benjamin Romer
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, Don Zickus,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

This patch removes the legacy bus_info struct and instead creates
and passes around a traditional struct device.

This allows us to remove a lot of the various look up code and
removes the doubt if the struct exists or not.

Half of the churn is just the conversion of visorchipset_bus_info
to visor_device.  Various cleanups include re-arranging the failure
paths to make more sense.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h          |   3 +
 drivers/staging/unisys/visorbus/visorbus_main.c    | 131 ++++++++-------------
 drivers/staging/unisys/visorbus/visorbus_private.h |  34 +-----
 drivers/staging/unisys/visorbus/visorchipset.c     |  95 ++++-----------
 4 files changed, 77 insertions(+), 186 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index c60f7d4..e7f9984 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -220,4 +220,7 @@ void visorchannel_debug(struct visorchannel *channel, int num_queues,
 			struct seq_file *seq, u32 off);
 void __iomem *visorchannel_get_header(struct visorchannel *channel);
 
+#define BUS_ROOT_DEVICE		UINT_MAX
+struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
+					       struct visor_device *from);
 #endif
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index ec3022b..60bdf69 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -93,8 +93,8 @@ static struct workqueue_struct *periodic_dev_workqueue;
 static long long bus_count;	/** number of bus instances */
 					/** ever-increasing */
 
-static void chipset_bus_create(struct visorchipset_bus_info *bus_info);
-static void chipset_bus_destroy(struct visorchipset_bus_info *bus_info);
+static void chipset_bus_create(struct visor_device *bus_info);
+static void chipset_bus_destroy(struct visor_device *bus_info);
 static void chipset_device_create(struct visorchipset_device_info *dev_info);
 static void chipset_device_destroy(struct visorchipset_device_info *dev_info);
 static void chipset_device_pause(struct visorchipset_device_info *dev_info);
@@ -950,8 +950,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
  */
 static int
 create_visor_device(struct visor_device *bdev,
-		    struct visorchipset_device_info *dev_info,
-		    u64 partition_handle)
+		    struct visorchipset_device_info *dev_info)
 {
 	int rc = -1;
 	struct visor_device *dev = NULL;
@@ -1161,8 +1160,7 @@ static void
 fix_vbus_dev_info(struct visor_device *visordev)
 {
 	int i;
-	struct visorchipset_bus_info bus_info;
-	struct visor_device *dev = NULL;
+	struct visor_device *bdev;
 	struct visor_driver *visordrv;
 	int bus_no = visordev->chipset_bus_no;
 	int dev_no = visordev->chipset_dev_no;
@@ -1174,17 +1172,14 @@ fix_vbus_dev_info(struct visor_device *visordev)
 			return;
 
 	hdr_info = (struct spar_vbus_headerinfo *)visordev->vbus_hdr_info;
+	if (!hdr_info)
+		return;
 
-	visordrv = to_visor_driver(visordev->device.driver);
-	if (!visorchipset_get_bus_info(bus_no, &bus_info))
-			return;
-
-	dev = (struct visor_device *)(bus_info.bus_driver_context);
-	if (!dev)
-			return;
+	bdev = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
+	if (!bdev)
+		return;
 
-	if (!hdr_info)
-			return;
+	visordrv = to_visor_driver(visordev->device.driver);
 
 	/* Within the list of device types (by GUID) that the driver
 	 * says it supports, find out which one of those types matches
@@ -1203,51 +1198,45 @@ 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(dev->visorchannel, hdr_info, &dev_info, dev_no);
+	write_vbus_dev_info(bdev->visorchannel, 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(dev->visorchannel, hdr_info, &chipset_driverinfo);
-	write_vbus_bus_info(dev->visorchannel, hdr_info, &clientbus_driverinfo);
+	write_vbus_chp_info(bdev->visorchannel, hdr_info, &chipset_driverinfo);
+	write_vbus_bus_info(bdev->visorchannel, hdr_info,
+			    &clientbus_driverinfo);
 }
 
 /** Create a device instance for the visor bus itself.
  */
-static struct visor_device *
-create_bus_instance(struct visorchipset_bus_info *bus_info)
+static int
+create_bus_instance(struct visor_device *dev)
 {
-	struct visor_device *rc = NULL;
-	struct visor_device *dev = NULL;
-	int id = bus_info->bus_no;
+	int rc;
+	int id = dev->chipset_bus_no;
 	struct spar_vbus_headerinfo *hdr_info;
 
 	POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev) {
-		POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		rc = NULL;
-		goto away;
-	}
 
 	hdr_info = kzalloc(sizeof(*hdr_info), GFP_KERNEL);
 	if (!hdr_info) {
-		rc = NULL;
-		goto away_mem;
+		rc = -1;
+		goto away;
 	}
 
 	dev_set_name(&dev->device, "visorbus%d", id);
 	dev->device.bus = &visorbus_type;
 	dev->device.groups = visorbus_groups;
 	dev->device.release = visorbus_release_busdevice;
+
 	if (device_register(&dev->device) < 0) {
 		POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, id,
 				 POSTCODE_SEVERITY_ERR);
-		rc = NULL;
-		goto away_mem2;
+		rc = -1;
+		goto away_mem;
 	}
-	dev->chipset_bus_no = id;
-	dev->visorchannel = bus_info->visorchannel;
+
 	if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) {
 		dev->vbus_hdr_info = (void *)hdr_info;
 		write_vbus_chp_info(dev->visorchannel, hdr_info,
@@ -1259,16 +1248,11 @@ create_bus_instance(struct visorchipset_bus_info *bus_info)
 	}
 	bus_count++;
 	list_add_tail(&dev->list_all, &list_all_bus_instances);
-	if (id == 0)
-			dev = dev;	/* for testing ONLY */
 	dev_set_drvdata(&dev->device, dev);
-	rc = dev;
-	return rc;
+	return 0;
 
-away_mem2:
-	kfree(hdr_info);
 away_mem:
-	kfree(dev);
+	kfree(hdr_info);
 away:
 	return rc;
 }
@@ -1331,57 +1315,38 @@ remove_all_visor_devices(void)
 }
 
 static void
-chipset_bus_create(struct visorchipset_bus_info *bus_info)
+chipset_bus_create(struct visor_device *dev)
 {
-	struct visor_device *dev;
-	int rc = -1;
-	u32 bus_no = bus_info->bus_no;
+	int rc;
+	u32 bus_no = dev->chipset_bus_no;
 
 	POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO);
-	dev = create_bus_instance(bus_info);
-	if (!dev)
-		goto away;
-	if (!visorchipset_set_bus_context(bus_info, dev))
-		goto away;
+	rc = create_bus_instance(dev);
 	POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO);
-	rc = 0;
-away:
-	if (rc < 0) {
+
+	if (rc < 0)
 		POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
 				 POSTCODE_SEVERITY_ERR);
-		return;
-	}
-	POSTCODE_LINUX_3(CHIPSET_INIT_SUCCESS_PC, bus_no,
-			 POSTCODE_SEVERITY_INFO);
+	else
+		POSTCODE_LINUX_3(CHIPSET_INIT_SUCCESS_PC, bus_no,
+				 POSTCODE_SEVERITY_INFO);
+
 	if (chipset_responders.bus_create)
-		(*chipset_responders.bus_create) (bus_info, rc);
+		(*chipset_responders.bus_create) (dev, rc);
 }
 
 static void
-chipset_bus_destroy(struct visorchipset_bus_info *bus_info)
+chipset_bus_destroy(struct visor_device *dev)
 {
-	struct visor_device *dev;
-	int rc = -1;
-
-	dev = (struct visor_device *)(bus_info->bus_driver_context);
-	if (!dev)
-		goto away;
 	remove_bus_instance(dev);
-	if (!visorchipset_set_bus_context(bus_info, NULL))
-		goto away;
-	rc = 0;
-away:
-	if (rc < 0)
-		return;
 	if (chipset_responders.bus_destroy)
-		(*chipset_responders.bus_destroy)(bus_info, rc);
+		(*chipset_responders.bus_destroy)(dev, 0);
 }
 
 static void
 chipset_device_create(struct visorchipset_device_info *dev_info)
 {
-	struct visorchipset_bus_info bus_info;
-	struct visor_device *dev = NULL;
+	struct visor_device *bdev;
 	int rc = -1;
 	u32 bus_no = dev_info->bus_no;
 	u32 dev_no = dev_info->dev_no;
@@ -1389,24 +1354,24 @@ chipset_device_create(struct visorchipset_device_info *dev_info)
 	POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 
-	if (!visorchipset_get_bus_info(bus_no, &bus_info))
+	bdev = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
+	if (!bdev)
 		goto away;
+
 	POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
-	rc = 0;
+
+	rc = create_visor_device(bdev, dev_info);
 away:
 	if (rc < 0) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
-		return;
+		if (chipset_responders.device_create)
+			(*chipset_responders.device_create)(dev_info, rc);
 	}
-	dev = (struct visor_device *)(bus_info.bus_driver_context);
-	rc = create_visor_device(dev, dev_info, bus_info.partition_handle);
+
 	POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
-	if (rc < 0)
-		if (chipset_responders.device_create)
-			(*chipset_responders.device_create)(dev_info, rc);
 }
 
 static void
diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index af71809..6fd55af 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -49,35 +49,13 @@ struct visorchipset_device_info {
 	void *bus_driver_context;
 };
 
-/** Attributes for a particular Supervisor bus.
- *  (For a service partition acting as the server for buses/devices, there
- *  is a 1-to-1 relationship between busses and guest partitions.)
- *  Any visorchipset client can query these attributes using
- *  visorchipset_get_client_bus_info() or visorchipset_get_bus_info().
- */
-struct visorchipset_bus_info {
-	struct list_head entry;
-	u32 bus_no;
-	struct visorchipset_state state;
-	struct visorchannel *visorchannel;
-	uuid_le partition_uuid;
-	u64 partition_handle;
-	u8 *name;		/* UTF8 */
-	u8 *description;	/* UTF8 */
-	u64 reserved1;
-	u32 reserved2;
-	struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM MsgHdr */
-	/** For private use by the bus driver */
-	void *bus_driver_context;
-};
-
 /*  These functions will be called from within visorchipset when certain
  *  events happen.  (The implementation of these functions is outside of
  *  visorchipset.)
  */
 struct visorchipset_busdev_notifiers {
-	void (*bus_create)(struct visorchipset_bus_info *bus_info);
-	void (*bus_destroy)(struct visorchipset_bus_info *bus_info);
+	void (*bus_create)(struct visor_device *bus_info);
+	void (*bus_destroy)(struct visor_device *bus_info);
 	void (*device_create)(struct visorchipset_device_info *bus_info);
 	void (*device_destroy)(struct visorchipset_device_info *bus_info);
 	void (*device_pause)(struct visorchipset_device_info *bus_info);
@@ -91,8 +69,8 @@ struct visorchipset_busdev_notifiers {
  *      -1 = it failed
  */
 struct visorchipset_busdev_responders {
-	void (*bus_create)(struct visorchipset_bus_info *p, int response);
-	void (*bus_destroy)(struct visorchipset_bus_info *p, int response);
+	void (*bus_create)(struct visor_device *p, int response);
+	void (*bus_destroy)(struct visor_device *p, int response);
 	void (*device_create)(struct visorchipset_device_info *p, int response);
 	void (*device_destroy)(struct visorchipset_device_info *p,
 			       int response);
@@ -112,10 +90,10 @@ visorchipset_register_busdev(
 			struct ultra_vbus_deviceinfo *driver_info);
 
 bool visorchipset_get_bus_info(u32 bus_no,
-			       struct visorchipset_bus_info *bus_info);
+			       struct visor_device *bus_info);
 bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
 				  struct visorchipset_device_info *dev_info);
-bool visorchipset_set_bus_context(struct visorchipset_bus_info *bus_info,
+bool visorchipset_set_bus_context(struct visor_device *bus_info,
 				  void *context);
 
 /* visorbus init and exit functions */
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 618732b..4404f4f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -56,8 +56,6 @@
 #define UNISYS_SPAR_ID_ECX 0x70537379
 #define UNISYS_SPAR_ID_EDX 0x34367261
 
-#define BUS_ROOT_DEVICE	UINT_MAX
-
 /*
  * Module parameters
  */
@@ -230,8 +228,8 @@ static void parahotplug_process_list(void);
  */
 static struct visorchipset_busdev_notifiers busdev_notifiers;
 
-static void bus_create_response(struct visorchipset_bus_info *p, int response);
-static void bus_destroy_response(struct visorchipset_bus_info *p, int response);
+static void bus_create_response(struct visor_device *p, int response);
+static void bus_destroy_response(struct visor_device *p, int response);
 static void device_create_response(struct visorchipset_device_info *p,
 				   int response);
 static void device_destroy_response(struct visorchipset_device_info *p,
@@ -699,16 +697,6 @@ static ssize_t remaining_steps_store(struct device *dev,
 }
 
 static void
-bus_info_clear(void *v)
-{
-	struct visorchipset_bus_info *p = (struct visorchipset_bus_info *) v;
-
-	kfree(p->name);
-	kfree(p->description);
-	memset(p, 0, sizeof(struct visorchipset_bus_info));
-}
-
-static void
 dev_info_clear(void *v)
 {
 	struct visorchipset_device_info *p =
@@ -756,19 +744,6 @@ struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
 }
 EXPORT_SYMBOL(visorbus_get_device_by_id);
 
-static struct visorchipset_bus_info *
-bus_find(struct list_head *list, u32 bus_no)
-{
-	struct visorchipset_bus_info *p;
-
-	list_for_each_entry(p, list, entry) {
-		if (p->bus_no == bus_no)
-			return p;
-	}
-
-	return NULL;
-}
-
 static struct visorchipset_device_info *
 device_find(struct list_head *list, u32 bus_no, u32 dev_no)
 {
@@ -842,15 +817,8 @@ EXPORT_SYMBOL_GPL(visorchipset_register_busdev);
 static void
 cleanup_controlvm_structures(void)
 {
-	struct visorchipset_bus_info *bi, *tmp_bi;
 	struct visorchipset_device_info *di, *tmp_di;
 
-	list_for_each_entry_safe(bi, tmp_bi, &bus_info_list, entry) {
-		bus_info_clear(bi);
-		list_del(&bi->entry);
-		kfree(bi);
-	}
-
 	list_for_each_entry_safe(di, tmp_di, &dev_info_list, entry) {
 		dev_info_clear(di);
 		list_del(&di->entry);
@@ -1017,7 +985,7 @@ device_responder(enum controlvm_id cmd_id,
 }
 
 static void
-bus_epilog(struct visorchipset_bus_info *bus_info,
+bus_epilog(struct visor_device *bus_info,
 	   u32 cmd, struct controlvm_message_header *msg_hdr,
 	   int response, bool need_response)
 {
@@ -1207,10 +1175,10 @@ bus_create(struct controlvm_message *inmsg)
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
 	u32 bus_no = cmd->create_bus.bus_no;
 	int rc = CONTROLVM_RESP_SUCCESS;
-	struct visorchipset_bus_info *bus_info;
+	struct visor_device *bus_info;
 	struct visorchannel *visorchannel;
 
-	bus_info = bus_find(&bus_info_list, bus_no);
+	bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
 	if (bus_info && (bus_info->state.created == 1)) {
 		POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
 				 POSTCODE_SEVERITY_ERR);
@@ -1225,8 +1193,8 @@ bus_create(struct controlvm_message *inmsg)
 		goto cleanup;
 	}
 
-	INIT_LIST_HEAD(&bus_info->entry);
-	bus_info->bus_no = bus_no;
+	bus_info->chipset_bus_no = bus_no;
+	bus_info->chipset_dev_no = BUS_ROOT_DEVICE;
 
 	POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO);
 
@@ -1244,7 +1212,6 @@ bus_create(struct controlvm_message *inmsg)
 		goto cleanup;
 	}
 	bus_info->visorchannel = visorchannel;
-	list_add(&bus_info->entry, &bus_info_list);
 
 	POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO);
 
@@ -1258,10 +1225,10 @@ bus_destroy(struct controlvm_message *inmsg)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
 	u32 bus_no = cmd->destroy_bus.bus_no;
-	struct visorchipset_bus_info *bus_info;
+	struct visor_device *bus_info;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
-	bus_info = bus_find(&bus_info_list, bus_no);
+	bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
 	if (!bus_info)
 		rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
 	else if (bus_info->state.created == 0)
@@ -1269,6 +1236,8 @@ bus_destroy(struct controlvm_message *inmsg)
 
 	bus_epilog(bus_info, CONTROLVM_BUS_DESTROY, &inmsg->hdr,
 		   rc, inmsg->hdr.flags.response_expected == 1);
+
+	/* bus_info is freed as part of the busdevice_release function */
 }
 
 static void
@@ -1277,15 +1246,14 @@ bus_configure(struct controlvm_message *inmsg,
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
 	u32 bus_no;
-	struct visorchipset_bus_info *bus_info;
+	struct visor_device *bus_info;
 	int rc = CONTROLVM_RESP_SUCCESS;
-	char s[99];
 
 	bus_no = cmd->configure_bus.bus_no;
 	POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 
-	bus_info = bus_find(&bus_info_list, bus_no);
+	bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
 	if (!bus_info) {
 		POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 				 POSTCODE_SEVERITY_ERR);
@@ -1305,7 +1273,6 @@ bus_configure(struct controlvm_message *inmsg,
 		parser_param_start(parser_ctx, PARSERSTRING_NAME);
 		bus_info->name = parser_string_get(parser_ctx);
 
-		visorchannel_uuid_id(&bus_info->partition_uuid, s);
 		POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, bus_no,
 				 POSTCODE_SEVERITY_INFO);
 	}
@@ -1320,7 +1287,7 @@ my_device_create(struct controlvm_message *inmsg)
 	u32 bus_no = cmd->create_device.bus_no;
 	u32 dev_no = cmd->create_device.dev_no;
 	struct visorchipset_device_info *dev_info;
-	struct visorchipset_bus_info *bus_info;
+	struct visor_device *bus_info;
 	struct visorchannel *visorchannel;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
@@ -1331,7 +1298,7 @@ my_device_create(struct controlvm_message *inmsg)
 		rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
 		goto cleanup;
 	}
-	bus_info = bus_find(&bus_info_list, bus_no);
+	bus_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
 	if (!bus_info) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
@@ -2134,14 +2101,15 @@ cleanup:
 }
 
 static void
-bus_create_response(struct visorchipset_bus_info *bus_info, int response)
+bus_create_response(struct visor_device *bus_info, int response)
 {
 	if (response >= 0) {
 		bus_info->state.created = 1;
 	} else {
 		if (response != -CONTROLVM_RESP_ERROR_ALREADY_DONE)
 			/* undo the row we just created... */
-			busdevices_del(&dev_info_list, bus_info->bus_no);
+			busdevices_del(&dev_info_list,
+				       bus_info->chipset_bus_no);
 	}
 
 	bus_responder(CONTROLVM_BUS_CREATE, bus_info->pending_msg_hdr,
@@ -2152,7 +2120,7 @@ bus_create_response(struct visorchipset_bus_info *bus_info, int response)
 }
 
 static void
-bus_destroy_response(struct visorchipset_bus_info *bus_info, int response)
+bus_destroy_response(struct visor_device *bus_info, int response)
 {
 	bus_responder(CONTROLVM_BUS_DESTROY, bus_info->pending_msg_hdr,
 		      response);
@@ -2160,8 +2128,7 @@ bus_destroy_response(struct visorchipset_bus_info *bus_info, int response)
 	kfree(bus_info->pending_msg_hdr);
 	bus_info->pending_msg_hdr = NULL;
 
-	bus_info_clear(bus_info);
-	busdevices_del(&dev_info_list, bus_info->bus_no);
+	busdevices_del(&dev_info_list, bus_info->chipset_bus_no);
 }
 
 static void
@@ -2213,28 +2180,6 @@ device_resume_response(struct visorchipset_device_info *dev_info, int response)
 }
 
 bool
-visorchipset_get_bus_info(u32 bus_no, struct visorchipset_bus_info *bus_info)
-{
-	void *p = bus_find(&bus_info_list, bus_no);
-
-	if (!p)
-		return false;
-	memcpy(bus_info, p, sizeof(struct visorchipset_bus_info));
-	return true;
-}
-EXPORT_SYMBOL_GPL(visorchipset_get_bus_info);
-
-bool
-visorchipset_set_bus_context(struct visorchipset_bus_info *p, void *context)
-{
-	if (!p)
-		return false;
-	p->bus_driver_context = context;
-	return true;
-}
-EXPORT_SYMBOL_GPL(visorchipset_set_bus_context);
-
-bool
 visorchipset_get_device_info(u32 bus_no, u32 dev_no,
 			     struct visorchipset_device_info *dev_info)
 {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 06/13] staging: unisys: Convert device creation to use visor_device
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (4 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 05/13] staging: unisys: Convert bus creation to use visor_device Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 07/13] staging: unisys: Removed unused entries from struct visor_channeltype_descriptor Benjamin Romer
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Don Zickus, Jes.Sorensen, sparmaintainer, driverdev-devel,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

This patch removes the legacy dev_info struct and instead creates
and passes around a traditional struct device.

This allows us to remove a lot of the various look up code and
removes the doubt if the struct exists or not.

Half of the churn is just the conversion of visorchipset_device_info
to visor_device.  Various cleanups include re-arranging the failure
paths to make more sense.

Pay attention to the create_visor_device function.  This had a lot of
churn to simplify everything.

Lots of functions disappeared because they are not needed any more.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h          |   8 +-
 drivers/staging/unisys/visorbus/visorbus_main.c    | 146 +++++--------------
 drivers/staging/unisys/visorbus/visorbus_private.h |  49 ++-----
 drivers/staging/unisys/visorbus/visorchipset.c     | 157 +++++----------------
 4 files changed, 80 insertions(+), 280 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index e7f9984..581d962 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -43,7 +43,7 @@ struct visor_device;
 extern struct bus_type visorbus_type;
 
 typedef void (*visorbus_state_complete_func) (struct visor_device *dev,
-					      int status, void *dev_info);
+					      int status);
 struct visorchipset_state {
 	u32 created:1;
 	u32 attached:1;
@@ -106,11 +106,9 @@ struct visor_driver {
 	 *  fails or completes successfully.
 	 */
 	int (*pause)(struct visor_device *dev,
-		     visorbus_state_complete_func complete_func,
-		     void *dev_info);
+		     visorbus_state_complete_func complete_func);
 	int (*resume)(struct visor_device *dev,
-		      visorbus_state_complete_func complete_func,
-		      void *dev_info);
+		      visorbus_state_complete_func complete_func);
 
 	/** These fields are for private use by the bus driver only. */
 	struct device_driver driver;
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 60bdf69..688bd84 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -95,10 +95,10 @@ static long long bus_count;	/** number of bus instances */
 
 static void chipset_bus_create(struct visor_device *bus_info);
 static void chipset_bus_destroy(struct visor_device *bus_info);
-static void chipset_device_create(struct visorchipset_device_info *dev_info);
-static void chipset_device_destroy(struct visorchipset_device_info *dev_info);
-static void chipset_device_pause(struct visorchipset_device_info *dev_info);
-static void chipset_device_resume(struct visorchipset_device_info *dev_info);
+static void chipset_device_create(struct visor_device *dev_info);
+static void chipset_device_destroy(struct visor_device *dev_info);
+static void chipset_device_pause(struct visor_device *dev_info);
+static void chipset_device_resume(struct visor_device *dev_info);
 
 /** These functions are implemented herein, and are called by the chipset
  *  driver to notify us about specific events.
@@ -184,7 +184,6 @@ visorbus_release_busdevice(struct device *xdev)
 
 	dev_set_drvdata(xdev, NULL);
 	kfree(dev);
-	kfree(xdev);
 }
 
 /** This is called when device_unregister() is called for each child
@@ -754,17 +753,10 @@ away:
 	 *  initialized.
 	 */
 	if (!dev->responded_to_device_create) {
-		struct visorchipset_device_info dev_info;
-
-		if (!visorchipset_get_device_info(dev->chipset_bus_no,
-						  dev->chipset_dev_no,
-						  &dev_info))
-			/* hmm, what to do here */
-			return rc;
 
 		dev->responded_to_device_create = true;
 		if (chipset_responders.device_create)
-			(*chipset_responders.device_create)(&dev_info, rc);
+			(*chipset_responders.device_create)(dev, rc);
 	}
 	return rc;
 }
@@ -949,30 +941,15 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
  *  device.
  */
 static int
-create_visor_device(struct visor_device *bdev,
-		    struct visorchipset_device_info *dev_info)
+create_visor_device(struct visor_device *dev)
 {
 	int rc = -1;
-	struct visor_device *dev = NULL;
-	bool gotten = false, registered1 = false, registered2 = false;
-	u32 chipset_bus_no = dev_info->bus_no;
-	u32 chipset_dev_no = dev_info->dev_no;
+	u32 chipset_bus_no = dev->chipset_bus_no;
+	u32 chipset_dev_no = dev->chipset_dev_no;
 
 	POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no,
 			 POSTCODE_SEVERITY_INFO);
-	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev) {
-		POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
-				 DIAG_SEVERITY_ERR);
-		goto away;
-	}
 
-	memset(dev, 0, sizeof(struct visor_device));
-	dev->visorchannel = dev_info->visorchannel;
-	dev->channel_type_guid = dev_info->channel_type_guid;
-	dev->chipset_bus_no = chipset_bus_no;
-	dev->chipset_dev_no = chipset_dev_no;
-	dev->device.parent = &bdev->device;
 	sema_init(&dev->visordriver_callback_lock, 1);	/* unlocked */
 	dev->device.bus = &visorbus_type;
 	dev->device.groups = visorbus_dev_groups;
@@ -980,7 +957,6 @@ create_visor_device(struct visor_device *bdev,
 	dev->device.release = visorbus_release_device;
 	/* keep a reference just for us (now 2) */
 	get_device(&dev->device);
-	gotten = true;
 	dev->periodic_work =
 		visor_periodic_work_create(POLLJIFFIES_NORMALCHANNEL,
 					   periodic_dev_workqueue,
@@ -1022,29 +998,20 @@ create_visor_device(struct visor_device *bdev,
 		goto away;
 	}
 
-	/* note: device_register is simply device_initialize + device_add */
-	registered1 = true;
-
 	rc = register_devmajorminor_attributes(dev);
 	if (rc < 0) {
 		POSTCODE_LINUX_3(DEVICE_REGISTER_FAILURE_PC, chipset_dev_no,
 				 DIAG_SEVERITY_ERR);
-		goto away;
+		goto away_register;
 	}
 
-	registered2 = true;
-	rc = 0;
+	list_add_tail(&dev->list_all, &list_all_device_instances);
+	return 0;
 
+away_register:
+	device_unregister(&dev->device);
 away:
-	if (rc < 0) {
-		if (registered2)
-			unregister_devmajorminor_attributes(dev);
-		if (gotten)
-			put_device(&dev->device);
-		kfree(dev);
-	} else {
-		list_add_tail(&dev->list_all, &list_all_device_instances);
-	}
+	put_device(&dev->device);
 	return rc;
 }
 
@@ -1057,21 +1024,6 @@ remove_visor_device(struct visor_device *dev)
 	device_unregister(&dev->device);
 }
 
-static struct visor_device *
-find_visor_device_by_channel(struct visorchannel *channel)
-{
-	struct list_head *listentry, *listtmp;
-
-	list_for_each_safe(listentry, listtmp, &list_all_device_instances) {
-		struct visor_device *dev = list_entry(listentry,
-						      struct visor_device,
-						      list_all);
-		if (dev->visorchannel == channel)
-			return dev;
-	}
-	return NULL;
-}
-
 static int
 get_vbus_header_info(struct visorchannel *chan,
 		     struct spar_vbus_headerinfo *hdr_info)
@@ -1344,25 +1296,16 @@ chipset_bus_destroy(struct visor_device *dev)
 }
 
 static void
-chipset_device_create(struct visorchipset_device_info *dev_info)
+chipset_device_create(struct visor_device *dev_info)
 {
-	struct visor_device *bdev;
 	int rc = -1;
-	u32 bus_no = dev_info->bus_no;
-	u32 dev_no = dev_info->dev_no;
+	u32 bus_no = dev_info->chipset_bus_no;
+	u32 dev_no = dev_info->chipset_dev_no;
 
 	POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 
-	bdev = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
-	if (!bdev)
-		goto away;
-
-	POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_INFO);
-
-	rc = create_visor_device(bdev, dev_info);
-away:
+	rc = create_visor_device(dev_info);
 	if (rc < 0) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
@@ -1375,22 +1318,12 @@ away:
 }
 
 static void
-chipset_device_destroy(struct visorchipset_device_info *dev_info)
+chipset_device_destroy(struct visor_device *dev_info)
 {
-	struct visor_device *dev;
-	int rc = -1;
-
-	dev = find_visor_device_by_channel(dev_info->visorchannel);
-	if (!dev)
-		goto away;
-	rc = 0;
-away:
-	if (rc < 0)
-			return;
+	remove_visor_device(dev_info);
 
 	if (chipset_responders.device_destroy)
-		(*chipset_responders.device_destroy) (dev_info, rc);
-	remove_visor_device(dev);
+		(*chipset_responders.device_destroy) (dev_info, 0);
 }
 
 /* This is the callback function specified for a function driver, to
@@ -1398,11 +1331,8 @@ away:
  * completed.
  */
 static void
-pause_state_change_complete(struct visor_device *dev, int status,
-			    void *info)
+pause_state_change_complete(struct visor_device *dev, int status)
 {
-	struct visorchipset_device_info *dev_info = info;
-
 	if (!dev->pausing)
 			return;
 
@@ -1413,7 +1343,7 @@ pause_state_change_complete(struct visor_device *dev, int status,
 	/* Notify the chipset driver that the pause is complete, which
 	* will presumably want to send some sort of response to the
 	* initiator. */
-	(*chipset_responders.device_pause) (dev_info, status);
+	(*chipset_responders.device_pause) (dev, status);
 }
 
 /* This is the callback function specified for a function driver, to
@@ -1421,11 +1351,8 @@ pause_state_change_complete(struct visor_device *dev, int status,
  * completed.
  */
 static void
-resume_state_change_complete(struct visor_device *dev, int status,
-			     void *info)
+resume_state_change_complete(struct visor_device *dev, int status)
 {
-	struct visorchipset_device_info *dev_info = info;
-
 	if (!dev->resuming)
 			return;
 
@@ -1436,7 +1363,7 @@ resume_state_change_complete(struct visor_device *dev, int status,
 	/* Notify the chipset driver that the resume is complete,
 	 * which will presumably want to send some sort of response to
 	 * the initiator. */
-	(*chipset_responders.device_resume) (dev_info, status);
+	(*chipset_responders.device_resume) (dev, status);
 }
 
 /* Tell the subordinate function driver for a specific device to pause
@@ -1444,14 +1371,11 @@ resume_state_change_complete(struct visor_device *dev, int status,
  * callback function.
  */
 static void
-initiate_chipset_device_pause_resume(struct visorchipset_device_info *dev_info,
-				     bool is_pause)
+initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause)
 {
-	struct visor_device *dev = NULL;
 	int rc = -1, x;
 	struct visor_driver *drv = NULL;
-	void (*notify_func)(struct visorchipset_device_info *dev_info,
-			    int response) = NULL;
+	void (*notify_func)(struct visor_device *dev, int response) = NULL;
 
 	if (is_pause)
 		notify_func = chipset_responders.device_pause;
@@ -1460,10 +1384,6 @@ initiate_chipset_device_pause_resume(struct visorchipset_device_info *dev_info,
 	if (!notify_func)
 			goto away;
 
-	dev = find_visor_device_by_channel(dev_info->visorchannel);
-	if (!dev)
-			goto away;
-
 	drv = to_visor_driver(dev->device.driver);
 	if (!drv)
 			goto away;
@@ -1483,8 +1403,7 @@ initiate_chipset_device_pause_resume(struct visorchipset_device_info *dev_info,
 				goto away;
 
 		dev->pausing = true;
-		x = drv->pause(dev, pause_state_change_complete,
-			       (void *)dev_info);
+		x = drv->pause(dev, pause_state_change_complete);
 	} else {
 		/* This should be done at BUS resume time, but an
 		 * existing problem prevents us from ever getting a bus
@@ -1496,8 +1415,7 @@ initiate_chipset_device_pause_resume(struct visorchipset_device_info *dev_info,
 				goto away;
 
 		dev->resuming = true;
-		x = drv->resume(dev, resume_state_change_complete,
-				(void *)dev_info);
+		x = drv->resume(dev, resume_state_change_complete);
 	}
 	if (x < 0) {
 		if (is_pause)
@@ -1510,18 +1428,18 @@ initiate_chipset_device_pause_resume(struct visorchipset_device_info *dev_info,
 away:
 	if (rc < 0) {
 		if (notify_func)
-				(*notify_func)(dev_info, rc);
+				(*notify_func)(dev, rc);
 	}
 }
 
 static void
-chipset_device_pause(struct visorchipset_device_info *dev_info)
+chipset_device_pause(struct visor_device *dev_info)
 {
 	initiate_chipset_device_pause_resume(dev_info, true);
 }
 
 static void
-chipset_device_resume(struct visorchipset_device_info *dev_info)
+chipset_device_resume(struct visor_device *dev_info)
 {
 	initiate_chipset_device_pause_resume(dev_info, false);
 }
diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index 6fd55af..2f12483 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -20,35 +20,10 @@
 
 #include <linux/uuid.h>
 
-#include "channel.h"
 #include "controlvmchannel.h"
 #include "vbusdeviceinfo.h"
 #include "vbushelper.h"
 
-struct visorchannel;
-
-/** Attributes for a particular Supervisor device.
- *  Any visorchipset client can query these attributes using
- *  visorchipset_get_client_device_info() or
- *  visorchipset_get_server_device_info().
- */
-struct visorchipset_device_info {
-	struct list_head entry;
-	u32 bus_no;
-	u32 dev_no;
-	uuid_le dev_inst_uuid;
-	struct visorchipset_state state;
-	struct visorchannel *visorchannel;
-	uuid_le channel_type_guid;
-	u32 reserved1;		/* control_vm_id */
-	u64 reserved2;
-	u32 switch_no;		/* when devState.attached==1 */
-	u32 internal_port_no;	/* when devState.attached==1 */
-	struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM_MESSAGE */
-	/** For private use by the bus driver */
-	void *bus_driver_context;
-};
-
 /*  These functions will be called from within visorchipset when certain
  *  events happen.  (The implementation of these functions is outside of
  *  visorchipset.)
@@ -56,10 +31,10 @@ struct visorchipset_device_info {
 struct visorchipset_busdev_notifiers {
 	void (*bus_create)(struct visor_device *bus_info);
 	void (*bus_destroy)(struct visor_device *bus_info);
-	void (*device_create)(struct visorchipset_device_info *bus_info);
-	void (*device_destroy)(struct visorchipset_device_info *bus_info);
-	void (*device_pause)(struct visorchipset_device_info *bus_info);
-	void (*device_resume)(struct visorchipset_device_info *bus_info);
+	void (*device_create)(struct visor_device *bus_info);
+	void (*device_destroy)(struct visor_device *bus_info);
+	void (*device_pause)(struct visor_device *bus_info);
+	void (*device_resume)(struct visor_device *bus_info);
 };
 
 /*  These functions live inside visorchipset, and will be called to indicate
@@ -71,11 +46,10 @@ struct visorchipset_busdev_notifiers {
 struct visorchipset_busdev_responders {
 	void (*bus_create)(struct visor_device *p, int response);
 	void (*bus_destroy)(struct visor_device *p, int response);
-	void (*device_create)(struct visorchipset_device_info *p, int response);
-	void (*device_destroy)(struct visorchipset_device_info *p,
-			       int response);
-	void (*device_pause)(struct visorchipset_device_info *p, int response);
-	void (*device_resume)(struct visorchipset_device_info *p, int response);
+	void (*device_create)(struct visor_device *p, int response);
+	void (*device_destroy)(struct visor_device *p, int response);
+	void (*device_pause)(struct visor_device *p, int response);
+	void (*device_resume)(struct visor_device *p, int response);
 };
 
 /** Register functions (in the bus driver) to get called by visorchipset
@@ -89,13 +63,6 @@ visorchipset_register_busdev(
 			struct visorchipset_busdev_responders *responders,
 			struct ultra_vbus_deviceinfo *driver_info);
 
-bool visorchipset_get_bus_info(u32 bus_no,
-			       struct visor_device *bus_info);
-bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
-				  struct visorchipset_device_info *dev_info);
-bool visorchipset_set_bus_context(struct visor_device *bus_info,
-				  void *context);
-
 /* visorbus init and exit functions */
 int visorbus_init(void);
 void visorbus_exit(void);
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 4404f4f..4385b15 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -230,16 +230,12 @@ static struct visorchipset_busdev_notifiers busdev_notifiers;
 
 static void bus_create_response(struct visor_device *p, int response);
 static void bus_destroy_response(struct visor_device *p, int response);
-static void device_create_response(struct visorchipset_device_info *p,
-				   int response);
-static void device_destroy_response(struct visorchipset_device_info *p,
-				    int response);
-static void device_resume_response(struct visorchipset_device_info *p,
-				   int response);
+static void device_create_response(struct visor_device *p, int response);
+static void device_destroy_response(struct visor_device *p, int response);
+static void device_resume_response(struct visor_device *p, int response);
 
-static void
-visorchipset_device_pause_response(struct visorchipset_device_info *p,
-				   int response);
+static void visorchipset_device_pause_response(struct visor_device *p,
+					       int response);
 
 static struct visorchipset_busdev_responders busdev_responders = {
 	.bus_create = bus_create_response,
@@ -696,15 +692,6 @@ static ssize_t remaining_steps_store(struct device *dev,
 	return count;
 }
 
-static void
-dev_info_clear(void *v)
-{
-	struct visorchipset_device_info *p =
-		(struct visorchipset_device_info *) v;
-
-	memset(p, 0, sizeof(struct visorchipset_device_info));
-}
-
 struct visor_busdev {
 	u32 bus_no;
 	u32 dev_no;
@@ -744,31 +731,6 @@ struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
 }
 EXPORT_SYMBOL(visorbus_get_device_by_id);
 
-static struct visorchipset_device_info *
-device_find(struct list_head *list, u32 bus_no, u32 dev_no)
-{
-	struct visorchipset_device_info *p;
-
-	list_for_each_entry(p, list, entry) {
-		if (p->bus_no == bus_no && p->dev_no == dev_no)
-			return p;
-	}
-
-	return NULL;
-}
-
-static void busdevices_del(struct list_head *list, u32 bus_no)
-{
-	struct visorchipset_device_info *p, *tmp;
-
-	list_for_each_entry_safe(p, tmp, list, entry) {
-		if (p->bus_no == bus_no) {
-			list_del(&p->entry);
-			kfree(p);
-		}
-	}
-}
-
 static u8
 check_chipset_events(void)
 {
@@ -815,18 +777,6 @@ visorchipset_register_busdev(
 EXPORT_SYMBOL_GPL(visorchipset_register_busdev);
 
 static void
-cleanup_controlvm_structures(void)
-{
-	struct visorchipset_device_info *di, *tmp_di;
-
-	list_for_each_entry_safe(di, tmp_di, &dev_info_list, entry) {
-		dev_info_clear(di);
-		list_del(&di->entry);
-		kfree(di);
-	}
-}
-
-static void
 chipset_init(struct controlvm_message *inmsg)
 {
 	static int chipset_inited;
@@ -852,8 +802,6 @@ chipset_init(struct controlvm_message *inmsg)
 	features |= ULTRA_CHIPSET_FEATURE_REPLY;
 
 cleanup:
-	if (rc < 0)
-		cleanup_controlvm_structures();
 	if (inmsg->hdr.flags.response_expected)
 		controlvm_respond_chipset_init(&inmsg->hdr, rc, features);
 }
@@ -947,12 +895,12 @@ bus_responder(enum controlvm_id cmd_id,
 
 static void
 device_changestate_responder(enum controlvm_id cmd_id,
-			     struct visorchipset_device_info *p, int response,
+			     struct visor_device *p, int response,
 			     struct spar_segment_state response_state)
 {
 	struct controlvm_message outmsg;
-	u32 bus_no = p->bus_no;
-	u32 dev_no = p->dev_no;
+	u32 bus_no = p->chipset_bus_no;
+	u32 dev_no = p->chipset_dev_no;
 
 	if (p->pending_msg_hdr == NULL)
 		return;		/* no controlvm response needed */
@@ -1053,15 +1001,15 @@ away:
 }
 
 static void
-device_epilog(struct visorchipset_device_info *dev_info,
+device_epilog(struct visor_device *dev_info,
 	      struct spar_segment_state state, u32 cmd,
 	      struct controlvm_message_header *msg_hdr, int response,
 	      bool need_response, bool for_visorbus)
 {
 	struct visorchipset_busdev_notifiers *notifiers;
 	bool notified = false;
-	u32 bus_no = dev_info->bus_no;
-	u32 dev_no = dev_info->dev_no;
+	u32 bus_no = dev_info->chipset_bus_no;
+	u32 dev_no = dev_info->chipset_dev_no;
 	struct controlvm_message_header *pmsg_hdr = NULL;
 
 	char *envp[] = {
@@ -1286,31 +1234,34 @@ my_device_create(struct controlvm_message *inmsg)
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
 	u32 bus_no = cmd->create_device.bus_no;
 	u32 dev_no = cmd->create_device.dev_no;
-	struct visorchipset_device_info *dev_info;
+	struct visor_device *dev_info = NULL;
 	struct visor_device *bus_info;
 	struct visorchannel *visorchannel;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
-	dev_info = device_find(&dev_info_list, bus_no, dev_no);
-	if (dev_info && (dev_info->state.created == 1)) {
+	bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
+	if (!bus_info) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
-		rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
+		rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
 		goto cleanup;
 	}
-	bus_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
-	if (!bus_info) {
+
+	if (bus_info->state.created == 0) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
 		rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
 		goto cleanup;
 	}
-	if (bus_info->state.created == 0) {
+
+	dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
+	if (dev_info && (dev_info->state.created == 1)) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
-		rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
+		rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
 		goto cleanup;
 	}
+
 	dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL);
 	if (!dev_info) {
 		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
@@ -1319,10 +1270,13 @@ my_device_create(struct controlvm_message *inmsg)
 		goto cleanup;
 	}
 
-	INIT_LIST_HEAD(&dev_info->entry);
-	dev_info->bus_no = bus_no;
-	dev_info->dev_no = dev_no;
-	dev_info->dev_inst_uuid = cmd->create_device.dev_inst_uuid;
+	dev_info->chipset_bus_no = bus_no;
+	dev_info->chipset_dev_no = dev_no;
+	dev_info->inst = cmd->create_device.dev_inst_uuid;
+
+	/* not sure where the best place to set the 'parent' */
+	dev_info->device.parent = &bus_info->device;
+
 	POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 
@@ -1341,7 +1295,6 @@ my_device_create(struct controlvm_message *inmsg)
 	}
 	dev_info->visorchannel = visorchannel;
 	dev_info->channel_type_guid = cmd->create_device.data_type_uuid;
-	list_add(&dev_info->entry, &dev_info_list);
 	POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 cleanup:
@@ -1363,10 +1316,10 @@ my_device_changestate(struct controlvm_message *inmsg)
 	u32 bus_no = cmd->device_change_state.bus_no;
 	u32 dev_no = cmd->device_change_state.dev_no;
 	struct spar_segment_state state = cmd->device_change_state.state;
-	struct visorchipset_device_info *dev_info;
+	struct visor_device *dev_info;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
-	dev_info = device_find(&dev_info_list, bus_no, dev_no);
+	dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
 	if (!dev_info) {
 		POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no,
 				 POSTCODE_SEVERITY_ERR);
@@ -1388,10 +1341,10 @@ my_device_destroy(struct controlvm_message *inmsg)
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
 	u32 bus_no = cmd->destroy_device.bus_no;
 	u32 dev_no = cmd->destroy_device.dev_no;
-	struct visorchipset_device_info *dev_info;
+	struct visor_device *dev_info;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
-	dev_info = device_find(&dev_info_list, bus_no, dev_no);
+	dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
 	if (!dev_info)
 		rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
 	else if (dev_info->state.created == 0)
@@ -2105,11 +2058,6 @@ bus_create_response(struct visor_device *bus_info, int response)
 {
 	if (response >= 0) {
 		bus_info->state.created = 1;
-	} else {
-		if (response != -CONTROLVM_RESP_ERROR_ALREADY_DONE)
-			/* undo the row we just created... */
-			busdevices_del(&dev_info_list,
-				       bus_info->chipset_bus_no);
 	}
 
 	bus_responder(CONTROLVM_BUS_CREATE, bus_info->pending_msg_hdr,
@@ -2127,12 +2075,10 @@ bus_destroy_response(struct visor_device *bus_info, int response)
 
 	kfree(bus_info->pending_msg_hdr);
 	bus_info->pending_msg_hdr = NULL;
-
-	busdevices_del(&dev_info_list, bus_info->chipset_bus_no);
 }
 
 static void
-device_create_response(struct visorchipset_device_info *dev_info, int response)
+device_create_response(struct visor_device *dev_info, int response)
 {
 	if (response >= 0)
 		dev_info->state.created = 1;
@@ -2141,23 +2087,20 @@ device_create_response(struct visorchipset_device_info *dev_info, int response)
 			 response);
 
 	kfree(dev_info->pending_msg_hdr);
-	dev_info->pending_msg_hdr = NULL;
 }
 
 static void
-device_destroy_response(struct visorchipset_device_info *dev_info, int response)
+device_destroy_response(struct visor_device *dev_info, int response)
 {
 	device_responder(CONTROLVM_DEVICE_DESTROY, dev_info->pending_msg_hdr,
 			 response);
 
 	kfree(dev_info->pending_msg_hdr);
 	dev_info->pending_msg_hdr = NULL;
-
-	dev_info_clear(dev_info);
 }
 
 static void
-visorchipset_device_pause_response(struct visorchipset_device_info *dev_info,
+visorchipset_device_pause_response(struct visor_device *dev_info,
 				   int response)
 {
 	device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE,
@@ -2169,7 +2112,7 @@ visorchipset_device_pause_response(struct visorchipset_device_info *dev_info,
 }
 
 static void
-device_resume_response(struct visorchipset_device_info *dev_info, int response)
+device_resume_response(struct visor_device *dev_info, int response)
 {
 	device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE,
 				     dev_info, response,
@@ -2179,30 +2122,6 @@ device_resume_response(struct visorchipset_device_info *dev_info, int response)
 	dev_info->pending_msg_hdr = NULL;
 }
 
-bool
-visorchipset_get_device_info(u32 bus_no, u32 dev_no,
-			     struct visorchipset_device_info *dev_info)
-{
-	void *p = device_find(&dev_info_list, bus_no, dev_no);
-
-	if (!p)
-		return false;
-	memcpy(dev_info, p, sizeof(struct visorchipset_device_info));
-	return true;
-}
-EXPORT_SYMBOL_GPL(visorchipset_get_device_info);
-
-bool
-visorchipset_set_device_context(struct visorchipset_device_info *p,
-				void *context)
-{
-	if (!p)
-		return false;
-	p->bus_driver_context = context;
-	return true;
-}
-EXPORT_SYMBOL_GPL(visorchipset_set_device_context);
-
 static ssize_t chipsetready_store(struct device *dev,
 				  struct device_attribute *attr,
 				  const char *buf, size_t count)
@@ -2476,8 +2395,6 @@ visorchipset_exit(struct acpi_device *acpi_device)
 	periodic_controlvm_workqueue = NULL;
 	destroy_controlvm_payload_info(&controlvm_payload_info);
 
-	cleanup_controlvm_structures();
-
 	memset(&g_chipset_msg_hdr, 0, sizeof(struct controlvm_message_header));
 
 	visorchannel_destroy(controlvm_channel);
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 07/13] staging: unisys: Removed unused entries from struct visor_channeltype_descriptor
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (5 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 06/13] staging: unisys: Convert device " Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 08/13] staging: unisys: Update diag serverity enum Benjamin Romer
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh; +Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, Benjamin Romer

From: Jes Sorensen <Jes.Sorensen@redhat.com>

min_size/max_size aren't used anywhere, and they were just causing
headaches in the drivers being ported over to the new interfaces.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 581d962..e4a21e4 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -59,8 +59,6 @@ struct visorchipset_state {
 struct visor_channeltype_descriptor {
 	const uuid_le guid;
 	const char *name;
-	unsigned long min_size;
-	unsigned long max_size;
 };
 
 /** Information provided by each visor driver when it registers with the
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 08/13] staging: unisys: Update diag serverity enum
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (6 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 07/13] staging: unisys: Removed unused entries from struct visor_channeltype_descriptor Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h Benjamin Romer
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, David Kershner,
	Benjamin Romer

From: David Kershner <david.kershner@unisys.com>

Give the enum the correct values instead of based on other values.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/diagchannel.h | 34 ++++++++--------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/unisys/include/diagchannel.h b/drivers/staging/unisys/include/diagchannel.h
index e8fb867..c1e74e8 100644
--- a/drivers/staging/unisys/include/diagchannel.h
+++ b/drivers/staging/unisys/include/diagchannel.h
@@ -58,20 +58,6 @@ static const uuid_le spar_diag_channel_protocol_uuid =
 * increment this. */
 #define ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID 2
 
-#define SPAR_DIAG_CHANNEL_OK_CLIENT(ch)\
-	(spar_check_channel_client(ch,\
-				   spar_diag_channel_protocol_uuid,\
-				   "diag",\
-				   sizeof(struct spar_diag_channel_protocol),\
-				   ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID,\
-				   ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE))
-
-#define SPAR_DIAG_CHANNEL_OK_SERVER(bytes)\
-	(spar_check_channel_server(spar_diag_channel_protocol_uuid,\
-				   "diag",\
-				   sizeof(struct spar_diag_channel_protocol),\
-				   bytes))
-
 #define MAX_MODULE_NAME_SIZE 128	/* Maximum length of module name... */
 #define MAX_ADDITIONAL_INFO_SIZE 256	/* Maximum length of any additional info
 					 * accompanying event... */
@@ -204,16 +190,16 @@ struct diag_channel_event {
 * change is made to this enum, they should also be reflected in that file.  */
 enum diag_severity {
 		DIAG_SEVERITY_ENUM_BEGIN = 0,
-		DIAG_SEVERITY_OVERRIDE = DIAG_SEVERITY_ENUM_BEGIN,
-		DIAG_SEVERITY_VERBOSE = DIAG_SEVERITY_OVERRIDE,	/* 0 */
-		DIAG_SEVERITY_INFO = DIAG_SEVERITY_VERBOSE + 1,	/* 1 */
-		DIAG_SEVERITY_WARNING = DIAG_SEVERITY_INFO + 1,	/* 2 */
-		DIAG_SEVERITY_ERR = DIAG_SEVERITY_WARNING + 1,	/* 3 */
-		DIAG_SEVERITY_PRINT = DIAG_SEVERITY_ERR + 1,	/* 4 */
-		DIAG_SEVERITY_SHUTOFF = DIAG_SEVERITY_PRINT + 1, /* 5 */
-		DIAG_SEVERITY_ENUM_END = DIAG_SEVERITY_SHUTOFF,	/* 5 */
-		DIAG_SEVERITY_NONFATAL_ERR = DIAG_SEVERITY_ERR,
-		DIAG_SEVERITY_FATAL_ERR = DIAG_SEVERITY_PRINT
+		DIAG_SEVERITY_OVERRIDE = 0,
+		DIAG_SEVERITY_VERBOSE = 0,
+		DIAG_SEVERITY_INFO = 1,
+		DIAG_SEVERITY_WARNING = 2,
+		DIAG_SEVERITY_ERR = 3,
+		DIAG_SEVERITY_NONFATAL_ERR = 3,
+		DIAG_SEVERITY_PRINT = 4,
+		DIAG_SEVERITY_FATAL_ERR = 4,
+		DIAG_SEVERITY_SHUTOFF = 5,
+		DIAG_SEVERITY_ENUM_END = 5
 };
 
 /* Event Cause enums
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (7 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 08/13] staging: unisys: Update diag serverity enum Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-05  5:45   ` Sudip Mukherjee
  2015-06-04 13:22 ` [PATCH v5 10/13] staging: unisys: Clean up diag_serverity enum Benjamin Romer
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, David Kershner,
	Benjamin Romer

From: David Kershner <david.kershner@unisys.com>

Diagchannel.h is used primarily for the diagnostics channel. The
diagnostics channel is not being used by linux guests currently, so
the majority of the file is not needed. What is left is what is
needed to perform postcode vmcalls. Those postcodes will eventually
end up in the diag channel.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/diagchannel.h   | 366 +------------------------
 drivers/staging/unisys/visorbus/visorchipset.c |  45 ---
 2 files changed, 2 insertions(+), 409 deletions(-)

diff --git a/drivers/staging/unisys/include/diagchannel.h b/drivers/staging/unisys/include/diagchannel.h
index c1e74e8..82932c5 100644
--- a/drivers/staging/unisys/include/diagchannel.h
+++ b/drivers/staging/unisys/include/diagchannel.h
@@ -13,169 +13,15 @@
  * details.
  */
 
-/*++
- *
- * Module Name:
- *
- * diagchannel.h
- *
- * Abstract:
- *
- * This file defines the DiagChannel protocol.  This protocol is used to aid in
- * preserving event data sent by external applications.  This protocol provides
- * a region for event data to reside in.  This data will eventually be sent to
- * the Boot Partition where it will be committed to memory and/or disk.  This
- * file contains platform-independent data that can be built using any
- * Supervisor build environment (Windows, Linux, EFI).
- *
-*/
-
 #ifndef _DIAG_CHANNEL_H_
 #define _DIAG_CHANNEL_H_
 
 #include <linux/uuid.h>
-#include "channel.h"
-
-/* {EEA7A573-DB82-447c-8716-EFBEAAAE4858} */
-#define SPAR_DIAG_CHANNEL_PROTOCOL_UUID \
-		UUID_LE(0xeea7a573, 0xdb82, 0x447c, \
-				0x87, 0x16, 0xef, 0xbe, 0xaa, 0xae, 0x48, 0x58)
-
-static const uuid_le spar_diag_channel_protocol_uuid =
-	SPAR_DIAG_CHANNEL_PROTOCOL_UUID;
-
-/* {E850F968-3263-4484-8CA5-2A35D087A5A8} */
-#define ULTRA_DIAG_ROOT_CHANNEL_PROTOCOL_GUID \
-		UUID_LE(0xe850f968, 0x3263, 0x4484, \
-				0x8c, 0xa5, 0x2a, 0x35, 0xd0, 0x87, 0xa5, 0xa8)
-
-#define ULTRA_DIAG_CHANNEL_PROTOCOL_SIGNATURE  ULTRA_CHANNEL_PROTOCOL_SIGNATURE
-
-/* Must increment this whenever you insert or delete fields within this channel
-* struct.  Also increment whenever you change the meaning of fields within this
-* channel struct so as to break pre-existing software.  Note that you can
-* usually add fields to the END of the channel struct withOUT needing to
-* increment this. */
-#define ULTRA_DIAG_CHANNEL_PROTOCOL_VERSIONID 2
 
 #define MAX_MODULE_NAME_SIZE 128	/* Maximum length of module name... */
 #define MAX_ADDITIONAL_INFO_SIZE 256	/* Maximum length of any additional info
-					 * accompanying event... */
-#define MAX_SUBSYSTEMS 64	/* Maximum number of subsystems allowed in
-				 * DiagChannel... */
-#define LOW_SUBSYSTEMS 32	/* Half of MAX_SUBSYSTEMS to allow 64-bit
-				 * math */
-#define SUBSYSTEM_DEBUG 0	/* Standard subsystem for debug events */
-#define SUBSYSTEM_DEFAULT 1	/* Default subsystem for legacy calls to
-				 * ReportEvent */
-
-/* few useful subsystem mask values */
-#define SUBSYSTEM_MASK_DEBUG	0x01	/* Standard subsystem for debug
-					 * events */
-#define SUBSYSTEM_MASK_DEFAULT  0x02	/* Default subsystem for legacy calls to
-					 * ReportEvents */
-
-/* Event parameter "Severity" is overloaded with Cause in byte 2 and Severity in
- * byte 0, bytes 1 and 3 are reserved */
-#define SEVERITY_MASK 0x0FF	/* mask out all but the Severity in byte 0 */
-#define CAUSE_MASK 0x0FF0000	/* mask out all but the cause in byte 2 */
-#define CAUSE_SHIFT_AMT 16	/* shift 2 bytes to place it in byte 2 */
-
-/* SubsystemSeverityFilter */
-#define SEVERITY_FILTER_MASK 0x0F /* mask out the Cause half, SeverityFilter is
-				   * in the lower nibble */
-#define CAUSE_FILTER_MASK 0xF0	/* mask out the Severity half, CauseFilter is in
-				 * the upper nibble */
-#define CAUSE_FILTER_SHIFT_AMT	4 /* shift amount to place it in lower or upper
-				   * nibble */
-
-/* Copied from EFI's EFI_TIME struct in efidef.h.  EFI headers are not allowed
-* in some of the Supervisor areas, such as Monitor, so it has been "ported" here
-* for use in diagnostic event timestamps... */
-struct diag_efi_time  {
-	u16 year;		/* 1998 - 20XX */
-	u8 month;		/* 1 - 12 */
-	u8 day;			/* 1 - 31 */
-	u8 hour;		/* 0 - 23 */
-	u8 minute;		/* 0 - 59 */
-	u8 second;		/* 0 - 59 */
-	u8 pad1;
-	u32 nanosecond;	/* 0 - 999, 999, 999 */
-	s16 timezone;		/* -1440 to 1440 or 2047 */
-	u8 daylight;
-	u8 pad2;
-};
-
-enum spar_component_types  {
-	 ULTRA_COMPONENT_GUEST = 0,
-	 ULTRA_COMPONENT_MONITOR = 0x01,
-	 ULTRA_COMPONENT_CCM = 0x02,	/* Common Control module */
-	 /* RESERVED 0x03 - 0x7 */
-
-	 /* Ultravisor Components */
-	 ULTRA_COMPONENT_BOOT = 0x08,
-	 ULTRA_COMPONENT_IDLE = 0x09,
-	 ULTRA_COMPONENT_CONTROL = 0x0A,
-	 ULTRA_COMPONENT_LOGGER = 0x0B,
-	 ULTRA_COMPONENT_ACPI = 0X0C,
-	 /* RESERVED 0x0D - 0x0F */
-
-	 /* sPAR Components */
-	 ULTRA_COMPONENT_COMMAND = 0x10,
-	 ULTRA_COMPONENT_IODRIVER = 0x11,
-	 ULTRA_COMPONENT_CONSOLE = 0x12,
-	 ULTRA_COMPONENT_OPERATIONS = 0x13,
-	 ULTRA_COMPONENT_MANAGEMENT = 0x14,
-	 ULTRA_COMPONENT_DIAG = 0x15,
-	 ULTRA_COMPONENT_HWDIAG = 0x16,
-	 ULTRA_COMPONENT_PSERVICES = 0x17,
-	 ULTRA_COMPONENT_PDIAG = 0x18
-	 /* RESERVED 0x18 - 0x1F */
-};
-
-/* Structure: diag_channel_event Purpose: Contains attributes that make up an
- * event to be written to the DIAG_CHANNEL memory.  Attributes: EventId: Id of
- * the diagnostic event to write to memory.  Severity: Severity of the event
- * (Error, Info, etc).  ModuleName: Module/file name where event originated.
- * LineNumber: Line number in module name where event originated.  Timestamp:
- * Date/time when event was received by ReportEvent, and written to DiagChannel.
- * Reserved: Padding to align structure on a 64-byte cache line boundary.
- * AdditionalInfo: Array of characters for additional event info (may be
- * empty).  */
-struct diag_channel_event {
-	u32 event_id;
-	u32 severity;
-	u8 module_name[MAX_MODULE_NAME_SIZE];
-	u32 line_number;
-	struct diag_efi_time timestamp;	/* Size = 16 bytes */
-	u32 partition_number;	/* Filled in by Diag Switch as pool blocks are
-				 * filled */
-	u16 vcpu_number;
-	u16 lcpu_number;
-	u8 component_type;	/* ULTRA_COMPONENT_TYPES */
-	u8 subsystem;
-	u16 reserved0;		/* pad to u64 alignment */
-	u32 block_no;		/* filled in by DiagSwitch as pool blocks are
-				 * filled */
-	u32 block_no_high;
-	u32 event_no;		/* filled in by DiagSwitch as pool blocks are
-				 * filled */
-	u32 event_no_high;
-
-	/* The block_no and event_no fields are set only by DiagSwitch
-	 * and referenced only by WinDiagDisplay formatting tool as
-	 * additional diagnostic information.  Other tools including
-	 * WinDiagDisplay currently ignore these 'Reserved' bytes. */
-	u8 reserved[8];
-	u8 additional_info[MAX_ADDITIONAL_INFO_SIZE];
-
-	/* NOTE: Changes to diag_channel_event generally need to be reflected in
-	 * existing copies *
-	 * - for AppOS at
-	 * GuestLinux/visordiag_early/supervisor_diagchannel.h *
-	 * - for WinDiagDisplay at
-	 * EFI/Ultra/Tools/WinDiagDisplay/WinDiagDisplay/diagstruct.h */
-};
+					 * accompanying event...
+					 */
 
 /* Levels of severity for diagnostic events, in order from lowest severity to
 * highest (i.e. fatal errors are the most severe, and should always be logged,
@@ -202,212 +48,4 @@ enum diag_severity {
 		DIAG_SEVERITY_ENUM_END = 5
 };
 
-/* Event Cause enums
-*
-* Levels of cause for diagnostic events, in order from least to greatest cause
-* Internal errors are most urgent since ideally they should never exist
-* Invalid requests are preventable by avoiding invalid inputs
-* Operations errors depend on environmental factors which may impact which
-* requests are possible
-* Manifest provides intermediate value to capture firmware and configuration
-* version information
-* Trace provides suplimental debug information in release firmware
-* Unknown Log captures unclasified LogEvent calls.
-* Debug is the least urgent since it provides suplimental debug information only
-* in debug firmware
-* Unknown Debug captures unclassified DebugEvent calls.
-* This enum is also defined in
-* DotNet\sParFramework\ControlFramework\ControlFramework.cs.
-* If a change is made to this enum, they should also be reflected in that
-* file.  */
-
-/* A cause value "DIAG_CAUSE_FILE_XFER" together with a severity value of
-* "DIAG_SEVERITY_PRINT" (=4), is used for transferring text or binary file to
-* the Diag partition. This cause-severity combination will be used by Logger
-* DiagSwitch to segregate events into block types. The files are transferred in
-* 256 byte chunks maximum, in the AdditionalInfo field of the diag_channel_event
-* structure. In the file transfer mode, some event fields will have different
-* meaning: EventId specifies the file offset, severity specifies the block type,
-* ModuleName specifies the filename, LineNumber specifies the number of valid
-* data bytes in an event and AdditionalInfo contains up to 256 bytes of data. */
-
-/* The Diag DiagWriter appends event blocks to events.raw as today, and for data
- * blocks uses diag_channel_event
- * PartitionNumber to extract and append 'AdditionalInfo' to filename (specified
- * by ModuleName). */
-
-/* The Dell PDiag uses this new mechanism to stash DSET .zip onto the
- * 'diagnostic' virtual disk.  */
-enum diag_cause {
-	DIAG_CAUSE_UNKNOWN = 0,
-	DIAG_CAUSE_UNKNOWN_DEBUG = DIAG_CAUSE_UNKNOWN + 1,	/* 1 */
-	DIAG_CAUSE_DEBUG = DIAG_CAUSE_UNKNOWN_DEBUG + 1,	/* 2 */
-	DIAG_CAUSE_UNKNOWN_LOG = DIAG_CAUSE_DEBUG + 1,	/* 3 */
-	DIAG_CAUSE_TRACE = DIAG_CAUSE_UNKNOWN_LOG + 1,	/* 4 */
-	DIAG_CAUSE_MANIFEST = DIAG_CAUSE_TRACE + 1,	/* 5 */
-	DIAG_CAUSE_OPERATIONS_ERROR = DIAG_CAUSE_MANIFEST + 1,	/* 6 */
-	DIAG_CAUSE_INVALID_REQUEST = DIAG_CAUSE_OPERATIONS_ERROR + 1,	/* 7 */
-	DIAG_CAUSE_INTERNAL_ERROR = DIAG_CAUSE_INVALID_REQUEST + 1, /* 8 */
-	DIAG_CAUSE_FILE_XFER = DIAG_CAUSE_INTERNAL_ERROR + 1,	/* 9 */
-	DIAG_CAUSE_ENUM_END = DIAG_CAUSE_FILE_XFER	/* 9 */
-};
-
-/* Event Cause category defined into the byte 2 of Severity */
-#define CAUSE_DEBUG (DIAG_CAUSE_DEBUG << CAUSE_SHIFT_AMT)
-#define CAUSE_TRACE (DIAG_CAUSE_TRACE << CAUSE_SHIFT_AMT)
-#define CAUSE_MANIFEST (DIAG_CAUSE_MANIFEST << CAUSE_SHIFT_AMT)
-#define CAUSE_OPERATIONS_ERROR (DIAG_CAUSE_OPERATIONS_ERROR << CAUSE_SHIFT_AMT)
-#define CAUSE_INVALID_REQUEST (DIAG_CAUSE_INVALID_REQUEST << CAUSE_SHIFT_AMT)
-#define CAUSE_INTERNAL_ERROR (DIAG_CAUSE_INTERNAL_ERROR << CAUSE_SHIFT_AMT)
-#define CAUSE_FILE_XFER (DIAG_CAUSE_FILE_XFER << CAUSE_SHIFT_AMT)
-#define CAUSE_ENUM_END CAUSE_FILE_XFER
-
-/* Combine Cause and Severity categories into one */
-#define CAUSE_DEBUG_SEVERITY_VERBOSE \
-	(CAUSE_DEBUG | DIAG_SEVERITY_VERBOSE)
-#define CAUSE_TRACE_SEVERITY_VERBOSE \
-	(CAUSE_TRACE | DIAG_SEVERITY_VERBOSE)
-#define CAUSE_MANIFEST_SEVERITY_VERBOSE\
-	(CAUSE_MANIFEST | DIAG_SEVERITY_VERBOSE)
-#define CAUSE_OPERATIONS_SEVERITY_VERBOSE \
-	(CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_VERBOSE)
-#define CAUSE_INVALID_SEVERITY_VERBOSE \
-	(CAUSE_INVALID_REQUEST  | DIAG_SEVERITY_VERBOSE)
-#define CAUSE_INTERNAL_SEVERITY_VERBOSE \
-	(CAUSE_INTERNAL_ERROR   | DIAG_SEVERITY_VERBOSE)
-
-#define CAUSE_DEBUG_SEVERITY_INFO \
-	(CAUSE_DEBUG | DIAG_SEVERITY_INFO)
-#define CAUSE_TRACE_SEVERITY_INFO \
-	(CAUSE_TRACE | DIAG_SEVERITY_INFO)
-#define CAUSE_MANIFEST_SEVERITY_INFO \
-	(CAUSE_MANIFEST | DIAG_SEVERITY_INFO)
-#define CAUSE_OPERATIONS_SEVERITY_INFO \
-	(CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_INFO)
-#define CAUSE_INVALID_SEVERITY_INFO \
-	(CAUSE_INVALID_REQUEST  | DIAG_SEVERITY_INFO)
-#define CAUSE_INTERNAL_SEVERITY_INFO \
-	(CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_INFO)
-
-#define CAUSE_DEBUG_SEVERITY_WARN \
-	(CAUSE_DEBUG | DIAG_SEVERITY_WARNING)
-#define CAUSE_TRACE_SEVERITY_WARN \
-	(CAUSE_TRACE | DIAG_SEVERITY_WARNING)
-#define CAUSE_MANIFEST_SEVERITY_WARN \
-	(CAUSE_MANIFEST | DIAG_SEVERITY_WARNING)
-#define CAUSE_OPERATIONS_SEVERITY_WARN \
-	(CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_WARNING)
-#define CAUSE_INVALID_SEVERITY_WARN \
-	(CAUSE_INVALID_REQUEST | DIAG_SEVERITY_WARNING)
-#define CAUSE_INTERNAL_SEVERITY_WARN \
-	(CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_WARNING)
-
-#define CAUSE_DEBUG_SEVERITY_ERR \
-	(CAUSE_DEBUG | DIAG_SEVERITY_ERR)
-#define CAUSE_TRACE_SEVERITY_ERR \
-	(CAUSE_TRACE | DIAG_SEVERITY_ERR)
-#define CAUSE_MANIFEST_SEVERITY_ERR \
-	(CAUSE_MANIFEST | DIAG_SEVERITY_ERR)
-#define CAUSE_OPERATIONS_SEVERITY_ERR \
-	(CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_ERR)
-#define CAUSE_INVALID_SEVERITY_ERR \
-	(CAUSE_INVALID_REQUEST  | DIAG_SEVERITY_ERR)
-#define CAUSE_INTERNAL_SEVERITY_ERR \
-	(CAUSE_INTERNAL_ERROR   | DIAG_SEVERITY_ERR)
-
-#define CAUSE_DEBUG_SEVERITY_PRINT \
-	(CAUSE_DEBUG | DIAG_SEVERITY_PRINT)
-#define CAUSE_TRACE_SEVERITY_PRINT \
-	(CAUSE_TRACE | DIAG_SEVERITY_PRINT)
-#define CAUSE_MANIFEST_SEVERITY_PRINT \
-	(CAUSE_MANIFEST | DIAG_SEVERITY_PRINT)
-#define CAUSE_OPERATIONS_SEVERITY_PRINT \
-	(CAUSE_OPERATIONS_ERROR | DIAG_SEVERITY_PRINT)
-#define CAUSE_INVALID_SEVERITY_PRINT \
-	(CAUSE_INVALID_REQUEST | DIAG_SEVERITY_PRINT)
-#define CAUSE_INTERNAL_SEVERITY_PRINT \
-	(CAUSE_INTERNAL_ERROR | DIAG_SEVERITY_PRINT)
-#define CAUSE_FILE_XFER_SEVERITY_PRINT \
-	(CAUSE_FILE_XFER | DIAG_SEVERITY_PRINT)
-
-/* Structure: diag_channel_protocol_header
- *
- * Purpose: Contains attributes that make up the header specific to the
- * DIAG_CHANNEL area.
- *
- * Attributes:
- *
- * DiagLock: Diag Channel spinlock.
- *
- *IsChannelInitialized: 1 iff SignalInit was called for this channel; otherwise
- *			0, and assume the channel is not ready for use yet.
- *
- * Reserved: Padding to align the fields in this structure.
- *
- *SubsystemSeverityFilter: Level of severity on a subsystem basis that controls
- *			whether events are logged.  Any event's severity for a
- *			particular subsystem below this level will be discarded.
- */
-struct diag_channel_protocol_header {
-	u32 diag_lock;
-	u8 channel_initialized;
-	u8 reserved[3];
-	u8 subsystem_severity_filter[64];
-};
-
-/* The Diagram for the Diagnostic Channel: */
-/* ----------------------- */
-/* | Channel Header        |	Defined by ULTRA_CHANNEL_PROTOCOL */
-/* ----------------------- */
-/* | Signal Queue Header   |	Defined by SIGNAL_QUEUE_HEADER */
-/* ----------------------- */
-/* | DiagChannel Header    |	Defined by diag_channel_protocol_header */
-/* ----------------------- */
-/* | Channel Event Info    |	Defined by diag_channel_event*MAX_EVENTS */
-/* ----------------------- */
-/* | Reserved              |	Reserved (pad out to 4MB) */
-/* ----------------------- */
-
-/* Offsets/sizes for diagnostic channel attributes... */
-#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(struct channel_header))
-#define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(struct signal_queue_header))
-#define DIAG_CH_PROTOCOL_HEADER_OFFSET \
-	(DIAG_CH_QUEUE_HEADER_OFFSET + DIAG_CH_QUEUE_HEADER_SIZE)
-#define DIAG_CH_PROTOCOL_HEADER_SIZE \
-	(sizeof(struct diag_channel_protocol_header))
-#define DIAG_CH_EVENT_OFFSET \
-	(DIAG_CH_PROTOCOL_HEADER_OFFSET + DIAG_CH_PROTOCOL_HEADER_SIZE)
-#define DIAG_CH_SIZE (4096 * 1024)
-
-/* For Control and Idle Partitions with larger (8 MB) diagnostic(root)
- * channels */
-#define DIAG_CH_LRG_SIZE (2 * DIAG_CH_SIZE)	/* 8 MB */
-
-/*
- * Structure: spar_diag_channel_protocol
- *
- * Purpose: Contains attributes that make up the DIAG_CHANNEL memory.
- *
- * Attributes:
- *
- * CommonChannelHeader:	Header info common to all channels.
- *
- * QueueHeader: Queue header common to all channels - used to determine where to
- * store event.
- *
- * DiagChannelHeader: Diagnostic channel header info (see
- * diag_channel_protocol_header comments).
- *
- * Events: Area where diagnostic events (up to MAX_EVENTS) are written.
- *
- *Reserved: Reserved area to allow for correct channel size padding.
-*/
-struct spar_diag_channel_protocol  {
-	struct channel_header common_channel_header;
-	struct signal_queue_header queue_header;
-	struct diag_channel_protocol_header diag_channel_header;
-	struct diag_channel_event events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) /
-				   sizeof(struct diag_channel_event)];
-};
-
 #endif
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 4385b15..90a3c30 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -110,17 +110,8 @@ static DEFINE_SEMAPHORE(notifier_lock);
 static struct cdev file_cdev;
 static struct visorchannel **file_controlvm_channel;
 static struct controlvm_message_header g_chipset_msg_hdr;
-static const uuid_le spar_diag_pool_channel_protocol_uuid =
-	SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID;
-/* 0xffffff is an invalid Bus/Device number */
-static u32 g_diagpool_bus_no = 0xffffff;
-static u32 g_diagpool_dev_no = 0xffffff;
 static struct controlvm_message_packet g_devicechangestate_packet;
 
-#define is_diagpool_channel(channel_type_guid) \
-	(uuid_le_cmp(channel_type_guid,\
-		     spar_diag_pool_channel_protocol_uuid) == 0)
-
 static LIST_HEAD(bus_info_list);
 static LIST_HEAD(dev_info_list);
 
@@ -827,14 +818,6 @@ controlvm_respond(struct controlvm_message_header *msg_hdr, int response)
 	struct controlvm_message outmsg;
 
 	controlvm_init_response(&outmsg, msg_hdr, response);
-	/* For DiagPool channel DEVICE_CHANGESTATE, we need to send
-	* back the deviceChangeState structure in the packet. */
-	if (msg_hdr->id == CONTROLVM_DEVICE_CHANGESTATE &&
-	    g_devicechangestate_packet.device_change_state.bus_no ==
-	    g_diagpool_bus_no &&
-	    g_devicechangestate_packet.device_change_state.dev_no ==
-	    g_diagpool_dev_no)
-		outmsg.cmd = g_devicechangestate_packet;
 	if (outmsg.hdr.flags.test_message == 1)
 		return;
 
@@ -1008,15 +991,8 @@ device_epilog(struct visor_device *dev_info,
 {
 	struct visorchipset_busdev_notifiers *notifiers;
 	bool notified = false;
-	u32 bus_no = dev_info->chipset_bus_no;
-	u32 dev_no = dev_info->chipset_dev_no;
 	struct controlvm_message_header *pmsg_hdr = NULL;
 
-	char *envp[] = {
-		"SPARSP_DIAGPOOL_PAUSED_STATE = 1",
-		NULL
-	};
-
 	notifiers = &busdev_notifiers;
 
 	if (!dev_info) {
@@ -1075,21 +1051,6 @@ device_epilog(struct visor_device *dev_info,
 					(*notifiers->device_pause) (dev_info);
 					notified = true;
 				}
-			} else if (state.alive == segment_state_paused.alive &&
-				   state.operating ==
-				   segment_state_paused.operating) {
-				/* this is lite pause where channel is
-				 * still valid just 'pause' of it
-				 */
-				if (bus_no == g_diagpool_bus_no &&
-				    dev_no == g_diagpool_dev_no) {
-					/* this will trigger the
-					 * diag_shutdown.sh script in
-					 * the visorchipset hotplug */
-					kobject_uevent_env
-					    (&visorchipset_platform_device.dev.
-					     kobj, KOBJ_ONLINE, envp);
-				}
 			}
 			break;
 		case CONTROLVM_DEVICE_DESTROY:
@@ -1298,12 +1259,6 @@ my_device_create(struct controlvm_message *inmsg)
 	POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
 			 POSTCODE_SEVERITY_INFO);
 cleanup:
-	/* get the bus and devNo for DiagPool channel */
-	if (dev_info &&
-	    is_diagpool_channel(cmd->create_device.data_type_uuid)) {
-		g_diagpool_bus_no = bus_no;
-		g_diagpool_dev_no = dev_no;
-	}
 	device_epilog(dev_info, segment_state_running,
 		      CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc,
 		      inmsg->hdr.flags.response_expected == 1, 1);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 10/13] staging: unisys: Clean up diag_serverity enum
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (8 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 11/13] staging: unisys: Fix double sysfs create for module version Benjamin Romer
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, David Kershner,
	Benjamin Romer

From: David Kershner <david.kershner@unisys.com>

Get rid of unused values in the enum.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/include/diagchannel.h | 32 +++++++++++-----------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/unisys/include/diagchannel.h b/drivers/staging/unisys/include/diagchannel.h
index 82932c5..d2d3568 100644
--- a/drivers/staging/unisys/include/diagchannel.h
+++ b/drivers/staging/unisys/include/diagchannel.h
@@ -16,36 +16,28 @@
 #ifndef _DIAG_CHANNEL_H_
 #define _DIAG_CHANNEL_H_
 
-#include <linux/uuid.h>
-
 #define MAX_MODULE_NAME_SIZE 128	/* Maximum length of module name... */
-#define MAX_ADDITIONAL_INFO_SIZE 256	/* Maximum length of any additional info
-					 * accompanying event...
+#define MAX_ADDITIONAL_INFO_SIZE 256	/* Maximum length of any additional
+					 * info accompanying event...
 					 */
 
 /* Levels of severity for diagnostic events, in order from lowest severity to
-* highest (i.e. fatal errors are the most severe, and should always be logged,
-* but info events rarely need to be logged except during debugging).  The values
-* DIAG_SEVERITY_ENUM_BEGIN and DIAG_SEVERITY_ENUM_END are not valid severity
-* values.  They exist merely to dilineate the list, so that future additions
-* won't require changes to the driver (i.e. when checking for out-of-range
-* severities in SetSeverity).  The values DIAG_SEVERITY_OVERRIDE and
-* DIAG_SEVERITY_SHUTOFF are not valid severity values for logging events but
-* they are valid for controlling the amount of event data.  This enum is also
-* defined in DotNet\sParFramework\ControlFramework\ControlFramework.cs.  If a
-* change is made to this enum, they should also be reflected in that file.  */
+ * highest (i.e. fatal errors are the most severe, and should always be logged,
+ * but info events rarely need to be logged except during debugging). The
+ * values DIAG_SEVERITY_ENUM_BEGIN and DIAG_SEVERITY_ENUM_END are not valid
+ * severity values.  They exist merely to dilineate the list, so that future
+ * additions won't require changes to the driver (i.e. when checking for
+ * out-of-range severities in SetSeverity). The values DIAG_SEVERITY_OVERRIDE
+ * and DIAG_SEVERITY_SHUTOFF are not valid severity values for logging events
+ * but they are valid for controlling the amount of event data. Changes made
+ * to the enum, need to be reflected in s-Par.
+ */
 enum diag_severity {
-		DIAG_SEVERITY_ENUM_BEGIN = 0,
-		DIAG_SEVERITY_OVERRIDE = 0,
 		DIAG_SEVERITY_VERBOSE = 0,
 		DIAG_SEVERITY_INFO = 1,
 		DIAG_SEVERITY_WARNING = 2,
 		DIAG_SEVERITY_ERR = 3,
-		DIAG_SEVERITY_NONFATAL_ERR = 3,
 		DIAG_SEVERITY_PRINT = 4,
-		DIAG_SEVERITY_FATAL_ERR = 4,
-		DIAG_SEVERITY_SHUTOFF = 5,
-		DIAG_SEVERITY_ENUM_END = 5
 };
 
 #endif
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 11/13] staging: unisys: Fix double sysfs create for module version
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (9 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 10/13] staging: unisys: Clean up diag_serverity enum Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 12/13] staging: unisys: Fix clean up path Benjamin Romer
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, Don Zickus,
	David Kershner, Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

When we combined visorchipset and visorbus into one driver we negelected
to strip out some of the MODULE_ stuff from one of the files.  When
building the drivers in, it causes a WARN that we try to create
/proc/modules/visorbus/version when it is already created.

visorchipset.c is the driver entry point, remove the cruft from
visorbus_main.c.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 688bd84..22c6150 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1531,8 +1531,3 @@ MODULE_PARM_DESC(visorbus_forcenomatch,
 
 module_param_named(debugref, visorbus_debugref, int, S_IRUGO);
 MODULE_PARM_DESC(visorbus_debugref, "1 to debug reference counting");
-
-MODULE_AUTHOR("Unisys");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Supervisor bus driver for service partition: ver " VERSION);
-MODULE_VERSION(VERSION);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 12/13] staging: unisys: Fix clean up path
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (10 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 11/13] staging: unisys: Fix double sysfs create for module version Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-04 13:22 ` [PATCH v5 13/13] staging: unisys: Add the bus device to the visor device list Benjamin Romer
  2015-06-05  6:08 ` [PATCH v5 00/13] Continued continued unisys driver update Sudip Mukherjee
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Don Zickus, driverdev-devel, Jes.Sorensen, sparmaintainer,
	Benjamin Romer

From: Don Zickus <dzickus@redhat.com>

When unloading a module, we need to cleanup the platform registration.
However, unregistering the platform uncovered a couple of quirks, namely
a missing device_release function.  Fix things up so module unload works
and allows us to reload the module.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 2 +-
 drivers/staging/unisys/visorbus/visorchipset.c  | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 22c6150..dcce1f0 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -320,7 +320,7 @@ devmajorminor_remove_file(struct visor_device *dev, int slot)
 	if (slot < 0 || slot >= maxdevnodes)
 		return;
 	myattr = (struct devmajorminor_attribute *)(dev->devnodes[slot].attr);
-	if (myattr)
+	if (!myattr)
 		return;
 	sysfs_remove_file(&dev->kobjdevmajorminor, &myattr->attr);
 	kobject_uevent(&dev->device.kobj, KOBJ_OFFLINE);
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 90a3c30..99fa96e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -331,11 +331,16 @@ static const struct attribute_group *visorchipset_dev_groups[] = {
 	NULL
 };
 
+static void visorchipset_dev_release(struct device *dev)
+{
+}
+
 /* /sys/devices/platform/visorchipset */
 static struct platform_device visorchipset_platform_device = {
 	.name = "visorchipset",
 	.id = -1,
 	.dev.groups = visorchipset_dev_groups,
+	.dev.release = visorchipset_dev_release,
 };
 
 /* Function prototypes */
@@ -2355,6 +2360,7 @@ visorchipset_exit(struct acpi_device *acpi_device)
 	visorchannel_destroy(controlvm_channel);
 
 	visorchipset_file_cleanup(visorchipset_platform_device.dev.devt);
+	platform_device_unregister(&visorchipset_platform_device);
 	POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO);
 
 	return 0;
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v5 13/13] staging: unisys: Add the bus device to the visor device list.
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (11 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 12/13] staging: unisys: Fix clean up path Benjamin Romer
@ 2015-06-04 13:22 ` Benjamin Romer
  2015-06-05  6:08 ` [PATCH v5 00/13] Continued continued unisys driver update Sudip Mukherjee
  13 siblings, 0 replies; 23+ messages in thread
From: Benjamin Romer @ 2015-06-04 13:22 UTC (permalink / raw)
  To: gregkh
  Cc: Jes.Sorensen, driverdev-devel, sparmaintainer, David Kershner,
	Benjamin Romer

From: David Kershner <david.kershner@unisys.com>

When the bus device was created the list_all variables were not
being initialized. When the CONTROLVM_BUS_CONFIGURE message
was being sent, it was failing to find the bus and produced a
panic. Initialize the bus_info->list_all variable by doing a
INIT_LIST_HEAD.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 99fa96e..cf35d9d 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1107,6 +1107,7 @@ bus_create(struct controlvm_message *inmsg)
 		goto cleanup;
 	}
 
+	INIT_LIST_HEAD(&bus_info->list_all);
 	bus_info->chipset_bus_no = bus_no;
 	bus_info->chipset_dev_no = BUS_ROOT_DEVICE;
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number
  2015-06-04 13:22 ` [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number Benjamin Romer
@ 2015-06-04 14:19   ` Dan Carpenter
  2015-06-04 14:56     ` Don Zickus
  0 siblings, 1 reply; 23+ messages in thread
From: Dan Carpenter @ 2015-06-04 14:19 UTC (permalink / raw)
  To: Benjamin Romer
  Cc: gregkh, Don Zickus, Jes.Sorensen, sparmaintainer, driverdev-devel

On Thu, Jun 04, 2015 at 09:22:40AM -0400, Benjamin Romer wrote:
> diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
> index 4dd0a07..618732b 100644
> --- a/drivers/staging/unisys/visorbus/visorchipset.c
> +++ b/drivers/staging/unisys/visorbus/visorchipset.c
> @@ -56,6 +56,8 @@
>  #define UNISYS_SPAR_ID_ECX 0x70537379
>  #define UNISYS_SPAR_ID_EDX 0x34367261
>  
> +#define BUS_ROOT_DEVICE	UINT_MAX
> +
>  /*
>   * Module parameters
>   */
> @@ -727,8 +729,8 @@ static int match_visorbus_dev_by_id(struct device *dev, void *data)
>  	u32 bus_no = id->bus_no;
>  	u32 dev_no = id->dev_no;
>  
> -	if (((bus_no == -1) || (vdev->chipset_bus_no == bus_no)) &&
> -	    ((dev_no == -1) || (vdev->chipset_dev_no == dev_no)))
> +	if ((vdev->chipset_bus_no == bus_no) &&
> +	    (vdev->chipset_dev_no == dev_no))
>  		return 1;

This talk about "root device" confuses me.  I thought that -1 was a wild
card.  Anyway, we introduce the BUS_ROOT_DEVICE macro but don't use it.
Shouldn't it be defined as 0 since that it the root device?


regards,
dan carpenter

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number
  2015-06-04 14:19   ` Dan Carpenter
@ 2015-06-04 14:56     ` Don Zickus
  2015-06-05 15:04       ` Dan Carpenter
  0 siblings, 1 reply; 23+ messages in thread
From: Don Zickus @ 2015-06-04 14:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: gregkh, Benjamin Romer, sparmaintainer, driverdev-devel, Jes.Sorensen

On Thu, Jun 04, 2015 at 05:19:44PM +0300, Dan Carpenter wrote:
> On Thu, Jun 04, 2015 at 09:22:40AM -0400, Benjamin Romer wrote:
> > diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
> > index 4dd0a07..618732b 100644
> > --- a/drivers/staging/unisys/visorbus/visorchipset.c
> > +++ b/drivers/staging/unisys/visorbus/visorchipset.c
> > @@ -56,6 +56,8 @@
> >  #define UNISYS_SPAR_ID_ECX 0x70537379
> >  #define UNISYS_SPAR_ID_EDX 0x34367261
> >  
> > +#define BUS_ROOT_DEVICE	UINT_MAX
> > +
> >  /*
> >   * Module parameters
> >   */
> > @@ -727,8 +729,8 @@ static int match_visorbus_dev_by_id(struct device *dev, void *data)
> >  	u32 bus_no = id->bus_no;
> >  	u32 dev_no = id->dev_no;
> >  
> > -	if (((bus_no == -1) || (vdev->chipset_bus_no == bus_no)) &&
> > -	    ((dev_no == -1) || (vdev->chipset_dev_no == dev_no)))
> > +	if ((vdev->chipset_bus_no == bus_no) &&
> > +	    (vdev->chipset_dev_no == dev_no))
> >  		return 1;
> 
> This talk about "root device" confuses me.  I thought that -1 was a wild
> card.  Anyway, we introduce the BUS_ROOT_DEVICE macro but don't use it.
> Shouldn't it be defined as 0 since that it the root device?

Hi Dan,

Thanks for the review.  My latest round of patch re-arrangement to make this
patchset bisectable makes this patch look awkward.  Awkward because as you
said BUS_ROOT_DEVIC isn't used.  However, it is used in patch 5 (the next
patch), but is also moved from a .c file to a .h to handle another corner
case in another .c file.  So patch5 is a better study of the usage and this
patch is the fallout of a patch written later and then re-arranged to be
earlier.

But lets back up to 'what is root device'.  Before unisys can load its io
drivers, it needs a virtual bus to sit on.  Their s-par sends 'create bus'
commands and I convert those into linux device creations.  When an io driver
is created later using a 'device create' command from the s-par,  it too
creates a linux device with its parent pointing to the 'bus root device' or
the initial virtual bus created.  This mimics what other virtual/real buses
are doing in linux (I believe).

So to back up a little bit, when the 'device create' command is sent from
the s-par, it provides a bus number to sit on and a device number to assign
it to.  Considering all the buses and devices are all lumped together under
one subsystem 'visorbus' in the device tree link-list, it is easy to walk
that link-list using the linux infrastructure.  The only problem is how to
separate an actual device from the actual bus it sits on when both have the
same bus no.

In that case, I use -1 to represent the 'bus root device'.  I agree
traditionally that infers a wild card.  I was scratching my head on a better
mechanism without re-implementing the wheel and at the same time get
something working.

Hopefully that clarifies the term of 'bus root device'.  Suggestions
welcomed. :-)



To answer your second question, why not use 0?  Originally I did, but unisys
explained to me that it is valid for their device numbering to start at 0.
Their testing uncovered this bug and hence the need for this patch.  Their
device numbering is dynamic but probably only goes as far as 8 or so.  I
chose -1 to be extremely safe. :-)

I can look to see if their docs have a MAX_DEVICE_NUMBER and use that
instead for the bus root device, if that would make more sense from a code
readability perspective and leave -1 as a possibility for a wild card in the
future.  Thoughts?

Cheers,
Don
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h
  2015-06-04 13:22 ` [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h Benjamin Romer
@ 2015-06-05  5:45   ` Sudip Mukherjee
  2015-06-05 14:45     ` Jes Sorensen
  0 siblings, 1 reply; 23+ messages in thread
From: Sudip Mukherjee @ 2015-06-05  5:45 UTC (permalink / raw)
  To: Benjamin Romer; +Cc: gregkh, sparmaintainer, driverdev-devel, Jes.Sorensen

On Thu, Jun 04, 2015 at 09:22:45AM -0400, Benjamin Romer wrote:
> From: David Kershner <david.kershner@unisys.com>
> 
> Diagchannel.h is used primarily for the diagnostics channel. The
> diagnostics channel is not being used by linux guests currently, so
> the majority of the file is not needed. What is left is what is
> needed to perform postcode vmcalls. Those postcodes will eventually
> end up in the diag channel.
> 
> Signed-off-by: David Kershner <david.kershner@unisys.com>
> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
> 
> Conflicts:
> 	drivers/staging/unisys/visorbus/visorbus_main.c
> 	drivers/staging/unisys/visorbus/visorchipset.c
> 
> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
duplicate signature?

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 00/13] Continued continued unisys driver update
  2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
                   ` (12 preceding siblings ...)
  2015-06-04 13:22 ` [PATCH v5 13/13] staging: unisys: Add the bus device to the visor device list Benjamin Romer
@ 2015-06-05  6:08 ` Sudip Mukherjee
  2015-06-05 14:47   ` Jes Sorensen
  13 siblings, 1 reply; 23+ messages in thread
From: Sudip Mukherjee @ 2015-06-05  6:08 UTC (permalink / raw)
  To: Benjamin Romer; +Cc: gregkh, sparmaintainer, driverdev-devel, Jes.Sorensen

On Thu, Jun 04, 2015 at 09:22:36AM -0400, Benjamin Romer wrote:
> This patch set contains the remaining changes from our driver cleanup
> efforts. No functional changes have been made, only a rebase so that the
> patches would apply.
Hi,
its not related to your this patchset, but one of your previous patch
removed visorutil directory but missed removing the entry from the
Makefile. Have you included that in any of your future patchset or shall
i send a patch fixing that?

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h
  2015-06-05  5:45   ` Sudip Mukherjee
@ 2015-06-05 14:45     ` Jes Sorensen
  2015-06-05 14:56       ` Greg KH
  0 siblings, 1 reply; 23+ messages in thread
From: Jes Sorensen @ 2015-06-05 14:45 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Benjamin Romer, gregkh, sparmaintainer, driverdev-devel

Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
> On Thu, Jun 04, 2015 at 09:22:45AM -0400, Benjamin Romer wrote:
>> From: David Kershner <david.kershner@unisys.com>
>> 
>> Diagchannel.h is used primarily for the diagnostics channel. The
>> diagnostics channel is not being used by linux guests currently, so
>> the majority of the file is not needed. What is left is what is
>> needed to perform postcode vmcalls. Those postcodes will eventually
>> end up in the diag channel.
>> 
>> Signed-off-by: David Kershner <david.kershner@unisys.com>
>> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
>> 
>> Conflicts:
>> 	drivers/staging/unisys/visorbus/visorbus_main.c
>> 	drivers/staging/unisys/visorbus/visorchipset.c
>> 
>> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
> duplicate signature?

The Conflicts lines and the last signed-off-by shouldn't have been there
in the first place.

Greg do you prefer to have Ben respin this one, or are you happy to nuke
those lines?

Cheers,
Jes

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 00/13] Continued continued unisys driver update
  2015-06-05  6:08 ` [PATCH v5 00/13] Continued continued unisys driver update Sudip Mukherjee
@ 2015-06-05 14:47   ` Jes Sorensen
  0 siblings, 0 replies; 23+ messages in thread
From: Jes Sorensen @ 2015-06-05 14:47 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Benjamin Romer, gregkh, sparmaintainer, driverdev-devel

Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
> On Thu, Jun 04, 2015 at 09:22:36AM -0400, Benjamin Romer wrote:
>> This patch set contains the remaining changes from our driver cleanup
>> efforts. No functional changes have been made, only a rebase so that the
>> patches would apply.
> Hi,
> its not related to your this patchset, but one of your previous patch
> removed visorutil directory but missed removing the entry from the
> Makefile. Have you included that in any of your future patchset or shall
> i send a patch fixing that?

If the reference is still present after applying this patchset on top of
Greg's tree, please go ahead and submit a patch, but please send it to
Ben so he can apply it to his tree and push it to Greg. That way we
limit the risk of patch conflicts later.

Thanks,
Jes

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h
  2015-06-05 14:45     ` Jes Sorensen
@ 2015-06-05 14:56       ` Greg KH
  0 siblings, 0 replies; 23+ messages in thread
From: Greg KH @ 2015-06-05 14:56 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: driverdev-devel, Benjamin Romer, sparmaintainer, Sudip Mukherjee

On Fri, Jun 05, 2015 at 10:45:59AM -0400, Jes Sorensen wrote:
> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
> > On Thu, Jun 04, 2015 at 09:22:45AM -0400, Benjamin Romer wrote:
> >> From: David Kershner <david.kershner@unisys.com>
> >> 
> >> Diagchannel.h is used primarily for the diagnostics channel. The
> >> diagnostics channel is not being used by linux guests currently, so
> >> the majority of the file is not needed. What is left is what is
> >> needed to perform postcode vmcalls. Those postcodes will eventually
> >> end up in the diag channel.
> >> 
> >> Signed-off-by: David Kershner <david.kershner@unisys.com>
> >> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
> >> 
> >> Conflicts:
> >> 	drivers/staging/unisys/visorbus/visorbus_main.c
> >> 	drivers/staging/unisys/visorbus/visorchipset.c
> >> 
> >> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
> > duplicate signature?
> 
> The Conflicts lines and the last signed-off-by shouldn't have been there
> in the first place.
> 
> Greg do you prefer to have Ben respin this one, or are you happy to nuke
> those lines?

Ah, I'll just edit it, don't worry about it.

thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number
  2015-06-04 14:56     ` Don Zickus
@ 2015-06-05 15:04       ` Dan Carpenter
  2015-06-05 15:26         ` Don Zickus
  0 siblings, 1 reply; 23+ messages in thread
From: Dan Carpenter @ 2015-06-05 15:04 UTC (permalink / raw)
  To: Don Zickus
  Cc: gregkh, Benjamin Romer, sparmaintainer, driverdev-devel, Jes.Sorensen

Sorry, I should have read on the later patches.  That sounds fine.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number
  2015-06-05 15:04       ` Dan Carpenter
@ 2015-06-05 15:26         ` Don Zickus
  0 siblings, 0 replies; 23+ messages in thread
From: Don Zickus @ 2015-06-05 15:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: gregkh, Benjamin Romer, sparmaintainer, driverdev-devel, Jes.Sorensen

On Fri, Jun 05, 2015 at 06:04:14PM +0300, Dan Carpenter wrote:
> Sorry, I should have read on the later patches.  That sounds fine.

Hi Dan,

No worries.  I will take the blame for that.  I should have communicated
that or done a better job making less confusing. :-(

Cheers,
Don

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-06-05 15:26 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04 13:22 [PATCH v5 00/13] Continued continued unisys driver update Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 01/13] staging: unisys: Migrate bus from devdata to visor_device Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 02/13] staging: unisys: Remove unused cruft Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 03/13] staging: unisys: Remove server flags Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 04/13] staging: unisys: Do not use 0 as the default bus root device number Benjamin Romer
2015-06-04 14:19   ` Dan Carpenter
2015-06-04 14:56     ` Don Zickus
2015-06-05 15:04       ` Dan Carpenter
2015-06-05 15:26         ` Don Zickus
2015-06-04 13:22 ` [PATCH v5 05/13] staging: unisys: Convert bus creation to use visor_device Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 06/13] staging: unisys: Convert device " Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 07/13] staging: unisys: Removed unused entries from struct visor_channeltype_descriptor Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 08/13] staging: unisys: Update diag serverity enum Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 09/13] staging: unisys: Remove unneeded fields in diagchannel.h Benjamin Romer
2015-06-05  5:45   ` Sudip Mukherjee
2015-06-05 14:45     ` Jes Sorensen
2015-06-05 14:56       ` Greg KH
2015-06-04 13:22 ` [PATCH v5 10/13] staging: unisys: Clean up diag_serverity enum Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 11/13] staging: unisys: Fix double sysfs create for module version Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 12/13] staging: unisys: Fix clean up path Benjamin Romer
2015-06-04 13:22 ` [PATCH v5 13/13] staging: unisys: Add the bus device to the visor device list Benjamin Romer
2015-06-05  6:08 ` [PATCH v5 00/13] Continued continued unisys driver update Sudip Mukherjee
2015-06-05 14:47   ` Jes Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.