]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: unisys: move timskmod.h functionality
authorErik Arfvidson <erik.arfvidson@unisys.com>
Tue, 5 May 2015 22:37:04 +0000 (18:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:27:31 +0000 (15:27 +0200)
This patch removes all timksmod.h pound defines. It also removes
visorkmodutils.c since it no longer has any use by itself. Since
visorkmodutils.c is no longer needed the module_init for
visorchipset.c is modified to call visorutil_spar_detect directly
instead of the extern variable in timksmod.h.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/include/periodic_work.h
drivers/staging/unisys/include/timskmod.h
drivers/staging/unisys/include/visorbus.h
drivers/staging/unisys/visorbus/visorbus_main.c
drivers/staging/unisys/visorbus/visorbus_private.h
drivers/staging/unisys/visorbus/visorchannel.c
drivers/staging/unisys/visorbus/visorchipset.c
drivers/staging/unisys/visorutil/Makefile
drivers/staging/unisys/visorutil/periodic_work.c
drivers/staging/unisys/visorutil/visorkmodutils.c [deleted file]

index 21939db22bba68e32f7c7ff12fe005149c7379ff..65bad08dcb01419d23320dfd5c6b9457e9d8bafd 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "timskmod.h"
 
+
 /* PERIODIC_WORK an opaque structure to users.
  * Fields are declared only in the implementation .c files.
  */
index 2ee2275591818b2ee588bc93d1ce57fa46d6d22d..30d8e7a7e0cdf925a7d018b7ca39adc51710fd09 100644 (file)
 #include <linux/seq_file.h>
 #include <linux/mm.h>
 
-/* #define DEBUG */
-#if !defined SUCCESS
-#define SUCCESS 0
-#endif
-#define MIN(a, b)     (((a) < (b)) ? (a) : (b))
-#define MAX(a, b)     (((a) > (b)) ? (a) : (b))
-#define STRUCTSEQUAL(x, y) (memcmp(&x, &y, sizeof(x)) == 0)
-#ifndef HOSTADDRESS
-#define HOSTADDRESS unsigned long long
-#endif
-
-#define sizeofmember(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
-/** "Covered quotient" function */
-#define COVQ(v, d)  (((v) + (d) - 1) / (d))
-#define SWAPPOINTERS(p1, p2)                           \
-       do {                                            \
-               void *SWAPPOINTERS_TEMP = (void *)p1;   \
-               (void *)(p1) = (void *)(p2);            \
-               (void *)(p2) = SWAPPOINTERS_TEMP;       \
-       } while (0)
-
-#define WARNDRV(fmt, args...)   LOGWRN(fmt, ## args)
-#define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args)
-
-#define PRINTKDEV(devname, fmt, args...)  LOGINFDEV(devname, fmt, ## args)
-#define TBDDEV(devname, fmt, args...)     LOGERRDEV(devname, fmt, ## args)
-#define HUHDEV(devname, fmt, args...)     LOGERRDEV(devname, fmt, ## args)
-#define ERRDEV(devname, fmt, args...)     LOGERRDEV(devname, fmt, ## args)
-#define ERRDEVX(devno, fmt, args...)     LOGERRDEVX(devno, fmt, ## args)
-#define WARNDEV(devname, fmt, args...)    LOGWRNDEV(devname, fmt, ## args)
-#define SECUREDEV(devname, fmt, args...)  LOGWRNDEV(devname, fmt, ## args)
-#define INFODEV(devname, fmt, args...)    LOGINFDEV(devname, fmt, ## args)
-#define INFODEVX(devno, fmt, args...)     LOGINFDEVX(devno, fmt, ## args)
-
-/** Verifies the consistency of your PRIVATEDEVICEDATA structure using
- *  conventional "signature" fields:
- *  <p>
- *  - sig1 should contain the size of the structure
- *  - sig2 should contain a pointer to the beginning of the structure
- */
-#define DDLOOKSVALID(dd)                                 \
-               ((dd != NULL)                             &&    \
-                ((dd)->sig1 == sizeof(PRIVATEDEVICEDATA)) &&   \
-                ((dd)->sig2 == dd))
-
-/** Verifies the consistency of your PRIVATEFILEDATA structure using
- *  conventional "signature" fields:
- *  <p>
- *  - sig1 should contain the size of the structure
- *  - sig2 should contain a pointer to the beginning of the structure
- */
-#define FDLOOKSVALID(fd)                               \
-       ((fd != NULL)                           &&     \
-        ((fd)->sig1 == sizeof(PRIVATEFILEDATA)) &&    \
-        ((fd)->sig2 == fd))
-
-/** Sleep for an indicated number of seconds (for use in kernel mode).
- *  x - the number of seconds to sleep.
- */
-#define SLEEP(x)                                            \
-       do { __set_current_state(TASK_INTERRUPTIBLE);        \
-               schedule_timeout((x)*HZ);                    \
-       } while (0)
-
-/** Sleep for an indicated number of jiffies (for use in kernel mode).
- *  x - the number of jiffies to sleep.
- */
-#define SLEEPJIFFIES(x)                                                    \
-       do { __set_current_state(TASK_INTERRUPTIBLE);               \
-               schedule_timeout(x);                                \
-       } while (0)
-
-static inline struct cdev *cdev_alloc_init(struct module *owner,
-                                          const struct file_operations *fops)
-{
-       struct cdev *cdev = NULL;
-
-       cdev = cdev_alloc();
-       if (!cdev)
-               return NULL;
-       cdev->ops = fops;
-       cdev->owner = owner;
-
-       /* Note that the memory allocated for cdev will be deallocated
-        * when the usage count drops to 0, because it is controlled
-        * by a kobject of type ktype_cdev_dynamic.  (This
-        * deallocation could very well happen outside of our kernel
-        * module, like via the cdev_put in __fput() for example.)
-        */
-       return cdev;
-}
-
-extern int unisys_spar_platform;
-
 #endif
index bce8aa255f7464d9b034e4ec5870777e5a4d355d..f97e203c2e7f380668e0f17d0fcdf5ea74e80aa1 100644 (file)
 #include "periodic_work.h"
 #include "channel.h"
 
-#ifndef HOSTADDRESS
-#define HOSTADDRESS u64
-#endif
-
 struct visor_driver;
 struct visor_device;
 
@@ -170,9 +166,9 @@ void visorbus_disable_channel_interrupts(struct visor_device *dev);
  * <channel_bytes> and <guid> arguments may be 0 if we are a channel CLIENT.
  * In this case, the values can simply be read from the channel header.
  */
-struct visorchannel *visorchannel_create(HOSTADDRESS physaddr,
+struct visorchannel *visorchannel_create(u64 physaddr,
                                         ulong channel_bytes, uuid_le guid);
-struct visorchannel *visorchannel_create_with_lock(HOSTADDRESS physaddr,
+struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
                                                   ulong channel_bytes,
                                                   uuid_le guid);
 void visorchannel_destroy(struct visorchannel *channel);
@@ -189,7 +185,7 @@ bool visorchannel_signalinsert(struct visorchannel *channel, u32 queue,
 int visorchannel_signalqueue_slots_avail(struct visorchannel *channel,
                                         u32 queue);
 int visorchannel_signalqueue_max_slots(struct visorchannel *channel, u32 queue);
-HOSTADDRESS visorchannel_get_physaddr(struct visorchannel *channel);
+u64 visorchannel_get_physaddr(struct visorchannel *channel);
 ulong visorchannel_get_nbytes(struct visorchannel *channel);
 char *visorchannel_id(struct visorchannel *channel, char *s);
 char *visorchannel_zoneid(struct visorchannel *channel, char *s);
index b522ea4d2c2dada6fed19036459dcadaa86c4f69..914298b73282b325d2b8a9542f4d21a8a497618b 100644 (file)
@@ -1428,7 +1428,7 @@ remove_visor_device(struct visor_device *dev)
 }
 
 static struct visor_device *
-find_visor_device_by_channel(HOSTADDRESS channel_physaddr)
+find_visor_device_by_channel(u64 channel_physaddr)
 {
        struct list_head *listentry, *listtmp;
 
@@ -1607,8 +1607,9 @@ fix_vbus_dev_info(struct visor_device *visordev)
         * type name
         */
        for (i = 0; visordrv->channel_types[i].name; i++) {
-               if (STRUCTSEQUAL(visordrv->channel_types[i].guid,
-                                visordev->channel_type_guid)) {
+               if (memcmp(&visordrv->channel_types[i].guid,
+                          &visordev->channel_type_guid,
+                          sizeof(visordrv->channel_types[i].guid)) == 0) {
                        chan_type_name = visordrv->channel_types[i].name;
                        break;
                }
@@ -1667,7 +1668,7 @@ create_bus_instance(int id)
        if ((visorchipset_get_bus_info(id, &bus_info)) &&
            (bus_info.chan_info.channel_addr > 0) &&
            (bus_info.chan_info.n_channel_bytes > 0)) {
-               HOSTADDRESS channel_addr = bus_info.chan_info.channel_addr;
+               u64 channel_addr = bus_info.chan_info.channel_addr;
                unsigned long n_channel_bytes =
                                (unsigned long)
                                bus_info.chan_info.n_channel_bytes;
index 1153c99e813f8ab6356ef9bad45483eece9017db..32e26ed5208558e375bf94431baaee1ff74e449a 100644 (file)
@@ -54,7 +54,7 @@ enum visorchipset_addresstype {
  */
 struct visorchipset_channel_info {
        enum visorchipset_addresstype addr_type;
-       HOSTADDRESS channel_addr;
+       u64 channel_addr;
        struct irq_info intr;
        u64 n_channel_bytes;
        uuid_le channel_type_uuid;
index bf1e039df7afc0ebf174b26d5a4bc365b57782fb..44ea4346280344eedade1c2f82a31ce8eb6d44ba 100644 (file)
@@ -27,7 +27,7 @@
 #define MYDRVNAME "visorchannel"
 
 struct visorchannel {
-       HOSTADDRESS physaddr;
+       u64 physaddr;
        ulong nbytes;
        void __iomem *mapped;
        struct channel_header chan_hdr;
@@ -50,7 +50,7 @@ struct visorchannel {
  * but does NOT modify this data area.
  */
 static struct visorchannel *
-visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
+visorchannel_create_guts(u64 physaddr, ulong channel_bytes,
                         ulong off, uuid_le guid, bool needs_lock)
 {
        struct visorchannel *channel;
@@ -112,7 +112,7 @@ cleanup:
 }
 
 struct visorchannel *
-visorchannel_create(HOSTADDRESS physaddr, ulong channel_bytes, uuid_le guid)
+visorchannel_create(u64 physaddr, ulong channel_bytes, uuid_le guid)
 {
        return visorchannel_create_guts(physaddr, channel_bytes, 0, guid,
                                        false);
@@ -120,7 +120,7 @@ visorchannel_create(HOSTADDRESS physaddr, ulong channel_bytes, uuid_le guid)
 EXPORT_SYMBOL_GPL(visorchannel_create);
 
 struct visorchannel *
-visorchannel_create_with_lock(HOSTADDRESS physaddr, ulong channel_bytes,
+visorchannel_create_with_lock(u64 physaddr, ulong channel_bytes,
                              uuid_le guid)
 {
        return visorchannel_create_guts(physaddr, channel_bytes, 0, guid,
@@ -141,7 +141,7 @@ visorchannel_destroy(struct visorchannel *channel)
 }
 EXPORT_SYMBOL_GPL(visorchannel_destroy);
 
-HOSTADDRESS
+u64
 visorchannel_get_physaddr(struct visorchannel *channel)
 {
        return channel->physaddr;
@@ -177,7 +177,7 @@ visorchannel_zoneid(struct visorchannel *channel, char *s)
 }
 EXPORT_SYMBOL_GPL(visorchannel_zoneid);
 
-HOSTADDRESS
+u64
 visorchannel_get_clientpartition(struct visorchannel *channel)
 {
        return channel->chan_hdr.partition_handle;
@@ -498,7 +498,7 @@ void
 visorchannel_debug(struct visorchannel *channel, int num_queues,
                   struct seq_file *seq, u32 off)
 {
-       HOSTADDRESS addr = 0;
+       u64 addr = 0;
        ulong nbytes = 0, nbytes_region = 0;
        struct channel_header hdr;
        struct channel_header *phdr = &hdr;
index fde89938cee52f63f0ccf882ffe377ec90188e84..8ff79c0eeff23b01e2c0fd12c0c133231e7c1129 100644 (file)
 
 #define VISORCHIPSET_MMAP_CONTROLCHANOFFSET    0x00000000
 
+
+#define UNISYS_SPAR_LEAF_ID 0x40000000
+
+/* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
+#define UNISYS_SPAR_ID_EBX 0x73696e55
+#define UNISYS_SPAR_ID_ECX 0x70537379
+#define UNISYS_SPAR_ID_EDX 0x34367261
+
 /*
  * Module parameters
  */
@@ -1675,7 +1683,7 @@ my_device_destroy(struct controlvm_message *inmsg)
  * for failure.
  */
 static int
-initialize_controlvm_payload_info(HOSTADDRESS phys_addr, u64 offset, u32 bytes,
+initialize_controlvm_payload_info(u64 phys_addr, u64 offset, u32 bytes,
                                  struct visor_controlvm_payload_info *info)
 {
        u8 __iomem *payload = NULL;
@@ -1723,7 +1731,7 @@ destroy_controlvm_payload_info(struct visor_controlvm_payload_info *info)
 static void
 initialize_controlvm_payload(void)
 {
-       HOSTADDRESS phys_addr = visorchannel_get_physaddr(controlvm_channel);
+       u64 phys_addr = visorchannel_get_physaddr(controlvm_channel);
        u64 payload_offset = 0;
        u32 payload_bytes = 0;
 
@@ -2056,7 +2064,7 @@ parahotplug_process_message(struct controlvm_message *inmsg)
  *            either successfully or with an error.
  */
 static bool
-handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
+handle_command(struct controlvm_message inmsg, u64 channel_addr)
 {
        struct controlvm_message_packet *cmd = &inmsg.cmd;
        u64 parm_addr;
@@ -2152,7 +2160,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
        return true;
 }
 
-static HOSTADDRESS controlvm_get_channel_address(void)
+static u64 controlvm_get_channel_address(void)
 {
        u64 addr = 0;
        u32 size = 0;
@@ -2589,7 +2597,7 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd,
                                 sizeof(vrtc_offset))) {
                        return -EFAULT;
                }
-               return SUCCESS;
+               return 0;
        case VMCALL_UPDATE_PHYSICAL_TIME:
                if (copy_from_user(&adjustment, (void __user *)arg,
                                   sizeof(adjustment))) {
@@ -2642,7 +2650,7 @@ static int
 visorchipset_init(struct acpi_device *acpi_device)
 {
        int rc = 0;
-       HOSTADDRESS addr;
+       u64 addr;
 
        memset(&busdev_notifiers, 0, sizeof(busdev_notifiers));
        memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info));
@@ -2758,7 +2766,6 @@ static const struct acpi_device_id unisys_device_ids[] = {
        {"PNP0A07", 0},
        {"", 0},
 };
-MODULE_DEVICE_TABLE(acpi, unisys_device_ids);
 
 static struct acpi_driver unisys_acpi_driver = {
        .name = "unisys_acpi",
@@ -2770,12 +2777,25 @@ static struct acpi_driver unisys_acpi_driver = {
                .remove = visorchipset_exit,
                },
 };
+static __init uint32_t visorutil_spar_detect(void)
+{
+       unsigned int eax, ebx, ecx, edx;
+
+       if (cpu_has_hypervisor) {
+               /* check the ID */
+               cpuid(UNISYS_SPAR_LEAF_ID, &eax, &ebx, &ecx, &edx);
+               return  (ebx == UNISYS_SPAR_ID_EBX) &&
+                       (ecx == UNISYS_SPAR_ID_ECX) &&
+                       (edx == UNISYS_SPAR_ID_EDX);
+       } else {
+               return 0;
+       }
+}
 
 static int init_unisys(void)
 {
        int result;
-
-       if (!unisys_spar_platform)
+       if (!visorutil_spar_detect())
                return -ENODEV;
 
        result = acpi_bus_register_driver(&unisys_acpi_driver);
index f29978772ca348225f416a0c0d7d5e8851f95ae3..88db0851747159e909b3ee93b940e5331357f6c2 100644 (file)
@@ -4,6 +4,6 @@
 
 obj-$(CONFIG_UNISYS_VISORUTIL) += visorutil.o
 
-visorutil-y := charqueue.o periodic_work.o visorkmodutils.o
+visorutil-y := charqueue.o periodic_work.o
 
 ccflags-y += -Idrivers/staging/unisys/include
index aa357a297f489bd3a1b2e1e3fa2116180859e1b5..aa0c1f8757297e8ed6c48a895b878801560b2aab 100644 (file)
@@ -18,6 +18,7 @@
 /*
  *  Helper functions to schedule periodic work in Linux kernel mode.
  */
+#include <linux/sched.h>
 
 #include "timskmod.h"
 #include "periodic_work.h"
@@ -192,7 +193,8 @@ bool visor_periodic_work_stop(struct periodic_work *pw)
                }
                if (pw->is_scheduled) {
                        write_unlock(&pw->lock);
-                       SLEEPJIFFIES(10);
+                       __set_current_state(TASK_INTERRUPTIBLE);
+                       schedule_timeout(10);
                        write_lock(&pw->lock);
                } else {
                        pw->want_to_stop = false;
diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c
deleted file mode 100644 (file)
index 0b8f5c1..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/* timskmodutils.c
- *
- * 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.
- */
-
-#include "timskmod.h"
-
-#define MYDRVNAME "timskmodutils"
-
-/* s-Par uses the Intel processor's VT-X features to separate groups of
- * processors into partitions. The firmware sets the hypervisor bit and
- * reports an ID in the HV capabilities leaf so that the partition's OS
- * knows s-Par is present and managing the processors.
- */
-
-#define UNISYS_SPAR_LEAF_ID 0x40000000
-
-/* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
-#define UNISYS_SPAR_ID_EBX 0x73696e55
-#define UNISYS_SPAR_ID_ECX 0x70537379
-#define UNISYS_SPAR_ID_EDX 0x34367261
-
-int unisys_spar_platform;
-EXPORT_SYMBOL_GPL(unisys_spar_platform);
-
-static __init uint32_t visorutil_spar_detect(void)
-{
-       unsigned int eax, ebx, ecx, edx;
-
-       if (cpu_has_hypervisor) {
-               /* check the ID */
-               cpuid(UNISYS_SPAR_LEAF_ID, &eax, &ebx, &ecx, &edx);
-               return  (ebx == UNISYS_SPAR_ID_EBX) &&
-                       (ecx == UNISYS_SPAR_ID_ECX) &&
-                       (edx == UNISYS_SPAR_ID_EDX);
-       } else {
-               return 0;
-       }
-}
-
-static __init int visorutil_mod_init(void)
-{
-       if (visorutil_spar_detect()) {
-               unisys_spar_platform = true;
-               return 0;
-       } else {
-               return -ENODEV;
-       }
-}
-
-static __exit void
-visorutil_mod_exit(void)
-{
-}
-
-module_init(visorutil_mod_init);
-module_exit(visorutil_mod_exit);
-
-MODULE_LICENSE("GPL");