Commit 29a2600c authored by Erik Arfvidson's avatar Erik Arfvidson Committed by Greg Kroah-Hartman
Browse files

staging: unisys: remove virthba proc files



This patch removes all proc entries, directories, and functions

Signed-off-by: default avatarErik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5d30566f
Loading
Loading
Loading
Loading
+0 −206
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <asm/param.h>
#include <linux/proc_fs.h>
#include <linux/types.h>

#include "virthba.h"
@@ -106,15 +105,6 @@ static int virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state);
static void doDiskAddRemove(struct work_struct *work);
static void virthba_serverdown_complete(struct work_struct *work);

static ssize_t info_proc_read(struct file *file, char __user *buf,
			      size_t len, loff_t *offset);
static ssize_t rqwu_proc_write(struct file *file, const char __user *buffer,
			       size_t count, loff_t *ppos);
static ssize_t enable_ints_read(struct file *file, char __user *buffer,
				size_t count, loff_t *ppos);
static ssize_t enable_ints_write(struct file *file, const char __user *buffer,
				 size_t count, loff_t *ppos);

/*****************************************************/
/* Globals                                           */
/*****************************************************/
@@ -208,7 +198,6 @@ struct diskaddremove {
static DEVICE_ATTRIBUTE *virthba_shost_attrs[];
static struct scsi_host_template virthba_driver_template = {
	.name = "Unisys Virtual HBA",
	.proc_name = "uisvirthba",
	.info = virthba_get_info,
	.ioctl = virthba_ioctl,
	.queuecommand = virthba_queue_command,
@@ -232,31 +221,9 @@ struct virthba_devices_open {
	struct virthba_info *virthbainfo;
};

static const struct file_operations proc_info_fops = {
	.read = info_proc_read,
};

static const struct file_operations proc_rqwu_fops = {
	.write = rqwu_proc_write,
};

static const struct file_operations proc_enable_ints_fops = {
	.read = enable_ints_read,
	.write = enable_ints_write,
};


#define VIRTHBASOPENMAX 1
/* array of open devices maintained by open() and close(); */
static struct virthba_devices_open VirtHbasOpen[VIRTHBASOPENMAX];
static struct proc_dir_entry *virthba_proc_dir;
static struct proc_dir_entry *info_proc_entry;
static struct proc_dir_entry *rqwaitus_proc_entry;
static struct proc_dir_entry *enable_ints_proc_entry;
#define INFO_PROC_ENTRY_FN "info"
#define ENABLE_INTS_ENTRY_FN "enable_ints"
#define RQWU_PROC_ENTRY_FN "rqwait_usecs"
#define DIR_PROC_ENTRY "virthba"

/*****************************************************/
/* Local Functions				     */
@@ -1375,156 +1342,6 @@ process_incoming_rsps(void *v)
	complete_and_exit(&dc->threadinfo.has_stopped, 0);
}

/*****************************************************/
/* proc filesystem functions						 */
/*****************************************************/

static ssize_t
info_proc_read(struct file *file, char __user *buf, size_t len, loff_t *offset)
{
	int length = 0;
	U64 phys_flags_addr;
	int i;
	struct virthba_info *virthbainfo;
	char *vbuf;
	loff_t pos = *offset;

	if (pos < 0)
		return -EINVAL;

	if (pos > 0 || !len)
		return 0;

	vbuf = kzalloc(len, GFP_KERNEL);
	if (!vbuf)
		return -ENOMEM;

	for (i = 0; i < VIRTHBASOPENMAX; i++) {
		if (VirtHbasOpen[i].virthbainfo == NULL)
			continue;

		virthbainfo = VirtHbasOpen[i].virthbainfo;
		length += sprintf(vbuf + length, "CHANSOCK is not defined.\n");

		length += sprintf(vbuf + length, "MaxBuffLen:%u\n", MaxBuffLen);

		length += sprintf(vbuf + length, "\nvirthba result queue poll wait:%d usecs.\n",
				  rsltq_wait_usecs);

		length += sprintf(vbuf + length, "\ninterrupts_rcvd = %llu, interrupts_disabled = %llu\n",
				  virthbainfo->interrupts_rcvd,
				  virthbainfo->interrupts_disabled);
		length += sprintf(vbuf + length, "\ninterrupts_notme = %llu,\n",
				  virthbainfo->interrupts_notme);
		phys_flags_addr = virt_to_phys((__force  void *)
					       virthbainfo->flags_addr);
		length += sprintf(vbuf + length, "flags_addr = %p, phys_flags_addr=0x%016llx, FeatureFlags=%llu\n",
			  virthbainfo->flags_addr, phys_flags_addr,
				  (__le64)readq(virthbainfo->flags_addr));
		length += sprintf(vbuf + length, "acquire_failed_cnt:%llu\n",
				  virthbainfo->acquire_failed_cnt);
		length += sprintf(vbuf + length, "\n");
	}
	if (copy_to_user(buf, vbuf, length)) {
		kfree(vbuf);
		return -EFAULT;
	}

	kfree(vbuf);
	*offset += length;
	return length;
}

static ssize_t
enable_ints_read(struct file *file, char __user *buffer,
		  size_t count, loff_t *ppos)
{
	return 0;
}

static ssize_t
enable_ints_write(struct file *file, const char __user *buffer,
		  size_t count, loff_t *ppos)
{
	char buf[4];
	int i, new_value;
	struct virthba_info *virthbainfo;
	U64 __iomem *Features_addr;
	U64 mask;

	if (count >= ARRAY_SIZE(buf))
		return -EINVAL;

	buf[count] = '\0';
	if (copy_from_user(buf, buffer, count)) {
		LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n",
		       (int) count, buf, count);
		return -EFAULT;
	}

	i = sscanf(buf, "%d", &new_value);

	if (i < 1) {
		LOGERR("Failed to scan value for enable_ints, buf<<%.*s>>",
		       (int) count, buf);
		return -EFAULT;
	}

	/* set all counts to new_value usually 0 */
	for (i = 0; i < VIRTHBASOPENMAX; i++) {
		if (VirtHbasOpen[i].virthbainfo != NULL) {
			virthbainfo = VirtHbasOpen[i].virthbainfo;
			Features_addr =
				&virthbainfo->chinfo.queueinfo->chan->Features;
			if (new_value == 1) {
				mask = ~(ULTRA_IO_CHANNEL_IS_POLLING |
					 ULTRA_IO_DRIVER_DISABLES_INTS);
				uisqueue_InterlockedAnd(Features_addr, mask);
				mask = ULTRA_IO_DRIVER_ENABLES_INTS;
				uisqueue_InterlockedOr(Features_addr, mask);
				rsltq_wait_usecs = 4000000;
			} else {
				mask = ~(ULTRA_IO_DRIVER_ENABLES_INTS |
					 ULTRA_IO_DRIVER_DISABLES_INTS);
				uisqueue_InterlockedAnd(Features_addr, mask);
				mask = ULTRA_IO_CHANNEL_IS_POLLING;
				uisqueue_InterlockedOr(Features_addr, mask);
				rsltq_wait_usecs = 4000;
			}
		}
	}
	return count;
}

static ssize_t
rqwu_proc_write(struct file *file, const char __user *buffer,
		size_t count, loff_t *ppos)
{
	char buf[16];
	int i, usecs;

	if (count >= ARRAY_SIZE(buf))
		return -EINVAL;

	if (copy_from_user(buf, buffer, count)) {
		LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n",
		       (int) count, buf, count);
		return -EFAULT;
	}

	i = sscanf(buf, "%d", &usecs);

	if (i < 1) {
		LOGERR("Failed to scan value for rqwait_usecs buf<<%.*s>>",
		       (int) count, buf);
		return -EFAULT;
	}

	/* set global wait time */
	rsltq_wait_usecs = usecs;
	return count;
}

/* As per VirtpciFunc returns 1 for success and 0 for failure */
static int
virthba_serverup(struct virtpci_dev *virtpcidev)
@@ -1708,17 +1525,6 @@ virthba_mod_init(void)
		POSTCODE_LINUX_3(VHBA_CREATE_FAILURE_PC, error,
				 POSTCODE_SEVERITY_ERR);
	} else {
		/* create the proc directories */
		virthba_proc_dir = proc_mkdir(DIR_PROC_ENTRY, NULL);
		info_proc_entry = proc_create(INFO_PROC_ENTRY_FN, 0,
					      virthba_proc_dir,
					      &proc_info_fops);
		rqwaitus_proc_entry = proc_create(RQWU_PROC_ENTRY_FN, 0,
						  virthba_proc_dir,
						  &proc_rqwu_fops);
		enable_ints_proc_entry = proc_create(ENABLE_INTS_ENTRY_FN, 0,
						     virthba_proc_dir,
						     &proc_enable_ints_fops);

		/* Initialize DARWorkQ */
		INIT_WORK(&DARWorkQ, doDiskAddRemove);
@@ -1799,18 +1605,6 @@ virthba_mod_exit(void)
		virthba_serverdown_workqueue = NULL;
	}

	if (info_proc_entry)
		remove_proc_entry(INFO_PROC_ENTRY_FN, virthba_proc_dir);

	if (rqwaitus_proc_entry)
		remove_proc_entry(RQWU_PROC_ENTRY_FN, NULL);

	if (enable_ints_proc_entry)
		remove_proc_entry(ENABLE_INTS_ENTRY_FN, NULL);

	if (virthba_proc_dir)
		remove_proc_entry(DIR_PROC_ENTRY, NULL);

	LOGINF("Leaving virthba_mod_exit\n");

}