Commit 8c70aac0 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* '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
parents 06e727d2 d8c778fd
...@@ -812,7 +812,7 @@ int AthCreateCommandList(struct ps_cmd_packet **HciPacketList, u32 *numPackets) ...@@ -812,7 +812,7 @@ int AthCreateCommandList(struct ps_cmd_packet **HciPacketList, u32 *numPackets)
for(count = 0; count < Patch_Count; count++) { for(count = 0; count < Patch_Count; count++) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Freeing Patch Buffer %d \r\n",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++) { for(count = 0; count < Tag_Count; count++) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/stringify.h> #include <linux/stringify.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/slab.h>
#include <media/v4l2-dev.h> #include <media/v4l2-dev.h>
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-contig.h> #include <media/videobuf2-dma-contig.h>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "ft1000.h" #include "ft1000.h"
......
...@@ -325,7 +325,7 @@ static int blkvsc_do_operation(struct block_device_context *blkdev, ...@@ -325,7 +325,7 @@ static int blkvsc_do_operation(struct block_device_context *blkdev,
page_buf = alloc_page(GFP_KERNEL); page_buf = alloc_page(GFP_KERNEL);
if (!page_buf) { if (!page_buf) {
kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req); kmem_cache_free(blkdev->request_pool, blkvsc_req);
return -ENOMEM; return -ENOMEM;
} }
...@@ -422,7 +422,7 @@ static int blkvsc_do_operation(struct block_device_context *blkdev, ...@@ -422,7 +422,7 @@ static int blkvsc_do_operation(struct block_device_context *blkdev,
__free_page(page_buf); __free_page(page_buf);
kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req); kmem_cache_free(blkdev->request_pool, blkvsc_req);
return ret; return ret;
} }
......
...@@ -311,13 +311,17 @@ static int adis16203_read_raw(struct iio_dev *indio_dev, ...@@ -311,13 +311,17 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
addr = adis16203_addresses[chan->address][0]; addr = adis16203_addresses[chan->address][0];
ret = adis16203_spi_read_reg_16(indio_dev, addr, &val16); ret = adis16203_spi_read_reg_16(indio_dev, addr, &val16);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
if (val16 & ADIS16203_ERROR_ACTIVE) { if (val16 & ADIS16203_ERROR_ACTIVE) {
ret = adis16203_check_status(indio_dev); ret = adis16203_check_status(indio_dev);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
} }
val16 = val16 & ((1 << chan->scan_type.realbits) - 1); val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
if (chan->scan_type.sign == 's') if (chan->scan_type.sign == 's')
......
...@@ -341,13 +341,17 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, ...@@ -341,13 +341,17 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
addr = adis16204_addresses[chan->address][0]; addr = adis16204_addresses[chan->address][0];
ret = adis16204_spi_read_reg_16(indio_dev, addr, &val16); ret = adis16204_spi_read_reg_16(indio_dev, addr, &val16);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
if (val16 & ADIS16204_ERROR_ACTIVE) { if (val16 & ADIS16204_ERROR_ACTIVE) {
ret = adis16204_check_status(indio_dev); ret = adis16204_check_status(indio_dev);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
} }
val16 = val16 & ((1 << chan->scan_type.realbits) - 1); val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
if (chan->scan_type.sign == 's') if (chan->scan_type.sign == 's')
......
...@@ -337,13 +337,17 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, ...@@ -337,13 +337,17 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
addr = adis16209_addresses[chan->address][0]; addr = adis16209_addresses[chan->address][0];
ret = adis16209_spi_read_reg_16(indio_dev, addr, &val16); ret = adis16209_spi_read_reg_16(indio_dev, addr, &val16);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
if (val16 & ADIS16209_ERROR_ACTIVE) { if (val16 & ADIS16209_ERROR_ACTIVE) {
ret = adis16209_check_status(indio_dev); ret = adis16209_check_status(indio_dev);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
} }
val16 = val16 & ((1 << chan->scan_type.realbits) - 1); val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
if (chan->scan_type.sign == 's') if (chan->scan_type.sign == 's')
......
...@@ -370,13 +370,17 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, ...@@ -370,13 +370,17 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
addr = adis16240_addresses[chan->address][0]; addr = adis16240_addresses[chan->address][0];
ret = adis16240_spi_read_reg_16(indio_dev, addr, &val16); ret = adis16240_spi_read_reg_16(indio_dev, addr, &val16);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
if (val16 & ADIS16240_ERROR_ACTIVE) { if (val16 & ADIS16240_ERROR_ACTIVE) {
ret = adis16240_check_status(indio_dev); ret = adis16240_check_status(indio_dev);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
} }
val16 = val16 & ((1 << chan->scan_type.realbits) - 1); val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
if (chan->scan_type.sign == 's') if (chan->scan_type.sign == 's')
......
...@@ -446,13 +446,17 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, ...@@ -446,13 +446,17 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
addr = adis16260_addresses[chan->address][0]; addr = adis16260_addresses[chan->address][0];
ret = adis16260_spi_read_reg_16(indio_dev, addr, &val16); ret = adis16260_spi_read_reg_16(indio_dev, addr, &val16);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
if (val16 & ADIS16260_ERROR_ACTIVE) { if (val16 & ADIS16260_ERROR_ACTIVE) {
ret = adis16260_check_status(indio_dev); ret = adis16260_check_status(indio_dev);
if (ret) if (ret) {
mutex_unlock(&indio_dev->mlock);
return ret; return ret;
}
} }
val16 = val16 & ((1 << chan->scan_type.realbits) - 1); val16 = val16 & ((1 << chan->scan_type.realbits) - 1);
if (chan->scan_type.sign == 's') if (chan->scan_type.sign == 's')
......
...@@ -4,5 +4,7 @@ ToDo list (incomplete, unordered) ...@@ -4,5 +4,7 @@ ToDo list (incomplete, unordered)
- add compile as module support - add compile as module support
- move nvec devices to mfd cells? - move nvec devices to mfd cells?
- adjust to kernel style - 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.
...@@ -399,10 +399,7 @@ bool init_firmware(struct net_device *dev) ...@@ -399,10 +399,7 @@ bool init_firmware(struct net_device *dev)
} }
MODULE_FIRMWARE("RTL8192U/boot.img");
MODULE_FIRMWARE("RTL8192U/main.img");
MODULE_FIRMWARE("RTL8192U/data.img");
...@@ -66,12 +66,6 @@ static int msi_en; ...@@ -66,12 +66,6 @@ static int msi_en;
module_param(msi_en, int, S_IRUGO | S_IWUSR); module_param(msi_en, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(msi_en, "enable msi"); 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); static irqreturn_t rtsx_interrupt(int irq, void *dev_id);
/*********************************************************************** /***********************************************************************
...@@ -192,7 +186,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb, ...@@ -192,7 +186,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
/* enqueue the command and wake up the control thread */ /* enqueue the command and wake up the control thread */
srb->scsi_done = done; srb->scsi_done = done;
chip->srb = srb; chip->srb = srb;
up(&(dev->sema)); complete(&dev->cmnd_ready);
return 0; return 0;
} }
...@@ -475,7 +469,7 @@ static int rtsx_control_thread(void *__dev) ...@@ -475,7 +469,7 @@ static int rtsx_control_thread(void *__dev)
current->flags |= PF_NOFREEZE; current->flags |= PF_NOFREEZE;
for (;;) { for (;;) {
if (down_interruptible(&dev->sema)) if (wait_for_completion_interruptible(&dev->cmnd_ready))
break; break;
/* lock the device pointers */ /* lock the device pointers */
...@@ -557,8 +551,6 @@ static int rtsx_control_thread(void *__dev) ...@@ -557,8 +551,6 @@ static int rtsx_control_thread(void *__dev)
mutex_unlock(&dev->dev_mutex); mutex_unlock(&dev->dev_mutex);
} /* for (;;) */ } /* for (;;) */
scsi_host_put(host);
/* notify the exit routine that we're actually exiting now /* notify the exit routine that we're actually exiting now
* *
* complete()/wait_for_completion() is similar to up()/down(), * complete()/wait_for_completion() is similar to up()/down(),
...@@ -573,7 +565,7 @@ static int rtsx_control_thread(void *__dev) ...@@ -573,7 +565,7 @@ static int rtsx_control_thread(void *__dev)
* This is important in preemption kernels, which transfer the flow * This is important in preemption kernels, which transfer the flow
* of execution immediately upon a complete(). * 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) ...@@ -581,7 +573,6 @@ static int rtsx_polling_thread(void *__dev)
{ {
struct rtsx_dev *dev = (struct rtsx_dev *)__dev; struct rtsx_dev *dev = (struct rtsx_dev *)__dev;
struct rtsx_chip *chip = dev->chip; struct rtsx_chip *chip = dev->chip;
struct Scsi_Host *host = rtsx_to_host(dev);
struct sd_info *sd_card = &(chip->sd_card); struct sd_info *sd_card = &(chip->sd_card);
struct xd_info *xd_card = &(chip->xd_card); struct xd_info *xd_card = &(chip->xd_card);
struct ms_info *ms_card = &(chip->ms_card); struct ms_info *ms_card = &(chip->ms_card);
...@@ -621,8 +612,7 @@ static int rtsx_polling_thread(void *__dev) ...@@ -621,8 +612,7 @@ static int rtsx_polling_thread(void *__dev)
mutex_unlock(&dev->dev_mutex); mutex_unlock(&dev->dev_mutex);
} }
scsi_host_put(host); complete_and_exit(&dev->polling_exit, 0);
complete_and_exit(&threads_gone, 0);
} }
/* /*
...@@ -699,29 +689,38 @@ static void rtsx_release_resources(struct rtsx_dev *dev) ...@@ -699,29 +689,38 @@ static void rtsx_release_resources(struct rtsx_dev *dev)
{ {
printk(KERN_INFO "-- %s\n", __func__); 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) { 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->rtsx_resv_buf, dev->rtsx_resv_buf_addr);
dev->chip->host_cmds_ptr = NULL; dev->chip->host_cmds_ptr = NULL;
dev->chip->host_sg_tbl_ptr = NULL; dev->chip->host_sg_tbl_ptr = NULL;
} }
pci_disable_device(dev->pci); if (dev->irq > 0)
pci_release_regions(dev->pci);
if (dev->irq > 0) {
free_irq(dev->irq, (void *)dev); free_irq(dev->irq, (void *)dev);
} if (dev->chip->msi_en)
if (dev->chip->msi_en) {
pci_disable_msi(dev->pci); pci_disable_msi(dev->pci);
} if (dev->remap_addr)
iounmap(dev->remap_addr);
/* Tell the control thread to exit. The SCSI host must pci_disable_device(dev->pci);
* already have been removed so it won't try to queue pci_release_regions(dev->pci);
* any more commands.
*/ rtsx_release_chip(dev->chip);
printk(KERN_INFO "-- sending exit command to thread\n"); kfree(dev->chip);
up(&dev->sema);
} }
/* First stage of disconnect processing: stop all commands and remove /* First stage of disconnect processing: stop all commands and remove
...@@ -739,6 +738,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev) ...@@ -739,6 +738,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
scsi_unlock(host); scsi_unlock(host);
mutex_unlock(&dev->dev_mutex); mutex_unlock(&dev->dev_mutex);
wake_up(&dev->delay_wait); wake_up(&dev->delay_wait);
wait_for_completion(&dev->scanning_done);
/* Wait some time to let other threads exist */ /* Wait some time to let other threads exist */
wait_timeout(100); wait_timeout(100);
...@@ -793,8 +793,7 @@ static int rtsx_scan_thread(void *__dev) ...@@ -793,8 +793,7 @@ static int rtsx_scan_thread(void *__dev)
/* Should we unbind if no devices were detected? */ /* Should we unbind if no devices were detected? */
} }
scsi_host_put(rtsx_to_host(dev)); complete_and_exit(&dev->scanning_done, 0);
complete_and_exit(&threads_gone, 0);
} }
static void rtsx_init_options(struct rtsx_chip *chip) 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 ...@@ -941,8 +940,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
spin_lock_init(&dev->reg_lock); spin_lock_init(&dev->reg_lock);
mutex_init(&(dev->dev_mutex)); 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->notify));
init_completion(&dev->scanning_done);
init_waitqueue_head(&dev->delay_wait); init_waitqueue_head(&dev->delay_wait);
dev->pci = pci; dev->pci = pci;
...@@ -992,28 +994,22 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id ...@@ -992,28 +994,22 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
pci_set_master(pci); pci_set_master(pci);
synchronize_irq(dev->irq); 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); rtsx_init_chip(dev->chip);
/* Start up our control thread */ /* 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)) { if (IS_ERR(th)) {
printk(KERN_ERR "Unable to start control thread\n"); printk(KERN_ERR "Unable to start control thread\n");
err = PTR_ERR(th); err = PTR_ERR(th);
goto errout; goto errout;
} }
dev->ctl_thread = th;
/* Take a reference to the host for the control thread and err = scsi_add_host(host, &pci->dev);
* count it among all the threads we have launched. Then if (err) {
* start it up. */ printk(KERN_ERR "Unable to add the scsi host\n");
scsi_host_get(rtsx_to_host(dev)); goto errout;
atomic_inc(&total_threads); }
wake_up_process(th);
/* Start up the thread for delayed SCSI-device scanning */ /* Start up the thread for delayed SCSI-device scanning */
th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan"); 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 ...@@ -1024,28 +1020,17 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
goto errout; 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); wake_up_process(th);
/* Start up the thread for polling thread */ /* 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)) { if (IS_ERR(th)) {
printk(KERN_ERR "Unable to start the device-polling thread\n"); printk(KERN_ERR "Unable to start the device-polling thread\n");
quiesce_and_remove_host(dev); quiesce_and_remove_host(dev);
err = PTR_ERR(th); err = PTR_ERR(th);
goto errout; goto errout;
} }
dev->polling_thread = th;
/* 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);
pci_set_drvdata(pci, dev); pci_set_drvdata(pci, dev);
...@@ -1108,16 +1093,6 @@ static void __exit rtsx_exit(void) ...@@ -1108,16 +1093,6 @@ static void __exit rtsx_exit(void)
pci_unregister_driver(&driver); 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); printk(KERN_INFO "%s module exit\n", CR_DRIVER_NAME);
} }
......
...@@ -112,9 +112,16 @@ struct rtsx_dev { ...@@ -112,9 +112,16 @@ struct rtsx_dev {
/* locks */ /* locks */
spinlock_t reg_lock; 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 */ /* 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 notify; /* thread begin/end */
struct completion scanning_done; /* wait for scan thread */
wait_queue_head_t delay_wait; /* wait during scan, reset */ wait_queue_head_t delay_wait; /* wait during scan, reset */
struct mutex dev_mutex; struct mutex dev_mutex;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include "solo6x10.h" #include "solo6x10.h"
#include "tw28.h" #include "tw28.h"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h>
#include "solo6x10.h" #include "solo6x10.h"
#include "osd-font.h" #include "osd-font.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/mempool.h> #include <linux/mempool.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/slab.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/initval.h> #include <sound/initval.h>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include "solo6x10.h" #include "solo6x10.h"
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
......
...@@ -18,13 +18,14 @@ static ssize_t speakup_file_write(struct file *fp, const char *buffer, ...@@ -18,13 +18,14 @@ static ssize_t speakup_file_write(struct file *fp, const char *buffer,
{ {
size_t count = nbytes; size_t count = nbytes;
const char *ptr = buffer; const char *ptr = buffer;
int bytes; size_t bytes;
unsigned long flags; unsigned long flags;
u_char buf[256]; u_char buf[256];
if (synth == NULL) if (synth == NULL)
return -ENODEV; return -ENODEV;
while (count > 0) { while (count > 0) {
bytes = min_t(size_t, count, sizeof(buf)); bytes = min(count, sizeof(buf));
if (copy_from_user(buf, ptr, bytes)) if (copy_from_user(buf, ptr, bytes))
return -EFAULT; return -EFAULT;
count -= bytes; count -= bytes;
......
zcache-y := tmem.o zcache-y := zcache-main.o tmem.o
obj-$(CONFIG_ZCACHE) += zcache.o obj-$(CONFIG_ZCACHE) += zcache.o
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* http://marc.info/?l=linux-mm&m=127811271605009 * http://marc.info/?l=linux-mm&m=127811271605009
*/ */
#include <linux/module.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/math64.h>
#include "tmem.h" #include "tmem.h"
#include "../zram/xvmalloc.h" /* if built in drivers/staging */ #include "../zram/xvmalloc.h" /* if built in drivers/staging */
...@@ -53,6 +55,9 @@ ...@@ -53,6 +55,9 @@
#define MAX_CLIENTS 16 #define MAX_CLIENTS 16
#define LOCAL_CLIENT ((uint16_t)-1) #define LOCAL_CLIENT ((uint16_t)-1)
MODULE_LICENSE("GPL");
struct zcache_client { struct zcache_client {
struct tmem_pool *tmem_pools[MAX_POOLS_PER_CLIENT]; struct tmem_pool *tmem_pools[MAX_POOLS_PER_CLIENT];
struct xv_pool *xvpool; struct xv_pool *xvpool;
...@@ -1158,6 +1163,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph, ...@@ -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); uint16_t client_id = get_client_id_from_client(cli);
unsigned long zv_mean_zsize; unsigned long zv_mean_zsize;
unsigned long curr_pers_pampd_count; unsigned long curr_pers_pampd_count;
u64 total_zsize;
if (eph) { if (eph) {
ret = zcache_compress(page, &cdata, &clen); ret = zcache_compress(page, &cdata, &clen);
...@@ -1190,8 +1196,9 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph, ...@@ -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 */ /* reject if mean compression is too poor */
if ((clen > zv_max_mean_zsize) && (curr_pers_pampd_count > 0)) { if ((clen > zv_max_mean_zsize) && (curr_pers_pampd_count > 0)) {
zv_mean_zsize = xv_get_total_size_bytes(cli->xvpool) / total_zsize = xv_get_total_size_bytes(cli->xvpool);
curr_pers_pampd_count; zv_mean_zsize = div_u64(total_zsize,
curr_pers_pampd_count);
if (zv_mean_zsize > zv_max_mean_zsize) { if (zv_mean_zsize > zv_max_mean_zsize) {
zcache_mean_compress_poor++; zcache_mean_compress_poor++;
goto out; goto out;
...@@ -1929,9 +1936,9 @@ __setup("nofrontswap", no_frontswap); ...@@ -1929,9 +1936,9 @@ __setup("nofrontswap", no_frontswap);
static int __init zcache_init(void) static int __init zcache_init(void)
{ {
#ifdef CONFIG_SYSFS
int ret = 0; int ret = 0;
#ifdef CONFIG_SYSFS
ret = sysfs_create_group(mm_kobj, &zcache_attr_group); ret = sysfs_create_group(mm_kobj, &zcache_attr_group);
if (ret) { if (ret) {
pr_err("zcache: can't create sysfs\n"); pr_err("zcache: can't create sysfs\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment