From 5b796fe8fc8d534747151d8b8bbc8e2547ce68cd Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 8 Jul 2014 13:21:30 -0400 Subject: [PATCH] staging: unisys: remove all proc entries from virtpci This patch removes all proc entries from virtpci Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/virtpci/virtpci.c | 309 +---------------------- 1 file changed, 1 insertion(+), 308 deletions(-) diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 5ab17e76c804..7d840b0618eb 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include "version.h" @@ -100,18 +99,7 @@ static int virtpci_device_suspend(struct device *dev, pm_message_t state); static int virtpci_device_resume(struct device *dev); static int virtpci_device_probe(struct device *dev); static int virtpci_device_remove(struct device *dev); -static ssize_t virt_proc_write(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos); -static ssize_t info_proc_read(struct file *file, char __user *buf, - size_t len, loff_t *offset); -static const struct file_operations proc_virt_fops = { - .write = virt_proc_write, -}; - -static const struct file_operations proc_info_fops = { - .read = info_proc_read, -}; /*****************************************************/ /* Globals */ @@ -152,19 +140,6 @@ static DEFINE_RWLOCK(VpcidevListLock); /* filled in with info about this driver, wrt it servicing client busses */ static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo; -/* virtpci_proc_dir_entry is used to create the proc entry directory - * for virtpci - */ -static struct proc_dir_entry *virtpci_proc_dir; -/* virt_proc_entry is used to tell virtpci to add/delete vhbas/vnics/vbuses */ -static struct proc_dir_entry *virt_proc_entry; -/* info_proc_entry is used to tell virtpci to display current info - * kept in the driver - */ -static struct proc_dir_entry *info_proc_entry; -#define VIRT_PROC_ENTRY_FN "virt" -#define INFO_PROC_ENTRY_FN "info" -#define DIR_PROC_ENTRY "virtpci" struct virtpci_busdev { struct device virtpci_bus_device; @@ -1401,274 +1376,6 @@ void virtpci_unregister_driver(struct virtpci_driver *drv) } EXPORT_SYMBOL_GPL(virtpci_unregister_driver); -/*****************************************************/ -/* proc filesystem functions */ -/*****************************************************/ -struct print_vbus_info { - int *length; - char *buf; -}; - -static int print_vbus(struct device *vbus, void *data) -{ - struct print_vbus_info *p = (struct print_vbus_info *) data; - int l = *(p->length); - - *(p->length) = l + sprintf(p->buf + l, "bus_id:%s\n", dev_name(vbus)); - return 0; /* no error */ -} - -static ssize_t info_proc_read(struct file *file, char __user *buf, - size_t len, loff_t *offset) -{ - int length = 0; - struct virtpci_dev *tmpvpcidev; - unsigned long flags; - struct print_vbus_info printparam; - 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; - - length += sprintf(vbuf + length, "CHANSOCK is not defined.\n"); - - length += sprintf(vbuf + length, "\n Virtual PCI Bus devices\n"); - printparam.length = &length; - printparam.buf = vbuf; - if (bus_for_each_dev(&virtpci_bus_type, NULL, - (void *) &printparam, print_vbus)) - LOGERR("delete of all vbus failed\n"); - - length += sprintf(vbuf + length, "\n Virtual PCI devices\n"); - read_lock_irqsave(&VpcidevListLock, flags); - tmpvpcidev = VpcidevListHead; - while (tmpvpcidev) { - if (tmpvpcidev->devtype == VIRTHBA_TYPE) { - length += sprintf(vbuf + length, "[%d:%d] VHba:%08x:%08x max-config:%d-%d-%d-%d", - tmpvpcidev->busNo, tmpvpcidev->deviceNo, - tmpvpcidev->scsi.wwnn.wwnn1, - tmpvpcidev->scsi.wwnn.wwnn2, - tmpvpcidev->scsi.max.max_channel, - tmpvpcidev->scsi.max.max_id, - tmpvpcidev->scsi.max.max_lun, - tmpvpcidev->scsi.max.cmd_per_lun); - } else { - length += sprintf(vbuf + length, "[%d:%d] VNic:%02x:%02x:%02x:%02x:%02x:%02x num_rcv_bufs:%d mtu:%d", - tmpvpcidev->busNo, tmpvpcidev->deviceNo, - tmpvpcidev->net.mac_addr[0], - tmpvpcidev->net.mac_addr[1], - tmpvpcidev->net.mac_addr[2], - tmpvpcidev->net.mac_addr[3], - tmpvpcidev->net.mac_addr[4], - tmpvpcidev->net.mac_addr[5], - tmpvpcidev->net.num_rcv_bufs, - tmpvpcidev->net.mtu); - } - length += - sprintf(vbuf + length, " chanptr:%p\n", - tmpvpcidev->queueinfo.chan); - tmpvpcidev = tmpvpcidev->next; - } - read_unlock_irqrestore(&VpcidevListLock, flags); - - 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 virt_proc_write(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - char buf[16]; - int type, i, action = 0xffff; - unsigned int busno, deviceno; - void __iomem *chanptr; - struct add_vbus_guestpart busaddparams; - struct add_virt_guestpart addparams; - struct del_vbus_guestpart busdelparams; - struct del_virt_guestpart delparams; -#ifdef STORAGE_CHANNEL - U64 storagechannel; -#endif - -#define PRINT_USAGE_RETURN {\ - LOGERR("usage: 0-0- ==> delete vhba\n"); \ - LOGERR("usage: 0-1--- ==> add vhba\n"); \ - LOGERR("usage: 0-f- ==> delete all vhbas\n"); \ - LOGERR("\n"); \ - LOGERR("usage: 1-0- ==> delete vnic\n"); \ - LOGERR("usage: 1-1--- ==> add vnic\n"); \ - LOGERR("usage: 1-f- ==> delete all vnics\n"); \ - LOGERR("\n"); \ - LOGERR("usage: 6-0- ==> delete vbus\n"); \ - LOGERR("usage: 6-1- ==> add vbus\n"); \ - LOGERR("usage: 6-f ==> delete all vbuses\n"); \ - LOGERR("usage: 98-- ==> INJECT Client delete vnic\n"); \ - LOGERR("usage: 99--- ==> INJECT Client add vnic\n"); \ - return -EINVAL; \ -} - - if (count >= ARRAY_SIZE(buf)) - return -EINVAL; - - if (copy_from_user(buf, buffer, count)) { - LOGERR("copy_from_user failed.\n"); - return -EFAULT; - } - - i = sscanf(buf, "%x-%x", &type, &action); - if (i < 2) - PRINT_USAGE_RETURN; - - if (type == 0x98) { - /* client inject delete vnic */ - i = sscanf(buf, "%x-%d-%d", &type, &busno, &deviceno); - if (i != 3) - PRINT_USAGE_RETURN; - uislib_client_inject_del_vnic(busno, deviceno); - return count; /* success */ - } else if (type == 0x99) { - /* client inject add vnic */ - i = sscanf(buf, "%x-%p-%d-%d", &type, &chanptr, &busno, - &deviceno); - if (i != 4) - PRINT_USAGE_RETURN; - if (!uislib_client_inject_add_vnic(busno, deviceno, - __pa(chanptr), - MIN_IO_CHANNEL_SIZE, - 1, /* test msg */ - NULL_UUID_LE, /* inst guid */ - NULL)) { /*interrupt info */ - LOGERR("FAILED to inject add vnic\n"); - return -EFAULT; - } - return count; /* success */ - } - - if ((type != VIRTHBA_TYPE) && (type != VIRTNIC_TYPE) - && (type != VIRTBUS_TYPE)) - PRINT_USAGE_RETURN; - - if (type == VIRTBUS_TYPE) { - i = sscanf(buf, "%x-%x-%d", &type, &action, &busno); - switch (action) { - case 0: - /* delete vbus */ - if (i != 3) - break; - busdelparams.busNo = busno; - if (delete_vbus(&busdelparams)) - return count; /* success */ - return -EFAULT; - - case 1: - /* add vbus */ - if (i != 3) - break; - busaddparams.chanptr = NULL; /* NOT YET USED */ - busaddparams.busNo = busno; - if (add_vbus(&busaddparams)) - return count; /* success */ - return -EFAULT; - - case 0xf: - /* delete all vbuses and all vhbas/vnics on the buses */ - if (i != 2) - break; - delete_all(); - return count; /* success */ - default: - break; - } - PRINT_USAGE_RETURN; - } - - /* if (type == VIRTNIC_TYPE) or if (type == VIRTHBA_TYPE) */ - switch (action) { - case 0: - /* delete vhba/vnic */ - i = sscanf(buf, "%x-%x-%p", &type, &action, &chanptr); - if (i != 3) - break; - delparams.chanptr = chanptr; - if (type == VIRTHBA_TYPE) { - if (delete_vhba(&delparams)) - return count; /* success */ - } else { - if (delete_vnic(&delparams)) - return count; /* success */ - } - return -EFAULT; - - case 1: - /* add vhba/vnic */ - i = sscanf(buf, "%x-%x-%p-%d-%d", &type, &action, &chanptr, - &busno, &deviceno); - if (i != 5) - break; - addparams.chanptr = chanptr; - addparams.busNo = busno; - addparams.deviceNo = deviceno; - if (type == VIRTHBA_TYPE) { - if (add_vhba(&addparams)) - return count; /* success */ - } else { - if (add_vnic(&addparams)) - return count; /* success */ - } - return -EFAULT; - -#ifdef STORAGE_CHANNEL - case 2: - /* add vhba */ - i = sscanf(buf, "%x-%x-%d-%d", &type, &action, &busno, - &deviceno); - if (i != 4) - break; - storagechannel = uislib_storage_channel(0); /* Get my storage channel */ - /* ioremap_cache it now */ - addparams.chanptr = - (void *) ioremap_cache(storagechannel, IO_CHANNEL_SIZE); - if (addparams.chanptr == NULL) { - LOGERR("Failure to get remap storage channel.\n"); - return -EFAULT; - } - addparams.busNo = busno; - addparams.deviceNo = deviceno; - if (type == VIRTHBA_TYPE) { - if (add_vhba(&addparams)) - return count; /* success */ - } - return -EFAULT; -#endif - case 0xf: - /* delete all vhbas/vnics */ - i = sscanf(buf, "%x-%x-%d", &type, &action, &busno); - if (i != 3) - break; - busdelparams.busNo = busno; - delete_all_virt(type, &busdelparams); - return count; /* success */ - default: - break; - } - PRINT_USAGE_RETURN; -} - /*****************************************************/ /* Module Init & Exit functions */ /*****************************************************/ @@ -1719,12 +1426,7 @@ static int __init virtpci_mod_init(void) LOGINF("successfully registered virtpci_ctrlchan_func (0x%p) as callback.\n", (void *) &virtpci_ctrlchan_func); - /* create the proc directories */ - virtpci_proc_dir = proc_mkdir(DIR_PROC_ENTRY, NULL); - virt_proc_entry = proc_create(VIRT_PROC_ENTRY_FN, 0, virtpci_proc_dir, - &proc_virt_fops); - info_proc_entry = proc_create(INFO_PROC_ENTRY_FN, 0, virtpci_proc_dir, - &proc_info_fops); + LOGINF("Leaving\n"); POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO); return 0; @@ -1741,15 +1443,6 @@ static void __exit virtpci_mod_exit(void) device_unregister(&virtpci_rootbus_device); bus_unregister(&virtpci_bus_type); - if (virt_proc_entry) - remove_proc_entry(VIRT_PROC_ENTRY_FN, virtpci_proc_dir); - - if (info_proc_entry) - remove_proc_entry(INFO_PROC_ENTRY_FN, virtpci_proc_dir); - - if (virtpci_proc_dir) - remove_proc_entry(DIR_PROC_ENTRY, NULL); - LOGINF("Leaving\n"); } -- 2.30.2