aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorchipset
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/unisys/visorchipset')
-rw-r--r--drivers/staging/unisys/visorchipset/file.c122
-rw-r--r--drivers/staging/unisys/visorchipset/file.h3
-rw-r--r--drivers/staging/unisys/visorchipset/globals.h2
-rw-r--r--drivers/staging/unisys/visorchipset/testing.h43
-rw-r--r--drivers/staging/unisys/visorchipset/visorchipset.h55
-rw-r--r--drivers/staging/unisys/visorchipset/visorchipset_main.c5
-rw-r--r--drivers/staging/unisys/visorchipset/visorchipset_umode.h2
7 files changed, 50 insertions, 182 deletions
diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c
index 373fa36b7119..e51fd4e3fa2d 100644
--- a/drivers/staging/unisys/visorchipset/file.c
+++ b/drivers/staging/unisys/visorchipset/file.c
@@ -28,85 +28,75 @@
#define CURRENT_FILE_PC VISOR_CHIPSET_PC_file_c
-static struct cdev Cdev;
-static VISORCHANNEL **PControlVm_channel;
-static dev_t MajorDev = -1; /**< indicates major num for device */
-static BOOL Registered = FALSE;
+static struct cdev file_cdev;
+static struct visorchannel **file_controlvm_channel;
+static dev_t majordev = -1; /**< indicates major num for device */
+static BOOL registered = FALSE;
static int visorchipset_open(struct inode *inode, struct file *file);
static int visorchipset_release(struct inode *inode, struct file *file);
static int visorchipset_mmap(struct file *file, struct vm_area_struct *vma);
-#ifdef HAVE_UNLOCKED_IOCTL
long visorchipset_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
-#else
-int visorchipset_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
-#endif
static const struct file_operations visorchipset_fops = {
.owner = THIS_MODULE,
.open = visorchipset_open,
.read = NULL,
.write = NULL,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = visorchipset_ioctl,
-#else
- .ioctl = visorchipset_ioctl,
-#endif
.release = visorchipset_release,
.mmap = visorchipset_mmap,
};
int
-visorchipset_file_init(dev_t majorDev, VISORCHANNEL **pControlVm_channel)
+visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel)
{
- int rc = -1;
+ int rc = 0;
- PControlVm_channel = pControlVm_channel;
- MajorDev = majorDev;
- cdev_init(&Cdev, &visorchipset_fops);
- Cdev.owner = THIS_MODULE;
- if (MAJOR(MajorDev) == 0) {
+ file_controlvm_channel = controlvm_channel;
+ majordev = major_dev;
+ cdev_init(&file_cdev, &visorchipset_fops);
+ file_cdev.owner = THIS_MODULE;
+ if (MAJOR(majordev) == 0) {
/* dynamic major device number registration required */
- if (alloc_chrdev_region(&MajorDev, 0, 1, MYDRVNAME) < 0) {
+ if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) {
ERRDRV("Unable to allocate+register char device %s",
MYDRVNAME);
- goto Away;
+ return -1;
}
- Registered = TRUE;
- INFODRV("New major number %d registered\n", MAJOR(MajorDev));
+ registered = TRUE;
+ INFODRV("New major number %d registered\n", MAJOR(majordev));
} else {
/* static major device number registration required */
- if (register_chrdev_region(MajorDev, 1, MYDRVNAME) < 0) {
+ if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) {
ERRDRV("Unable to register char device %s", MYDRVNAME);
- goto Away;
+ return -1;
}
- Registered = TRUE;
- INFODRV("Static major number %d registered\n", MAJOR(MajorDev));
+ registered = TRUE;
+ INFODRV("Static major number %d registered\n", MAJOR(majordev));
}
- if (cdev_add(&Cdev, MKDEV(MAJOR(MajorDev), 0), 1) < 0) {
+ rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1);
+ if (rc < 0) {
ERRDRV("failed to create char device: (status=%d)\n", rc);
- goto Away;
+ return -1;
}
INFODRV("Registered char device for %s (major=%d)",
- MYDRVNAME, MAJOR(MajorDev));
- rc = 0;
-Away:
- return rc;
+ MYDRVNAME, MAJOR(majordev));
+ return 0;
}
void
visorchipset_file_cleanup(void)
{
- if (Cdev.ops != NULL)
- cdev_del(&Cdev);
- Cdev.ops = NULL;
- if (Registered) {
- if (MAJOR(MajorDev) >= 0) {
- unregister_chrdev_region(MajorDev, 1);
- MajorDev = MKDEV(0, 0);
+ if (file_cdev.ops != NULL)
+ cdev_del(&file_cdev);
+ file_cdev.ops = NULL;
+ if (registered) {
+ if (MAJOR(majordev) >= 0) {
+ unregister_chrdev_region(majordev, 1);
+ majordev = MKDEV(0, 0);
}
- Registered = FALSE;
+ registered = FALSE;
}
}
@@ -114,17 +104,12 @@ static int
visorchipset_open(struct inode *inode, struct file *file)
{
unsigned minor_number = iminor(inode);
- int rc = -ENODEV;
DEBUGDRV("%s", __func__);
if (minor_number != 0)
- goto Away;
+ return -ENODEV;
file->private_data = NULL;
- rc = 0;
-Away:
- if (rc < 0)
- ERRDRV("%s minor=%d failed", __func__, minor_number);
- return rc;
+ return 0;
}
static int
@@ -137,7 +122,7 @@ visorchipset_release(struct inode *inode, struct file *file)
static int
visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
{
- ulong physAddr = 0;
+ ulong physaddr = 0;
ulong offset = vma->vm_pgoff << PAGE_SHIFT;
GUEST_PHYSICAL_ADDRESS addr = 0;
@@ -150,11 +135,11 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
switch (offset) {
case VISORCHIPSET_MMAP_CONTROLCHANOFFSET:
vma->vm_flags |= VM_IO;
- if (*PControlVm_channel == NULL) {
+ if (*file_controlvm_channel == NULL) {
ERRDRV("%s no controlvm channel yet", __func__);
return -ENXIO;
}
- visorchannel_read(*PControlVm_channel,
+ visorchannel_read(*file_controlvm_channel,
offsetof(struct spar_controlvm_channel_protocol,
gp_control_channel),
&addr, sizeof(addr));
@@ -162,10 +147,10 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
ERRDRV("%s control channel address is 0", __func__);
return -ENXIO;
}
- physAddr = (ulong) (addr);
- DEBUGDRV("mapping physical address = 0x%lx", physAddr);
+ physaddr = (ulong)addr;
+ DEBUGDRV("mapping physical address = 0x%lx", physaddr);
if (remap_pfn_range(vma, vma->vm_start,
- physAddr >> PAGE_SHIFT,
+ physaddr >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
/*pgprot_noncached */
(vma->vm_page_prot))) {
@@ -180,16 +165,8 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
return 0;
}
-#ifdef HAVE_UNLOCKED_IOCTL
-long
-visorchipset_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-#else
-int
-visorchipset_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
-#endif
+long visorchipset_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- int rc = SUCCESS;
s64 adjustment;
s64 vrtc_offset;
@@ -200,28 +177,21 @@ visorchipset_ioctl(struct inode *inode, struct file *file,
vrtc_offset = issue_vmcall_query_guest_virtual_time_offset();
if (copy_to_user
((void __user *)arg, &vrtc_offset, sizeof(vrtc_offset))) {
- rc = -EFAULT;
- goto Away;
+ return -EFAULT;
}
DBGINF("insde visorchipset_ioctl, cmd=%d, vrtc_offset=%lld",
cmd, vrtc_offset);
- break;
+ return SUCCESS;
case VMCALL_UPDATE_PHYSICAL_TIME:
if (copy_from_user
(&adjustment, (void __user *)arg, sizeof(adjustment))) {
- rc = -EFAULT;
- goto Away;
+ return -EFAULT;
}
DBGINF("insde visorchipset_ioctl, cmd=%d, adjustment=%lld", cmd,
adjustment);
- rc = issue_vmcall_update_physical_time(adjustment);
- break;
+ return issue_vmcall_update_physical_time(adjustment);
default:
LOGERR("visorchipset_ioctl received invalid command");
- rc = -EFAULT;
- break;
+ return -EFAULT;
}
-Away:
- DBGINF("exiting %d!", rc);
- return rc;
}
diff --git a/drivers/staging/unisys/visorchipset/file.h b/drivers/staging/unisys/visorchipset/file.h
index 21bb906242e1..dc7a19556b3f 100644
--- a/drivers/staging/unisys/visorchipset/file.h
+++ b/drivers/staging/unisys/visorchipset/file.h
@@ -20,7 +20,8 @@
#include "globals.h"
-int visorchipset_file_init(dev_t majorDev, VISORCHANNEL **pControlVm_channel);
+int visorchipset_file_init(dev_t majorDev,
+ struct visorchannel **pControlVm_channel);
void visorchipset_file_cleanup(void);
#endif
diff --git a/drivers/staging/unisys/visorchipset/globals.h b/drivers/staging/unisys/visorchipset/globals.h
index 0fe14599f185..a1d35d4bef2e 100644
--- a/drivers/staging/unisys/visorchipset/globals.h
+++ b/drivers/staging/unisys/visorchipset/globals.h
@@ -15,7 +15,6 @@
* details.
*/
-
#ifndef __VISORCHIPSET_GLOBALS_H__
#define __VISORCHIPSET_GLOBALS_H__
@@ -28,7 +27,6 @@
#define MYDRVNAME "visorchipset"
-
/* module parameters */
extern int visorchipset_testvnic;
diff --git a/drivers/staging/unisys/visorchipset/testing.h b/drivers/staging/unisys/visorchipset/testing.h
deleted file mode 100644
index 573aa8b5ba6a..000000000000
--- a/drivers/staging/unisys/visorchipset/testing.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* testing.h
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT. See the GNU General Public License for more
- * details.
- */
-
-#ifndef __VISORCHIPSET_TESTING_H__
-#define __VISORCHIPSET_TESTING_H__
-
-#define VISORCHIPSET_TEST_PROC
-#include <linux/uuid.h>
-#include "globals.h"
-#include "controlvmchannel.h"
-
-void test_produce_test_message(struct controlvm_message *msg,
- int isLocalTestAddr);
-BOOL test_consume_test_message(struct controlvm_message *msg);
-void test_manufacture_vnic_client_add(void *p);
-void test_manufacture_vnic_client_add_phys(HOSTADDRESS addr);
-void test_manufacture_preamble_messages(void);
-void test_manufacture_device_attach(ulong busNo, ulong devNo);
-void test_manufacture_device_add(ulong busNo, ulong devNo, uuid_le dataTypeGuid,
- void *pChannel);
-void test_manufacture_add_bus(ulong busNo, ulong maxDevices,
- uuid_le id, u8 *name, BOOL isServer);
-void test_manufacture_device_destroy(ulong busNo, ulong devNo);
-void test_manufacture_bus_destroy(ulong busNo);
-void test_manufacture_detach_externalPort(ulong switchNo, ulong externalPortNo);
-void test_manufacture_detach_internalPort(ulong switchNo, ulong internalPortNo);
-void test_cleanup(void);
-
-#endif
diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h
index 46dad63fa2c8..98f3ba4c13ac 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset.h
+++ b/drivers/staging/unisys/visorchipset/visorchipset.h
@@ -158,61 +158,6 @@ findbus(struct list_head *list, u32 bus_no)
return NULL;
}
-/** Attributes for a particular Supervisor switch.
- */
-struct visorchipset_switch_info {
- u32 switch_no;
- struct visorchipset_state state;
- uuid_le switch_type_uuid;
- u8 *authservice1;
- u8 *authservice2;
- u8 *authservice3;
- u8 *security_context;
- u64 reserved;
- u32 reserved2; /* control_vm_id */
- struct device dev;
- BOOL dev_exists;
- struct controlvm_message_header pending_msg_hdr;
-};
-
-/** Attributes for a particular Supervisor external port, which is connected
- * to a specific switch.
- */
-struct visorchipset_externalport_info {
- u32 switch_no;
- u32 external_port_no;
- struct visorchipset_state state;
- uuid_le network_zone_uuid;
- int pd_port;
- u8 *ip;
- u8 *ip_netmask;
- u8 *ip_broadcast;
- u8 *ip_network;
- u8 *ip_gateway;
- u8 *ip_dns;
- u64 reserved1;
- u32 reserved2; /* control_vm_id */
- struct device dev;
- BOOL dev_exists;
- struct controlvm_message_header pending_msg_hdr;
-};
-
-/** Attributes for a particular Supervisor internal port, which is how a
- * device connects to a particular switch.
- */
-struct visorchipset_internalport_info {
- u32 switch_no;
- u32 internal_port_no;
- struct visorchipset_state state;
- u32 bus_no; /* valid only when state.attached == 1 */
- u32 dev_no; /* valid only when state.attached == 1 */
- u64 reserved1;
- u32 reserved2; /* CONTROLVM_ID */
- struct controlvm_message_header pending_msg_hdr;
- MYPROCOBJECT *proc_object;
-
-};
-
/* These functions will be called from within visorchipset when certain
* events happen. (The implementation of these functions is outside of
* visorchipset.)
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 7e6be32cf7bb..f606ee9e0de9 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -20,7 +20,6 @@
#include "procobjecttree.h"
#include "visorchannel.h"
#include "periodic_work.h"
-#include "testing.h"
#include "file.h"
#include "parser.h"
#include "uniklog.h"
@@ -102,7 +101,7 @@ static struct controlvm_message_packet g_DeviceChangeStatePacket;
static LIST_HEAD(BusInfoList);
static LIST_HEAD(DevInfoList);
-static VISORCHANNEL *ControlVm_channel;
+static struct visorchannel *ControlVm_channel;
typedef struct {
u8 __iomem *ptr; /* pointer to base address of payload pool */
@@ -1595,7 +1594,7 @@ parahotplug_next_id(void)
static unsigned long
parahotplug_next_expiration(void)
{
- return jiffies + PARAHOTPLUG_TIMEOUT_MS * HZ / 1000;
+ return jiffies + msecs_to_jiffies(PARAHOTPLUG_TIMEOUT_MS);
}
/*
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_umode.h b/drivers/staging/unisys/visorchipset/visorchipset_umode.h
index 06ba5b7e4254..6cf6eccb3f4a 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_umode.h
+++ b/drivers/staging/unisys/visorchipset/visorchipset_umode.h
@@ -26,8 +26,6 @@
#ifndef __VISORCHIPSET_UMODE_H
#define __VISORCHIPSET_UMODE_H
-
-
/** The user-mode program can access the control channel buffer directly
* via this memory map.
*/