From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Greg KH <greg@kroah.com>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
"Omar Ramirez Luna" <omar.ramirez@ti.com>,
"Víctor Manuel Jáquez Leal" <vjaquez@igalia.com>
Subject: linux-next: manual merge of the staging tree with Linus' tree
Date: Fri, 10 Feb 2012 15:48:06 +1100 [thread overview]
Message-ID: <20120210154806.4a81ec53dc24a40cf91a758a@canb.auug.org.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 5874 bytes --]
Hi Greg,
Today's linux-next merge of the staging tree got a conflict in
drivers/staging/tidspbridge/rmgr/drv_interface.c between commit
5a63177a6967 ("staging: tidspbridge: fix bridge_open memory leaks") from
Linus' tree and commit 518761dba127 ("staging: tidspbridge: remove unused
header") from the staging tree.
I fixed it up (I think - see below) and can carry the fix as necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/staging/tidspbridge/rmgr/drv_interface.c
index 385740b,31b5140..0000000
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@@ -131,7 -117,157 +117,166 @@@ MODULE_AUTHOR("Texas Instruments")
MODULE_LICENSE("GPL");
MODULE_VERSION(DSPBRIDGE_VERSION);
- static char *driver_name = DRIVER_NAME;
+ /*
+ * This function is called when an application opens handle to the
+ * bridge driver.
+ */
+ static int bridge_open(struct inode *ip, struct file *filp)
+ {
+ int status = 0;
+ struct process_context *pr_ctxt = NULL;
+
+ /*
+ * Allocate a new process context and insert it into global
+ * process context list.
+ */
+
+ #ifdef CONFIG_TIDSPBRIDGE_RECOVERY
+ if (recover) {
+ if (filp->f_flags & O_NONBLOCK ||
+ wait_for_completion_interruptible(&bridge_open_comp))
+ return -EBUSY;
+ }
+ #endif
+ pr_ctxt = kzalloc(sizeof(struct process_context), GFP_KERNEL);
- if (pr_ctxt) {
- pr_ctxt->res_state = PROC_RES_ALLOCATED;
- spin_lock_init(&pr_ctxt->dmm_map_lock);
- INIT_LIST_HEAD(&pr_ctxt->dmm_map_list);
- spin_lock_init(&pr_ctxt->dmm_rsv_lock);
- INIT_LIST_HEAD(&pr_ctxt->dmm_rsv_list);
-
- pr_ctxt->node_id = kzalloc(sizeof(struct idr), GFP_KERNEL);
- if (pr_ctxt->node_id) {
- idr_init(pr_ctxt->node_id);
- } else {
- status = -ENOMEM;
- goto err;
- }
++ if (!pr_ctxt)
++ return -ENOMEM;
++
++ pr_ctxt->res_state = PROC_RES_ALLOCATED;
++ spin_lock_init(&pr_ctxt->dmm_map_lock);
++ INIT_LIST_HEAD(&pr_ctxt->dmm_map_list);
++ spin_lock_init(&pr_ctxt->dmm_rsv_lock);
++ INIT_LIST_HEAD(&pr_ctxt->dmm_rsv_list);
+
- pr_ctxt->stream_id = kzalloc(sizeof(struct idr), GFP_KERNEL);
- if (pr_ctxt->stream_id)
- idr_init(pr_ctxt->stream_id);
- else
- status = -ENOMEM;
- } else {
++ pr_ctxt->node_id = kzalloc(sizeof(struct idr), GFP_KERNEL);
++ if (!pr_ctxt->node_id) {
+ status = -ENOMEM;
++ goto err1;
+ }
-err:
++
++ idr_init(pr_ctxt->node_id);
++
++ pr_ctxt->stream_id = kzalloc(sizeof(struct idr), GFP_KERNEL);
++ if (!pr_ctxt->stream_id) {
++ status = -ENOMEM;
++ goto err2;
++ }
++
++ idr_init(pr_ctxt->stream_id);
++
+ filp->private_data = pr_ctxt;
++
+ #ifdef CONFIG_TIDSPBRIDGE_RECOVERY
- if (!status)
- atomic_inc(&bridge_cref);
++ atomic_inc(&bridge_cref);
+ #endif
++ return 0;
++
++err2:
++ kfree(pr_ctxt->node_id);
++err1:
++ kfree(pr_ctxt);
+ return status;
+ }
+
+ /*
+ * This function is called when an application closes handle to the bridge
+ * driver.
+ */
+ static int bridge_release(struct inode *ip, struct file *filp)
+ {
+ int status = 0;
+ struct process_context *pr_ctxt;
+
+ if (!filp->private_data) {
+ status = -EIO;
+ goto err;
+ }
+
+ pr_ctxt = filp->private_data;
+ flush_signals(current);
+ drv_remove_all_resources(pr_ctxt);
+ proc_detach(pr_ctxt);
++ kfree(pr_ctxt->node_id);
++ kfree(pr_ctxt->stream_id);
+ kfree(pr_ctxt);
+
+ filp->private_data = NULL;
+
+ err:
+ #ifdef CONFIG_TIDSPBRIDGE_RECOVERY
+ if (!atomic_dec_return(&bridge_cref))
+ complete(&bridge_comp);
+ #endif
+ return status;
+ }
+
+ /* This function provides IO interface to the bridge driver. */
+ static long bridge_ioctl(struct file *filp, unsigned int code,
+ unsigned long args)
+ {
+ int status;
+ u32 retval = 0;
+ union trapped_args buf_in;
+
+ #ifdef CONFIG_TIDSPBRIDGE_RECOVERY
+ if (recover) {
+ status = -EIO;
+ goto err;
+ }
+ #endif
+ #ifdef CONFIG_PM
+ status = omap34_xxbridge_suspend_lockout(&bridge_suspend_data, filp);
+ if (status != 0)
+ return status;
+ #endif
+
+ if (!filp->private_data) {
+ status = -EIO;
+ goto err;
+ }
+
+ status = copy_from_user(&buf_in, (union trapped_args *)args,
+ sizeof(union trapped_args));
+
+ if (!status) {
+ status = api_call_dev_ioctl(code, &buf_in, &retval,
+ filp->private_data);
+
+ if (!status) {
+ status = retval;
+ } else {
+ dev_dbg(bridge, "%s: IOCTL Failed, code: 0x%x "
+ "status 0x%x\n", __func__, code, status);
+ status = -1;
+ }
+
+ }
+
+ err:
+ return status;
+ }
+
+ /* This function maps kernel space memory to user space memory. */
+ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
+ {
+ u32 status;
+
+ vma->vm_flags |= VM_RESERVED | VM_IO;
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+ dev_dbg(bridge, "%s: vm filp %p start %lx end %lx page_prot %ulx "
+ "flags %lx\n", __func__, filp,
+ vma->vm_start, vma->vm_end, vma->vm_page_prot,
+ vma->vm_flags);
+
+ status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+ vma->vm_end - vma->vm_start,
+ vma->vm_page_prot);
+ if (status != 0)
+ status = -EAGAIN;
+
+ return status;
+ }
static const struct file_operations bridge_fops = {
.open = bridge_open,
@@@ -405,14 -540,10 +549,13 @@@ static int __devexit omap34_xx_bridge_r
if (driver_context) {
/* Put the DSP in reset state */
- ret = dsp_deinit(driver_context);
+ dsp_deinit(driver_context);
driver_context = 0;
- DBC_ASSERT(ret == true);
}
+ kfree(drv_datap);
+ dev_set_drvdata(bridge, NULL);
+
func_cont:
mem_ext_phys_pool_release();
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next reply other threads:[~2012-02-10 4:48 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 4:48 Stephen Rothwell [this message]
2012-02-10 5:30 ` linux-next: manual merge of the staging tree with Linus' tree Greg KH
2012-02-14 21:31 ` Ramirez Luna, Omar
2012-02-14 22:37 ` Greg KH
2012-02-14 23:33 ` Ramirez Luna, Omar
2012-02-14 23:42 ` Greg KH
2012-02-10 19:01 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2020-07-20 5:25 Stephen Rothwell
2020-07-20 7:37 ` Greg KH
2018-06-06 9:12 Stephen Rothwell
2018-06-06 9:47 ` Greg KH
2018-06-06 9:08 Stephen Rothwell
2018-06-06 9:10 ` Greg KH
2016-04-05 3:49 Stephen Rothwell
2016-04-11 16:57 ` Greg KH
2014-09-22 5:01 Stephen Rothwell
2014-09-22 14:31 ` Greg KH
2013-03-15 4:13 Stephen Rothwell
2013-03-15 15:01 ` Greg KH
2013-01-17 2:35 Stephen Rothwell
2013-01-18 0:42 ` Greg KH
2012-04-27 4:37 Stephen Rothwell
2012-04-27 17:05 ` Greg KH
2012-05-02 21:23 ` Greg KH
2012-02-10 4:47 Stephen Rothwell
2012-02-10 5:30 ` Greg KH
2011-11-28 4:18 Stephen Rothwell
2011-11-28 5:13 ` Greg KH
2011-09-20 6:46 Stephen Rothwell
2011-09-20 12:53 ` Greg KH
2011-05-13 4:08 Stephen Rothwell
2011-05-13 23:12 ` Greg KH
2011-04-28 2:59 Stephen Rothwell
2011-04-28 3:06 ` Greg KH
2011-04-08 6:02 Stephen Rothwell
2011-04-08 6:00 Stephen Rothwell
2011-04-08 5:57 Stephen Rothwell
2011-04-08 5:54 Stephen Rothwell
2011-04-08 5:51 Stephen Rothwell
2011-04-08 5:47 Stephen Rothwell
2011-04-08 20:55 ` Greg KH
2011-04-13 19:18 ` Greg KH
2009-12-09 5:34 Stephen Rothwell
2009-12-09 20:30 ` Greg KH
2009-12-09 23:08 ` Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120210154806.4a81ec53dc24a40cf91a758a@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=omar.ramirez@ti.com \
--cc=vjaquez@igalia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).