Skip to content

Commit

Permalink
Merge tag 'staging-3.15-rc2' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are a few staging driver fixes for issues that have been reported
  for 3.15-rc2.

  Also dominating the diffstat for the pull request is the removal of
  the rtl8187se driver.  It's no longer needed in staging as a "real"
  driver for this hardware is now merged in the tree in the "correct"
  location in drivers/net/

  All of these patches have been tested in linux-next"

* tag 'staging-3.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: r8188eu: Fix case where ethtype was never obtained and always be checked against 0
  staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0
  staging: r8188eu: Calling rtw_get_stainfo() with a NULL sta_addr will return NULL
  staging: comedi: fix circular locking dependency in comedi_mmap()
  staging: r8723au: Add missing initialization of change_inx in sort algorithm
  Staging: unisys: use after free in list_for_each()
  staging: unisys: use after free in error messages
  staging: speakup: fix misuse of kstrtol() in handle_goto()
  staging: goldfish: Call free_irq in error path
  staging: delete rtl8187se wireless driver
  staging: rtl8723au: Fix buffer overflow in rtw_get_wfd_ie()
  staging: gs_fpgaboot: remove __TIMESTAMP__ macro
  staging: vme: fix memory leak in vme_user_probe()
  staging: fpgaboot: clean up Makefile
  staging/usbip: fix store_attach() sscanf return value check
  staging/usbip: userspace - fix usbipd SIGSEGV from refresh_exported_devices()
  staging: rtl8188eu: remove spaces, correct counts to unbreak P2P ioctls
  staging/rtl8821ae: Fix OOM handling in _rtl_init_deferred_work()
  • Loading branch information
Linus Torvalds committed Apr 18, 2014
2 parents 575a292 + 33c84bc commit 8cb652b
Show file tree
Hide file tree
Showing 52 changed files with 154 additions and 19,978 deletions.
2 changes: 0 additions & 2 deletions drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ source "drivers/staging/olpc_dcon/Kconfig"

source "drivers/staging/panel/Kconfig"

source "drivers/staging/rtl8187se/Kconfig"

source "drivers/staging/rtl8192u/Kconfig"

source "drivers/staging/rtl8192e/Kconfig"
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ obj-$(CONFIG_PRISM2_USB) += wlan-ng/
obj-$(CONFIG_COMEDI) += comedi/
obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/
obj-$(CONFIG_PANEL) += panel/
obj-$(CONFIG_R8187SE) += rtl8187se/
obj-$(CONFIG_RTL8192U) += rtl8192u/
obj-$(CONFIG_RTL8192E) += rtl8192e/
obj-$(CONFIG_R8712U) += rtl8712/
Expand Down
37 changes: 35 additions & 2 deletions drivers/staging/comedi/comedi_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@ static void __comedi_buf_free(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct comedi_async *async = s->async;
struct comedi_buf_map *bm;
unsigned long flags;

if (async->prealloc_buf) {
vunmap(async->prealloc_buf);
async->prealloc_buf = NULL;
async->prealloc_bufsz = 0;
}

comedi_buf_map_put(async->buf_map);
spin_lock_irqsave(&s->spin_lock, flags);
bm = async->buf_map;
async->buf_map = NULL;
spin_unlock_irqrestore(&s->spin_lock, flags);
comedi_buf_map_put(bm);
}

static void __comedi_buf_alloc(struct comedi_device *dev,
Expand All @@ -80,6 +85,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
struct page **pages = NULL;
struct comedi_buf_map *bm;
struct comedi_buf_page *buf;
unsigned long flags;
unsigned i;

if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) {
Expand All @@ -92,8 +98,10 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
if (!bm)
return;

async->buf_map = bm;
kref_init(&bm->refcount);
spin_lock_irqsave(&s->spin_lock, flags);
async->buf_map = bm;
spin_unlock_irqrestore(&s->spin_lock, flags);
bm->dma_dir = s->async_dma_dir;
if (bm->dma_dir != DMA_NONE)
/* Need ref to hardware device to free buffer later. */
Expand Down Expand Up @@ -127,7 +135,9 @@ static void __comedi_buf_alloc(struct comedi_device *dev,

pages[i] = virt_to_page(buf->virt_addr);
}
spin_lock_irqsave(&s->spin_lock, flags);
bm->n_pages = i;
spin_unlock_irqrestore(&s->spin_lock, flags);

/* vmap the prealloc_buf if all the pages were allocated */
if (i == n_pages)
Expand All @@ -150,6 +160,29 @@ int comedi_buf_map_put(struct comedi_buf_map *bm)
return 1;
}

/* returns s->async->buf_map and increments its kref refcount */
struct comedi_buf_map *
comedi_buf_map_from_subdev_get(struct comedi_subdevice *s)
{
struct comedi_async *async = s->async;
struct comedi_buf_map *bm = NULL;
unsigned long flags;

if (!async)
return NULL;

spin_lock_irqsave(&s->spin_lock, flags);
bm = async->buf_map;
/* only want it if buffer pages allocated */
if (bm && bm->n_pages)
comedi_buf_map_get(bm);
else
bm = NULL;
spin_unlock_irqrestore(&s->spin_lock, flags);

return bm;
}

bool comedi_buf_is_mmapped(struct comedi_async *async)
{
struct comedi_buf_map *bm = async->buf_map;
Expand Down
18 changes: 14 additions & 4 deletions drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1926,14 +1926,21 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
struct comedi_device *dev = file->private_data;
struct comedi_subdevice *s;
struct comedi_async *async;
struct comedi_buf_map *bm;
struct comedi_buf_map *bm = NULL;
unsigned long start = vma->vm_start;
unsigned long size;
int n_pages;
int i;
int retval;

mutex_lock(&dev->mutex);
/*
* 'trylock' avoids circular dependency with current->mm->mmap_sem
* and down-reading &dev->attach_lock should normally succeed without
* contention unless the device is in the process of being attached
* or detached.
*/
if (!down_read_trylock(&dev->attach_lock))
return -EAGAIN;

if (!dev->attached) {
dev_dbg(dev->class_dev, "no driver attached\n");
Expand Down Expand Up @@ -1973,7 +1980,9 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
}

n_pages = size >> PAGE_SHIFT;
bm = async->buf_map;

/* get reference to current buf map (if any) */
bm = comedi_buf_map_from_subdev_get(s);
if (!bm || n_pages > bm->n_pages) {
retval = -EINVAL;
goto done;
Expand All @@ -1997,7 +2006,8 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)

retval = 0;
done:
mutex_unlock(&dev->mutex);
up_read(&dev->attach_lock);
comedi_buf_map_put(bm); /* put reference to buf map - okay if NULL */
return retval;
}

Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/comedi/comedi_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ void comedi_buf_reset(struct comedi_async *async);
bool comedi_buf_is_mmapped(struct comedi_async *async);
void comedi_buf_map_get(struct comedi_buf_map *bm);
int comedi_buf_map_put(struct comedi_buf_map *bm);
struct comedi_buf_map *comedi_buf_map_from_subdev_get(
struct comedi_subdevice *s);
unsigned int comedi_buf_write_n_allocated(struct comedi_async *async);
void comedi_device_cancel_all(struct comedi_device *dev);

Expand Down
1 change: 1 addition & 0 deletions drivers/staging/goldfish/goldfish_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ static int goldfish_audio_probe(struct platform_device *pdev)
return 0;

err_misc_register_failed:
free_irq(data->irq, data);
err_request_irq_failed:
dma_free_coherent(&pdev->dev, COMBINED_BUFFER_SIZE,
data->buffer_virt, data->buffer_phys);
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/gs_fpgaboot/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
gs_fpga-y += gs_fpgaboot.o io.o
obj-$(CONFIG_GS_FPGABOOT) += gs_fpga.o

ccflags-$(CONFIG_GS_FPGA_DEBUG) := -DDEBUG
1 change: 0 additions & 1 deletion drivers/staging/gs_fpgaboot/gs_fpgaboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ static int __init gs_fpgaboot_init(void)
r = -1;

pr_info("FPGA DOWNLOAD --->\n");
pr_info("built at %s UTC\n", __TIMESTAMP__);

pr_info("FPGA image file name: %s\n", file);

Expand Down
10 changes: 0 additions & 10 deletions drivers/staging/rtl8187se/Kconfig

This file was deleted.

38 changes: 0 additions & 38 deletions drivers/staging/rtl8187se/Makefile

This file was deleted.

Empty file.
13 changes: 0 additions & 13 deletions drivers/staging/rtl8187se/TODO

This file was deleted.

Loading

0 comments on commit 8cb652b

Please sign in to comment.