]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge branch 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 13 Aug 2011 03:55:49 +0000 (20:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 13 Aug 2011 03:55:49 +0000 (20:55 -0700)
* 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6:
  zcache: Fix build error when sysfs is not defined
  zcache: Use div_u64 for 64-bit division
  staging:rts_pstor: fix thread synchronization flow
  drivers:staging:solo6x10:add the missed slab.h
  staging: zcache: include module.h for MODULE_LICENSE
  drivers/staging/hv/blkvsc_drv.c: eliminate NULL pointer dereference
  Staging: Add clk API note to nvec/TODO
  drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c: adjust array index
  staging: more missing slab.h inclusions
  drivers/staging/solo6x10/p2m.c needs slab.h
  drivers/staging/solo6x10/core.c needs slab.h
  drivers/staging/dt3155v4l/dt3155v4l.c needs slab.h
  drivers/staging/speakup/devsynth.c: fix "buffer size is not provably correct" error
  Staging: iio: add some unlocks to raw_read() functions
  staging: ft1000_proc needs asm/io.h for inw/outw on sparc
  staging: rtl8192u: declare MODULE_FIRMWARE
  gma500: Fix clashes with DRM updates
  staging: zcache: module is GPL
  staging: fix zcache building

21 files changed:
drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
drivers/staging/dt3155v4l/dt3155v4l.c
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
drivers/staging/hv/blkvsc_drv.c
drivers/staging/iio/accel/adis16203_core.c
drivers/staging/iio/accel/adis16204_core.c
drivers/staging/iio/accel/adis16209_core.c
drivers/staging/iio/accel/adis16240_core.c
drivers/staging/iio/gyro/adis16260_core.c
drivers/staging/nvec/TODO
drivers/staging/rtl8192u/r819xU_firmware.c
drivers/staging/rts_pstor/rtsx.c
drivers/staging/rts_pstor/rtsx.h
drivers/staging/solo6x10/core.c
drivers/staging/solo6x10/enc.c
drivers/staging/solo6x10/g723.c
drivers/staging/solo6x10/p2m.c
drivers/staging/solo6x10/solo6x10.h
drivers/staging/speakup/devsynth.c
drivers/staging/zcache/Makefile
drivers/staging/zcache/zcache-main.c [moved from drivers/staging/zcache/zcache.c with 99% similarity]

index c01c0cb0af4e83ced297d74b04b44b89d53733e7..b99a11a9dd6930d4978e062ebb570de09ebf3f03 100644 (file)
@@ -812,7 +812,7 @@ int AthCreateCommandList(struct ps_cmd_packet **HciPacketList, u32 *numPackets)
     for(count = 0; count < Patch_Count; count++) {
 
         AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Freeing Patch Buffer %d \r\n",count));
-        kfree(RamPatch[Patch_Count].Data);
+       kfree(RamPatch[count].Data);
     }
 
     for(count = 0; count < Tag_Count; count++) {
index fe02d22274b4d21b3f5cf69943fd49fe4a9dc8b0..05aa41cf875bb9df300bf071c2202fbb9a45d46b 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/stringify.h>
 #include <linux/delay.h>
 #include <linux/kthread.h>
+#include <linux/slab.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-dma-contig.h>
index 627a98b4ec308095b4a197184914b64d611b9a6c..9e728b3415e324ca9edaddc7416fe119c60a7ef6 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/string.h>
 #include <linux/vmalloc.h>
 #include <linux/netdevice.h>
+#include <asm/io.h>
 #include <asm/uaccess.h>
 #include "ft1000.h"
 
index 3612574ca52087c6a192a5ab061479d7403e08ab..d286b2223181623d284a8bd9b17ecce5445a899c 100644 (file)
@@ -325,7 +325,7 @@ static int blkvsc_do_operation(struct block_device_context *blkdev,
 
        page_buf = alloc_page(GFP_KERNEL);
        if (!page_buf) {
-               kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req);
+               kmem_cache_free(blkdev->request_pool, blkvsc_req);
                return -ENOMEM;
        }
 
@@ -422,7 +422,7 @@ cleanup:
 
        __free_page(page_buf);
 
-       kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req);
+       kmem_cache_free(blkdev->request_pool, blkvsc_req);
 
        return ret;
 }
index bf1988884e93e1e22807eaea7d212f0ba1712520..cf5d15da76ada1038b3fc31baa8863a626bdae8b 100644 (file)
@@ -311,13 +311,17 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
                mutex_lock(&indio_dev->mlock);
                addr = adis16203_addresses[chan->address][0];
                ret = adis16203_spi_read_reg_16(indio_dev, addr, &val16);
-               if (ret)
+               if (ret) {
+                       mutex_unlock(&indio_dev->mlock);
                        return ret;
+               }
 
                if (val16 & ADIS16203_ERROR_ACTIVE) {
                        ret = adis16203_check_status(indio_dev);
-                       if (ret)
+                       if (ret) {
+                               mutex_unlock(&indio_dev->mlock);
                                return ret;
+                       }
                }
                val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
                if (chan->scan_type.sign == 's')
index cfd09b3b9937e2d5e657222cce944cab87a2c2f1..3e2b62654b7d42e89ca8592b11e76dedc45ce1aa 100644 (file)
@@ -341,13 +341,17 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
                mutex_lock(&indio_dev->mlock);
                addr = adis16204_addresses[chan->address][0];
                ret = adis16204_spi_read_reg_16(indio_dev, addr, &val16);
-               if (ret)
+               if (ret) {
+                       mutex_unlock(&indio_dev->mlock);
                        return ret;
+               }
 
                if (val16 & ADIS16204_ERROR_ACTIVE) {
                        ret = adis16204_check_status(indio_dev);
-                       if (ret)
+                       if (ret) {
+                               mutex_unlock(&indio_dev->mlock);
                                return ret;
+                       }
                }
                val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
                if (chan->scan_type.sign == 's')
index 55f3a7bcaf0a67b8603de9ee0c7d6bbb5cfa7439..bec1fa8de9b9eb3aab1b0d021d0d193245e9537d 100644 (file)
@@ -337,13 +337,17 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
                mutex_lock(&indio_dev->mlock);
                addr = adis16209_addresses[chan->address][0];
                ret = adis16209_spi_read_reg_16(indio_dev, addr, &val16);
-               if (ret)
+               if (ret) {
+                       mutex_unlock(&indio_dev->mlock);
                        return ret;
+               }
 
                if (val16 & ADIS16209_ERROR_ACTIVE) {
                        ret = adis16209_check_status(indio_dev);
-                       if (ret)
+                       if (ret) {
+                               mutex_unlock(&indio_dev->mlock);
                                return ret;
+                       }
                }
                val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
                if (chan->scan_type.sign == 's')
index 4a4eafc58630998d96c2bfdb0d96e3288636ca77..aee8b69173c440f581774738c7a51b5ae1c1e46b 100644 (file)
@@ -370,13 +370,17 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
                mutex_lock(&indio_dev->mlock);
                addr = adis16240_addresses[chan->address][0];
                ret = adis16240_spi_read_reg_16(indio_dev, addr, &val16);
-               if (ret)
+               if (ret) {
+                       mutex_unlock(&indio_dev->mlock);
                        return ret;
+               }
 
                if (val16 & ADIS16240_ERROR_ACTIVE) {
                        ret = adis16240_check_status(indio_dev);
-                       if (ret)
+                       if (ret) {
+                               mutex_unlock(&indio_dev->mlock);
                                return ret;
+                       }
                }
                val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
                if (chan->scan_type.sign == 's')
index 05797f404beaa7aded9702524b55b743e6c68a94..f2d43cfcc4937b6c15402f80341eb57fd1cdfe21 100644 (file)
@@ -446,13 +446,17 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
                mutex_lock(&indio_dev->mlock);
                addr = adis16260_addresses[chan->address][0];
                ret = adis16260_spi_read_reg_16(indio_dev, addr, &val16);
-               if (ret)
+               if (ret) {
+                       mutex_unlock(&indio_dev->mlock);
                        return ret;
+               }
 
                if (val16 & ADIS16260_ERROR_ACTIVE) {
                        ret = adis16260_check_status(indio_dev);
-                       if (ret)
+                       if (ret) {
+                               mutex_unlock(&indio_dev->mlock);
                                return ret;
+                       }
                }
                val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
                if (chan->scan_type.sign == 's')
index 77b47f763f22436d6cbeb44d684854c8c302ede6..649d6b70deaabc0d5d06a60bd4777e628a5675a5 100644 (file)
@@ -4,5 +4,7 @@ ToDo list (incomplete, unordered)
        - add compile as module support
        - move nvec devices to mfd cells?
        - adjust to kernel style
-
-
+       - fix clk usage
+         should not be using clk_get_sys(), but clk_get(&pdev->dev, conn)
+         where conn is either NULL if the device only has one clock, or
+         the device specific name if it has multiple clocks.
index 6766f468639f539fba5d6250fb7861d0690da8b6..4bb5fffca5b9a0d54c5191a412c060ca3233d0e0 100644 (file)
@@ -399,10 +399,7 @@ download_firmware_fail:
 
 }
 
-
-
-
-
-
-
+MODULE_FIRMWARE("RTL8192U/boot.img");
+MODULE_FIRMWARE("RTL8192U/main.img");
+MODULE_FIRMWARE("RTL8192U/data.img");
 
index 5ff59f27d101cf341f6660b98fb2945482957a4f..16c73fbff51fe52d9bd3b11d5e91a39a1654c573 100644 (file)
@@ -66,12 +66,6 @@ static int msi_en;
 module_param(msi_en, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(msi_en, "enable msi");
 
-/* These are used to make sure the module doesn't unload before all the
- * threads have exited.
- */
-static atomic_t total_threads = ATOMIC_INIT(0);
-static DECLARE_COMPLETION(threads_gone);
-
 static irqreturn_t rtsx_interrupt(int irq, void *dev_id);
 
 /***********************************************************************
@@ -192,7 +186,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
        /* enqueue the command and wake up the control thread */
        srb->scsi_done = done;
        chip->srb = srb;
-       up(&(dev->sema));
+       complete(&dev->cmnd_ready);
 
        return 0;
 }
@@ -475,7 +469,7 @@ static int rtsx_control_thread(void *__dev)
        current->flags |= PF_NOFREEZE;
 
        for (;;) {
-               if (down_interruptible(&dev->sema))
+               if (wait_for_completion_interruptible(&dev->cmnd_ready))
                        break;
 
                /* lock the device pointers */
@@ -557,8 +551,6 @@ SkipForAbort:
                mutex_unlock(&dev->dev_mutex);
        } /* for (;;) */
 
-       scsi_host_put(host);
-
        /* notify the exit routine that we're actually exiting now
         *
         * complete()/wait_for_completion() is similar to up()/down(),
@@ -573,7 +565,7 @@ SkipForAbort:
         * This is important in preemption kernels, which transfer the flow
         * of execution immediately upon a complete().
         */
-       complete_and_exit(&threads_gone, 0);
+       complete_and_exit(&dev->control_exit, 0);
 }
 
 
@@ -581,7 +573,6 @@ static int rtsx_polling_thread(void *__dev)
 {
        struct rtsx_dev *dev = (struct rtsx_dev *)__dev;
        struct rtsx_chip *chip = dev->chip;
-       struct Scsi_Host *host = rtsx_to_host(dev);
        struct sd_info *sd_card = &(chip->sd_card);
        struct xd_info *xd_card = &(chip->xd_card);
        struct ms_info *ms_card = &(chip->ms_card);
@@ -621,8 +612,7 @@ static int rtsx_polling_thread(void *__dev)
                mutex_unlock(&dev->dev_mutex);
        }
 
-       scsi_host_put(host);
-       complete_and_exit(&threads_gone, 0);
+       complete_and_exit(&dev->polling_exit, 0);
 }
 
 /*
@@ -699,29 +689,38 @@ static void rtsx_release_resources(struct rtsx_dev *dev)
 {
        printk(KERN_INFO "-- %s\n", __func__);
 
+       /* Tell the control thread to exit.  The SCSI host must
+        * already have been removed so it won't try to queue
+        * any more commands.
+        */
+       printk(KERN_INFO "-- sending exit command to thread\n");
+       complete(&dev->cmnd_ready);
+       if (dev->ctl_thread)
+               wait_for_completion(&dev->control_exit);
+       if (dev->polling_thread)
+               wait_for_completion(&dev->polling_exit);
+
+       wait_timeout(200);
+
        if (dev->rtsx_resv_buf) {
-               dma_free_coherent(&(dev->pci->dev), HOST_CMDS_BUF_LEN,
+               dma_free_coherent(&(dev->pci->dev), RTSX_RESV_BUF_LEN,
                                dev->rtsx_resv_buf, dev->rtsx_resv_buf_addr);
                dev->chip->host_cmds_ptr = NULL;
                dev->chip->host_sg_tbl_ptr = NULL;
        }
 
-       pci_disable_device(dev->pci);
-       pci_release_regions(dev->pci);
-
-       if (dev->irq > 0) {
+       if (dev->irq > 0)
                free_irq(dev->irq, (void *)dev);
-       }
-       if (dev->chip->msi_en) {
+       if (dev->chip->msi_en)
                pci_disable_msi(dev->pci);
-       }
+       if (dev->remap_addr)
+               iounmap(dev->remap_addr);
 
-       /* Tell the control thread to exit.  The SCSI host must
-        * already have been removed so it won't try to queue
-        * any more commands.
-        */
-       printk(KERN_INFO "-- sending exit command to thread\n");
-       up(&dev->sema);
+       pci_disable_device(dev->pci);
+       pci_release_regions(dev->pci);
+
+       rtsx_release_chip(dev->chip);
+       kfree(dev->chip);
 }
 
 /* First stage of disconnect processing: stop all commands and remove
@@ -739,6 +738,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
        scsi_unlock(host);
        mutex_unlock(&dev->dev_mutex);
        wake_up(&dev->delay_wait);
+       wait_for_completion(&dev->scanning_done);
 
        /* Wait some time to let other threads exist */
        wait_timeout(100);
@@ -793,8 +793,7 @@ static int rtsx_scan_thread(void *__dev)
                /* Should we unbind if no devices were detected? */
        }
 
-       scsi_host_put(rtsx_to_host(dev));
-       complete_and_exit(&threads_gone, 0);
+       complete_and_exit(&dev->scanning_done, 0);
 }
 
 static void rtsx_init_options(struct rtsx_chip *chip)
@@ -941,8 +940,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
 
        spin_lock_init(&dev->reg_lock);
        mutex_init(&(dev->dev_mutex));
-       sema_init(&(dev->sema), 0);
+       init_completion(&dev->cmnd_ready);
+       init_completion(&dev->control_exit);
+       init_completion(&dev->polling_exit);
        init_completion(&(dev->notify));
+       init_completion(&dev->scanning_done);
        init_waitqueue_head(&dev->delay_wait);
 
        dev->pci = pci;
@@ -992,28 +994,22 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
        pci_set_master(pci);
        synchronize_irq(dev->irq);
 
-       err = scsi_add_host(host, &pci->dev);
-       if (err) {
-               printk(KERN_ERR "Unable to add the scsi host\n");
-               goto errout;
-       }
-
        rtsx_init_chip(dev->chip);
 
        /* Start up our control thread */
-       th = kthread_create(rtsx_control_thread, dev, CR_DRIVER_NAME);
+       th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME);
        if (IS_ERR(th)) {
                printk(KERN_ERR "Unable to start control thread\n");
                err = PTR_ERR(th);
                goto errout;
        }
+       dev->ctl_thread = th;
 
-       /* Take a reference to the host for the control thread and
-        * count it among all the threads we have launched.  Then
-        * start it up. */
-       scsi_host_get(rtsx_to_host(dev));
-       atomic_inc(&total_threads);
-       wake_up_process(th);
+       err = scsi_add_host(host, &pci->dev);
+       if (err) {
+               printk(KERN_ERR "Unable to add the scsi host\n");
+               goto errout;
+       }
 
        /* Start up the thread for delayed SCSI-device scanning */
        th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan");
@@ -1024,28 +1020,17 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
                goto errout;
        }
 
-       /* Take a reference to the host for the scanning thread and
-        * count it among all the threads we have launched.  Then
-        * start it up. */
-       scsi_host_get(rtsx_to_host(dev));
-       atomic_inc(&total_threads);
        wake_up_process(th);
 
        /* Start up the thread for polling thread */
-       th = kthread_create(rtsx_polling_thread, dev, "rtsx-polling");
+       th = kthread_run(rtsx_polling_thread, dev, "rtsx-polling");
        if (IS_ERR(th)) {
                printk(KERN_ERR "Unable to start the device-polling thread\n");
                quiesce_and_remove_host(dev);
                err = PTR_ERR(th);
                goto errout;
        }
-
-       /* Take a reference to the host for the polling thread and
-        * count it among all the threads we have launched.  Then
-        * start it up. */
-       scsi_host_get(rtsx_to_host(dev));
-       atomic_inc(&total_threads);
-       wake_up_process(th);
+       dev->polling_thread = th;
 
        pci_set_drvdata(pci, dev);
 
@@ -1108,16 +1093,6 @@ static void __exit rtsx_exit(void)
 
        pci_unregister_driver(&driver);
 
-       /* Don't return until all of our control and scanning threads
-        * have exited.  Since each thread signals threads_gone as its
-        * last act, we have to call wait_for_completion the right number
-        * of times.
-        */
-       while (atomic_read(&total_threads) > 0) {
-               wait_for_completion(&threads_gone);
-               atomic_dec(&total_threads);
-       }
-
        printk(KERN_INFO "%s module exit\n", CR_DRIVER_NAME);
 }
 
index 247615ba1d2ae5750cf2fd5777b390f7a381a893..86e47c2e3e3c41858293a8be5f1165b528d3630b 100644 (file)
@@ -112,9 +112,16 @@ struct rtsx_dev {
        /* locks */
        spinlock_t              reg_lock;
 
+       struct task_struct      *ctl_thread;     /* the control thread   */
+       struct task_struct      *polling_thread; /* the polling thread   */
+
        /* mutual exclusion and synchronization structures */
-       struct semaphore        sema;            /* to sleep thread on      */
+       struct completion       cmnd_ready;      /* to sleep thread on      */
+       struct completion       control_exit;    /* control thread exit     */
+       struct completion       polling_exit;    /* polling thread exit     */
        struct completion       notify;          /* thread begin/end        */
+       struct completion       scanning_done;   /* wait for scan thread    */
+
        wait_queue_head_t       delay_wait;      /* wait during scan, reset */
        struct mutex            dev_mutex;
 
index 76779949f141bbd81d0be64ee5334768278430cd..f974f6412ad7303b72f85374a0f3d0e94cdacf0d 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/slab.h>
 #include <linux/videodev2.h>
 #include "solo6x10.h"
 #include "tw28.h"
index 285f7f3500626a459aa0391b4a8a97bbda48cf89..de502599bb197a7ac3481174955779cae0e21048 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include "solo6x10.h"
 #include "osd-font.h"
 
index bd8eb92c94b1584cea9120ba6b0de06b5de3e318..59274bfca95bf53182f2800aae636ad0d91a7725 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/mempool.h>
 #include <linux/poll.h>
 #include <linux/kthread.h>
+#include <linux/slab.h>
 #include <linux/freezer.h>
 #include <sound/core.h>
 #include <sound/initval.h>
index 5717eabb04a45b5ee03c413ec267bac093fdfb10..56210f0fc5ec162a59b466418487b2ad4bfecce6 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/scatterlist.h>
 #include "solo6x10.h"
 
index 17c06bd6cc91270986d2541c580b9d83e2713165..abee7213202f066c8234ff2a06932627e330170e 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/list.h>
 #include <linux/wait.h>
 #include <linux/delay.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
 #include <linux/videodev2.h>
index 39dc586fc8bb57f21cd95aec22c336255a0a8562..940769ef883fcb7d6cad69931bc66fb5490328f9 100644 (file)
@@ -18,13 +18,14 @@ static ssize_t speakup_file_write(struct file *fp, const char *buffer,
 {
        size_t count = nbytes;
        const char *ptr = buffer;
-       int bytes;
+       size_t bytes;
        unsigned long flags;
        u_char buf[256];
+
        if (synth == NULL)
                return -ENODEV;
        while (count > 0) {
-               bytes = min_t(size_t, count, sizeof(buf));
+               bytes = min(count, sizeof(buf));
                if (copy_from_user(buf, ptr, bytes))
                        return -EFAULT;
                count -= bytes;
index f5ec64f94470f7311989a2d4c503934986a6df3b..60daa272c204b6191525d1990b4b38937400b94e 100644 (file)
@@ -1,3 +1,3 @@
-zcache-y       :=      tmem.o
+zcache-y       :=      zcache-main.o tmem.o
 
 obj-$(CONFIG_ZCACHE)   +=      zcache.o
similarity index 99%
rename from drivers/staging/zcache/zcache.c
rename to drivers/staging/zcache/zcache-main.c
index 65a81a0d7c4921a8515cc92757b27977c5958f05..855a5bb56a47d8e591873b05e6be15ec6f4f6ee0 100644 (file)
@@ -19,6 +19,7 @@
  *   http://marc.info/?l=linux-mm&m=127811271605009
  */
 
+#include <linux/module.h>
 #include <linux/cpu.h>
 #include <linux/highmem.h>
 #include <linux/list.h>
@@ -27,6 +28,7 @@
 #include <linux/spinlock.h>
 #include <linux/types.h>
 #include <linux/atomic.h>
+#include <linux/math64.h>
 #include "tmem.h"
 
 #include "../zram/xvmalloc.h" /* if built in drivers/staging */
@@ -53,6 +55,9 @@
 
 #define MAX_CLIENTS 16
 #define LOCAL_CLIENT ((uint16_t)-1)
+
+MODULE_LICENSE("GPL");
+
 struct zcache_client {
        struct tmem_pool *tmem_pools[MAX_POOLS_PER_CLIENT];
        struct xv_pool *xvpool;
@@ -1158,6 +1163,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
        uint16_t client_id = get_client_id_from_client(cli);
        unsigned long zv_mean_zsize;
        unsigned long curr_pers_pampd_count;
+       u64 total_zsize;
 
        if (eph) {
                ret = zcache_compress(page, &cdata, &clen);
@@ -1190,8 +1196,9 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
                }
                /* reject if mean compression is too poor */
                if ((clen > zv_max_mean_zsize) && (curr_pers_pampd_count > 0)) {
-                       zv_mean_zsize = xv_get_total_size_bytes(cli->xvpool) /
-                                               curr_pers_pampd_count;
+                       total_zsize = xv_get_total_size_bytes(cli->xvpool);
+                       zv_mean_zsize = div_u64(total_zsize,
+                                               curr_pers_pampd_count);
                        if (zv_mean_zsize > zv_max_mean_zsize) {
                                zcache_mean_compress_poor++;
                                goto out;
@@ -1929,9 +1936,9 @@ __setup("nofrontswap", no_frontswap);
 
 static int __init zcache_init(void)
 {
-#ifdef CONFIG_SYSFS
        int ret = 0;
 
+#ifdef CONFIG_SYSFS
        ret = sysfs_create_group(mm_kobj, &zcache_attr_group);
        if (ret) {
                pr_err("zcache: can't create sysfs\n");