linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c
@ 2012-01-30 23:12 Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 1/8] staging: tidspbridge: more readable code Víctor Manuel Jáquez Leal
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

I'm trying to learn how to contribute to the kernel and dsp/bridge is
a module that I have used for a while.

These patches are the result of this first effort. It is a clean up of
the file drv_interface.c which is the entry point of the kernel
module.

Thanks

v2:

* Removed changes in lines with pr_* and dbg_*, so Joe Perches could
  apply his patches for the format string without big rebases.
* Reviewed the modifications done by Lindent
* Added a clean up to the function bridge_mmap()
* Added a patch removing a unused global variable (driver_name)
* Added a patch that removes an always-true assert

vmjl

Víctor Manuel Jáquez Leal (8):
  staging: tidspbridge: more readable code
  staging: tidspbridge: remove unused header
  staging: tidspbridge: Lindent to drv_interface.c
  staging: tidspbridge: silence the compiler
  staging: tidspbridge: remove header inclusions
  staging: tidspbridge: remove trivial assert
  staging: tidspbridge: clean up bridge_mmap()
  staging: tidspbridge: use the driver name string

 drivers/staging/tidspbridge/rmgr/drv_interface.c |  348 ++++++++++-----------
 drivers/staging/tidspbridge/rmgr/drv_interface.h |   28 --
 2 files changed, 166 insertions(+), 210 deletions(-)
 delete mode 100644 drivers/staging/tidspbridge/rmgr/drv_interface.h

-- 
1.7.8.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/8] staging: tidspbridge: more readable code
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 2/8] staging: tidspbridge: remove unused header Víctor Manuel Jáquez Leal
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

Uppercase function names are not pretty. Also the code flow readability is
enhanced.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 76cfc6e..85f6e8e 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -428,7 +428,7 @@ func_cont:
 }
 
 #ifdef CONFIG_PM
-static int BRIDGE_SUSPEND(struct platform_device *pdev, pm_message_t state)
+static int bridge_suspend(struct platform_device *pdev, pm_message_t state)
 {
 	u32 status;
 	u32 command = PWR_EMERGENCYDEEPSLEEP;
@@ -441,7 +441,7 @@ static int BRIDGE_SUSPEND(struct platform_device *pdev, pm_message_t state)
 	return 0;
 }
 
-static int BRIDGE_RESUME(struct platform_device *pdev)
+static int bridge_resume(struct platform_device *pdev)
 {
 	u32 status;
 
@@ -453,9 +453,6 @@ static int BRIDGE_RESUME(struct platform_device *pdev)
 	wake_up(&bridge_suspend_data.suspend_wq);
 	return 0;
 }
-#else
-#define BRIDGE_SUSPEND NULL
-#define BRIDGE_RESUME NULL
 #endif
 
 static struct platform_driver bridge_driver = {
@@ -464,8 +461,10 @@ static struct platform_driver bridge_driver = {
 		   },
 	.probe = omap34_xx_bridge_probe,
 	.remove = __devexit_p(omap34_xx_bridge_remove),
-	.suspend = BRIDGE_SUSPEND,
-	.resume = BRIDGE_RESUME,
+#ifdef CONFIG_PM
+	.suspend = bridge_suspend,
+	.resume = bridge_resume,
+#endif
 };
 
 static int __init bridge_init(void)
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/8] staging: tidspbridge: remove unused header
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 1/8] staging: tidspbridge: more readable code Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 3/8] staging: tidspbridge: Lindent to drv_interface.c Víctor Manuel Jáquez Leal
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

No functional changes.

The header file drv_interface.h was only used locally, hence there's no need
to have it.

Also the only prototyped functions were the file_operations callbacks, then
this commit moves them up to avoid prototyping too.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |  313 +++++++++++-----------
 drivers/staging/tidspbridge/rmgr/drv_interface.h |   28 --
 2 files changed, 155 insertions(+), 186 deletions(-)
 delete mode 100644 drivers/staging/tidspbridge/rmgr/drv_interface.h

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 85f6e8e..5ea753c 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -48,9 +48,6 @@
 /*  ----------------------------------- Resource Manager */
 #include <dspbridge/pwr.h>
 
-/*  ----------------------------------- This */
-#include <drv_interface.h>
-
 #include <dspbridge/resourcecleanup.h>
 #include <dspbridge/chnl.h>
 #include <dspbridge/proc.h>
@@ -133,6 +130,161 @@ 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;
+		}
+
+		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 {
+		status = -ENOMEM;
+	}
+err:
+	filp->private_data = pr_ctxt;
+#ifdef CONFIG_TIDSPBRIDGE_RECOVERY
+	if (!status)
+		atomic_inc(&bridge_cref);
+#endif
+	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);
+
+	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;
+
+	DBC_REQUIRE(filp != NULL);
+#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 offset = vma->vm_pgoff << PAGE_SHIFT;
+	u32 status;
+
+	DBC_ASSERT(vma->vm_start < vma->vm_end);
+
+	vma->vm_flags |= VM_RESERVED | VM_IO;
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+	dev_dbg(bridge, "%s: vm filp %p offset %x start %lx end %lx page_prot "
+		"%lx flags %lx\n", __func__, filp, offset,
+		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,
 	.release = bridge_release,
@@ -477,161 +629,6 @@ static void __exit bridge_exit(void)
 	platform_driver_unregister(&bridge_driver);
 }
 
-/*
- * 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;
-		}
-
-		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 {
-		status = -ENOMEM;
-	}
-err:
-	filp->private_data = pr_ctxt;
-#ifdef CONFIG_TIDSPBRIDGE_RECOVERY
-	if (!status)
-		atomic_inc(&bridge_cref);
-#endif
-	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);
-
-	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;
-
-	DBC_REQUIRE(filp != NULL);
-#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 offset = vma->vm_pgoff << PAGE_SHIFT;
-	u32 status;
-
-	DBC_ASSERT(vma->vm_start < vma->vm_end);
-
-	vma->vm_flags |= VM_RESERVED | VM_IO;
-	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-
-	dev_dbg(bridge, "%s: vm filp %p offset %x start %lx end %lx page_prot "
-		"%lx flags %lx\n", __func__, filp, offset,
-		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;
-}
-
 /* To remove all process resources before removing the process from the
  * process context list */
 int drv_remove_all_resources(void *process_ctxt)
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.h b/drivers/staging/tidspbridge/rmgr/drv_interface.h
deleted file mode 100644
index ab07060..0000000
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * drv_interface.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef	_DRV_INTERFACE_H_
-#define _DRV_INTERFACE_H_
-
-/* Prototypes for all functions in this bridge */
-static int __init bridge_init(void);	/* Initialize bridge */
-static void __exit bridge_exit(void);	/* Opposite of initialize */
-static int bridge_open(struct inode *ip, struct file *filp);	/* Open */
-static int bridge_release(struct inode *ip, struct file *filp);	/* Release */
-static long bridge_ioctl(struct file *filp, unsigned int code,
-				unsigned long args);
-static int bridge_mmap(struct file *filp, struct vm_area_struct *vma);
-#endif /* ifndef _DRV_INTERFACE_H_ */
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/8] staging: tidspbridge: Lindent to drv_interface.c
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 1/8] staging: tidspbridge: more readable code Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 2/8] staging: tidspbridge: remove unused header Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 4/8] staging: tidspbridge: silence the compiler Víctor Manuel Jáquez Leal
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

No functional changes.

According to Lindent, the file drv_internface.c had some lines with bad
indentation.

This commit is the output of Lindent.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 5ea753c..4316f4e 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -147,7 +147,7 @@ static int bridge_open(struct inode *ip, struct file *filp)
 #ifdef CONFIG_TIDSPBRIDGE_RECOVERY
 	if (recover) {
 		if (filp->f_flags & O_NONBLOCK ||
-			wait_for_completion_interruptible(&bridge_open_comp))
+		    wait_for_completion_interruptible(&bridge_open_comp))
 			return -EBUSY;
 	}
 #endif
@@ -245,7 +245,7 @@ static long bridge_ioctl(struct file *filp, unsigned int code,
 
 	if (!status) {
 		status = api_call_dev_ioctl(code, &buf_in, &retval,
-					     filp->private_data);
+					    filp->private_data);
 
 		if (!status) {
 			status = retval;
@@ -363,10 +363,10 @@ void bridge_recover_schedule(void)
 #endif
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
 static int dspbridge_scale_notification(struct notifier_block *op,
-		unsigned long val, void *ptr)
+					unsigned long val, void *ptr)
 {
 	struct omap_dsp_platform_data *pdata =
-		omap_dspbridge_dev->dev.platform_data;
+	    omap_dspbridge_dev->dev.platform_data;
 
 	if (CPUFREQ_POSTCHANGE == val && pdata->dsp_get_opp)
 		pwr_pm_post_scale(PRCM_VDD1, pdata->dsp_get_opp());
@@ -471,7 +471,7 @@ err2:
 err1:
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
 	cpufreq_unregister_notifier(&iva_clk_notifier,
-					CPUFREQ_TRANSITION_NOTIFIER);
+				    CPUFREQ_TRANSITION_NOTIFIER);
 #endif
 	dsp_clk_exit();
 
@@ -550,7 +550,7 @@ static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
 	if (cpufreq_unregister_notifier(&iva_clk_notifier,
-						CPUFREQ_TRANSITION_NOTIFIER))
+					CPUFREQ_TRANSITION_NOTIFIER))
 		pr_err("%s: cpufreq_unregister_notifier failed for iva2_ck\n",
 		       __func__);
 #endif /* #ifdef CONFIG_TIDSPBRIDGE_DVFS */
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/8] staging: tidspbridge: silence the compiler
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
                   ` (2 preceding siblings ...)
  2012-01-30 23:12 ` [PATCH v2 3/8] staging: tidspbridge: Lindent to drv_interface.c Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-31  8:05   ` Dan Carpenter
  2012-02-02 22:51   ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 5/8] staging: tidspbridge: remove header inclusions Víctor Manuel Jáquez Leal
                   ` (3 subsequent siblings)
  7 siblings, 2 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

Silence the warning when compiling drv_interface.c

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 4316f4e..7a6401a 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -273,8 +273,9 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
 	dev_dbg(bridge, "%s: vm filp %p offset %x start %lx end %lx page_prot "
-		"%lx flags %lx\n", __func__, filp, offset,
-		vma->vm_start, vma->vm_end, vma->vm_page_prot, vma->vm_flags);
+		"%ulx flags %lx\n", __func__, filp, offset,
+		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,
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/8] staging: tidspbridge: remove header inclusions
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
                   ` (3 preceding siblings ...)
  2012-01-30 23:12 ` [PATCH v2 4/8] staging: tidspbridge: silence the compiler Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 6/8] staging: tidspbridge: remove trivial assert Víctor Manuel Jáquez Leal
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

drv_interface.c include several header files that are not really used.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 7a6401a..4531920 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -16,11 +16,8 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-/*  ----------------------------------- Host OS */
-
 #include <plat/dsp.h>
 
-#include <dspbridge/host_os.h>
 #include <linux/types.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -38,10 +35,8 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/clk.h>
-#include <dspbridge/sync.h>
 
 /*  ----------------------------------- Platform Manager */
-#include <dspbridge/dspapi-ioctl.h>
 #include <dspbridge/dspapi.h>
 #include <dspbridge/dspdrv.h>
 
@@ -49,10 +44,8 @@
 #include <dspbridge/pwr.h>
 
 #include <dspbridge/resourcecleanup.h>
-#include <dspbridge/chnl.h>
 #include <dspbridge/proc.h>
 #include <dspbridge/dev.h>
-#include <dspbridge/drv.h>
 
 #ifdef CONFIG_TIDSPBRIDGE_DVFS
 #include <mach-omap2/omap3-opp.h>
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/8] staging: tidspbridge: remove trivial assert
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
                   ` (4 preceding siblings ...)
  2012-01-30 23:12 ` [PATCH v2 5/8] staging: tidspbridge: remove header inclusions Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 7/8] staging: tidspbridge: clean up bridge_mmap() Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 8/8] staging: tidspbridge: use the driver name string Víctor Manuel Jáquez Leal
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

The function dsp_deinit() always return true, so assert its output is
pointless. As consequence the variable were the returned value is stored, is
no longer needed.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 4531920..97c40ff 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -531,7 +531,6 @@ err1:
 static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
 {
 	dev_t devno;
-	bool ret;
 	int status = 0;
 	struct drv_data *drv_datap = dev_get_drvdata(bridge);
 
@@ -551,9 +550,8 @@ static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
 
 	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);
 	}
 
 func_cont:
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 7/8] staging: tidspbridge: clean up bridge_mmap()
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
                   ` (5 preceding siblings ...)
  2012-01-30 23:12 ` [PATCH v2 6/8] staging: tidspbridge: remove trivial assert Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  2012-01-30 23:12 ` [PATCH v2 8/8] staging: tidspbridge: use the driver name string Víctor Manuel Jáquez Leal
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

The variable offset is not used but in the debug log, so I don't see reason to
calculate it here.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 97c40ff..5f810b6 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -257,7 +257,6 @@ err:
 /* This function maps kernel space memory to user space memory. */
 static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	u32 offset = vma->vm_pgoff << PAGE_SHIFT;
 	u32 status;
 
 	DBC_ASSERT(vma->vm_start < vma->vm_end);
@@ -265,8 +264,8 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_flags |= VM_RESERVED | VM_IO;
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
-	dev_dbg(bridge, "%s: vm filp %p offset %x start %lx end %lx page_prot "
-		"%ulx flags %lx\n", __func__, filp, offset,
+	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);
 
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 8/8] staging: tidspbridge: use the driver name string
  2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
                   ` (6 preceding siblings ...)
  2012-01-30 23:12 ` [PATCH v2 7/8] staging: tidspbridge: clean up bridge_mmap() Víctor Manuel Jáquez Leal
@ 2012-01-30 23:12 ` Víctor Manuel Jáquez Leal
  7 siblings, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-01-30 23:12 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras

Instead of assign it to a global variable which is not used anymore.
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 5f810b6..93fc862 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -52,7 +52,6 @@
 #endif
 
 /*  ----------------------------------- Globals */
-#define DRIVER_NAME  "DspBridge"
 #define DSPBRIDGE_VERSION	"0.3"
 s32 dsp_debug;
 
@@ -121,8 +120,6 @@ 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.
@@ -490,7 +487,7 @@ static int __devinit omap34_xx_bridge_probe(struct platform_device *pdev)
 		goto err1;
 
 	/* use 2.6 device model */
-	err = alloc_chrdev_region(&dev, 0, 1, driver_name);
+	err = alloc_chrdev_region(&dev, 0, 1, "DspBridge");
 	if (err) {
 		pr_err("%s: Can't get major %d\n", __func__, driver_major);
 		goto err1;
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/8] staging: tidspbridge: silence the compiler
  2012-01-30 23:12 ` [PATCH v2 4/8] staging: tidspbridge: silence the compiler Víctor Manuel Jáquez Leal
@ 2012-01-31  8:05   ` Dan Carpenter
  2012-01-31 11:19     ` Víctor M. Jáquez L.
  2012-02-02 22:51   ` Víctor Manuel Jáquez Leal
  1 sibling, 1 reply; 13+ messages in thread
From: Dan Carpenter @ 2012-01-31  8:05 UTC (permalink / raw)
  To: Víctor Manuel Jáquez Leal
  Cc: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe, devel,
	linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

On Tue, Jan 31, 2012 at 12:12:20AM +0100, Víctor Manuel Jáquez Leal wrote:
> Silence the warning when compiling drv_interface.c
> 
> Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>

What does the compiler warn about here?  Normally you would cut and
paste the warning into the commit message.  But at least give us a
hint.

You could also reformat that printk so the message is on one line.

	dev_dbg(bridge,
	        "%s: vm filp %p offset %x start %lx end %lx page_prot %ulx flags %lx\n",
		__func__, filp, offset, vma->vm_start, vma->vm_end,
		vma->vm_page_prot, vma->vm_flags);

regards,
dan carpenter



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/8] staging: tidspbridge: silence the compiler
  2012-01-31  8:05   ` Dan Carpenter
@ 2012-01-31 11:19     ` Víctor M. Jáquez L.
  2012-01-31 11:29       ` Dan Carpenter
  0 siblings, 1 reply; 13+ messages in thread
From: Víctor M. Jáquez L. @ 2012-01-31 11:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe, devel,
	linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

On Tue, Jan 31, 2012 at 11:05:43AM +0300, Dan Carpenter wrote:
> On Tue, Jan 31, 2012 at 12:12:20AM +0100, Víctor Manuel Jáquez Leal wrote:
> > Silence the warning when compiling drv_interface.c
> > 
> > Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
> 
> What does the compiler warn about here?  Normally you would cut and
> paste the warning into the commit message.  But at least give us a
> hint.
> 
> You could also reformat that printk so the message is on one line.
> 
> 	dev_dbg(bridge,
> 	        "%s: vm filp %p offset %x start %lx end %lx page_prot %ulx flags %lx\n",
> 		__func__, filp, offset, vma->vm_start, vma->vm_end,
> 		vma->vm_page_prot, vma->vm_flags);

Ok. I'll do it.

I have a doubt about the process in this case: if this is the only
modification request, should I resend all the patch set, or just this one?

Thanks

vmjl

> 
> regards,
> dan carpenter
> 
> 



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/8] staging: tidspbridge: silence the compiler
  2012-01-31 11:19     ` Víctor M. Jáquez L.
@ 2012-01-31 11:29       ` Dan Carpenter
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2012-01-31 11:29 UTC (permalink / raw)
  To: Víctor M. Jáquez L.
  Cc: Omar Ramirez Luna, Greg Kroah-Hartman, Armando Uribe, devel,
	linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

On Tue, Jan 31, 2012 at 12:19:52PM +0100, Víctor M. Jáquez L. wrote:
> On Tue, Jan 31, 2012 at 11:05:43AM +0300, Dan Carpenter wrote:
> > On Tue, Jan 31, 2012 at 12:12:20AM +0100, Víctor Manuel Jáquez Leal wrote:
> > > Silence the warning when compiling drv_interface.c
> > > 
> > > Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
> > 
> > What does the compiler warn about here?  Normally you would cut and
> > paste the warning into the commit message.  But at least give us a
> > hint.
> > 
> > You could also reformat that printk so the message is on one line.
> > 
> > 	dev_dbg(bridge,
> > 	        "%s: vm filp %p offset %x start %lx end %lx page_prot %ulx flags %lx\n",
> > 		__func__, filp, offset, vma->vm_start, vma->vm_end,
> > 		vma->vm_page_prot, vma->vm_flags);
> 
> Ok. I'll do it.
> 
> I have a doubt about the process in this case: if this is the only
> modification request, should I resend all the patch set, or just this one?
> 

If you sent just the one, and you redid the printk() then it would
make the later patches not apply.

Maybe just send the one, with a fixed changelog and leave the patch
as is.  The problems in the printk() were not introduced in this
patch so I can't really complain about that.  A couple people have
already volunteered to fix that in a later patch.

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 4/8] staging: tidspbridge: silence the compiler
  2012-01-30 23:12 ` [PATCH v2 4/8] staging: tidspbridge: silence the compiler Víctor Manuel Jáquez Leal
  2012-01-31  8:05   ` Dan Carpenter
@ 2012-02-02 22:51   ` Víctor Manuel Jáquez Leal
  1 sibling, 0 replies; 13+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-02-02 22:51 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: linux-kernel, devel, linux-omap, Felipe Contreras, Dan Carpenter

When compiling this report is raised by the compiler:

  CC [M]  drivers/staging/tidspbridge/rmgr/drv_interface.o
drivers/staging/tidspbridge/rmgr/drv_interface.c: In function 'bridge_mmap':
drivers/staging/tidspbridge/rmgr/drv_interface.c:275:2: warning: format '%lx' expects type 'long unsigned int', but argument 9 has type 'pgprot_t'

This patch fixes that warning message.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 4316f4e..7a6401a 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -273,8 +273,9 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
 	dev_dbg(bridge, "%s: vm filp %p offset %x start %lx end %lx page_prot "
-		"%lx flags %lx\n", __func__, filp, offset,
-		vma->vm_start, vma->vm_end, vma->vm_page_prot, vma->vm_flags);
+		"%ulx flags %lx\n", __func__, filp, offset,
+		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,
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-02-02 22:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 23:12 [PATCH v2 0/8] staging: tidspbridge: clean up drv_interface.c Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 1/8] staging: tidspbridge: more readable code Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 2/8] staging: tidspbridge: remove unused header Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 3/8] staging: tidspbridge: Lindent to drv_interface.c Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 4/8] staging: tidspbridge: silence the compiler Víctor Manuel Jáquez Leal
2012-01-31  8:05   ` Dan Carpenter
2012-01-31 11:19     ` Víctor M. Jáquez L.
2012-01-31 11:29       ` Dan Carpenter
2012-02-02 22:51   ` Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 5/8] staging: tidspbridge: remove header inclusions Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 6/8] staging: tidspbridge: remove trivial assert Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 7/8] staging: tidspbridge: clean up bridge_mmap() Víctor Manuel Jáquez Leal
2012-01-30 23:12 ` [PATCH v2 8/8] staging: tidspbridge: use the driver name string Víctor Manuel Jáquez Leal

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).