* [PATCH 0/2] [media] davinci: make function arguments and structures const
@ 2017-10-17 12:27 Bhumika Goyal
2017-10-17 12:27 ` [PATCH 1/2] [media] davinci: make function arguments const Bhumika Goyal
2017-10-17 12:27 ` [PATCH 2/2] [media] davinci: make ccdc_hw_device structures const Bhumika Goyal
0 siblings, 2 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-17 12:27 UTC (permalink / raw)
To: julia.lawall, prabhakar.csengg, mchehab, linux-media, linux-kernel
Cc: Bhumika Goyal
Make some function arguments as const. After this changes make ccdc_hw_device
structures as const.
Bhumika Goyal (2):
[media] davinci: make function arguments const
[media] davinci: make ccdc_hw_device structures const
drivers/media/platform/davinci/ccdc_hw_device.h | 4 ++--
drivers/media/platform/davinci/dm355_ccdc.c | 2 +-
drivers/media/platform/davinci/dm644x_ccdc.c | 2 +-
drivers/media/platform/davinci/isif.c | 2 +-
drivers/media/platform/davinci/vpfe_capture.c | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] [media] davinci: make function arguments const
2017-10-17 12:27 [PATCH 0/2] [media] davinci: make function arguments and structures const Bhumika Goyal
@ 2017-10-17 12:27 ` Bhumika Goyal
2017-10-17 12:27 ` [PATCH 2/2] [media] davinci: make ccdc_hw_device structures const Bhumika Goyal
1 sibling, 0 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-17 12:27 UTC (permalink / raw)
To: julia.lawall, prabhakar.csengg, mchehab, linux-media, linux-kernel
Cc: Bhumika Goyal
Make the function arguments of functions vpfe_{register/unregister}_ccdc_device
const as the pointer dev does not modify the fields of the structure
it points to. Also, declare the variable ccdc_dev const as it points to the
same structure as dev but it does not modify the fields as well.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/media/platform/davinci/ccdc_hw_device.h | 4 ++--
drivers/media/platform/davinci/vpfe_capture.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/media/platform/davinci/ccdc_hw_device.h b/drivers/media/platform/davinci/ccdc_hw_device.h
index f1b5210..3482178 100644
--- a/drivers/media/platform/davinci/ccdc_hw_device.h
+++ b/drivers/media/platform/davinci/ccdc_hw_device.h
@@ -82,8 +82,8 @@ struct ccdc_hw_device {
};
/* Used by CCDC module to register & unregister with vpfe capture driver */
-int vpfe_register_ccdc_device(struct ccdc_hw_device *dev);
-void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev);
+int vpfe_register_ccdc_device(const struct ccdc_hw_device *dev);
+void vpfe_unregister_ccdc_device(const struct ccdc_hw_device *dev);
#endif
#endif
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 6792da1..7b3f6f8 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -115,7 +115,7 @@ struct ccdc_config {
};
/* ccdc device registered */
-static struct ccdc_hw_device *ccdc_dev;
+static const struct ccdc_hw_device *ccdc_dev;
/* lock for accessing ccdc information */
static DEFINE_MUTEX(ccdc_lock);
/* ccdc configuration */
@@ -203,7 +203,7 @@ static const struct vpfe_pixel_format *vpfe_lookup_pix_format(u32 pix_format)
* vpfe_register_ccdc_device. CCDC module calls this to
* register with vpfe capture
*/
-int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
+int vpfe_register_ccdc_device(const struct ccdc_hw_device *dev)
{
int ret = 0;
printk(KERN_NOTICE "vpfe_register_ccdc_device: %s\n", dev->name);
@@ -259,7 +259,7 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
* vpfe_unregister_ccdc_device. CCDC module calls this to
* unregister with vpfe capture
*/
-void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev)
+void vpfe_unregister_ccdc_device(const struct ccdc_hw_device *dev)
{
if (!dev) {
printk(KERN_ERR "invalid ccdc device ptr\n");
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] [media] davinci: make ccdc_hw_device structures const
2017-10-17 12:27 [PATCH 0/2] [media] davinci: make function arguments and structures const Bhumika Goyal
2017-10-17 12:27 ` [PATCH 1/2] [media] davinci: make function arguments const Bhumika Goyal
@ 2017-10-17 12:27 ` Bhumika Goyal
1 sibling, 0 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-17 12:27 UTC (permalink / raw)
To: julia.lawall, prabhakar.csengg, mchehab, linux-media, linux-kernel
Cc: Bhumika Goyal
Make these structures const as they are only getting passed to the
functions vpfe_{register/unregister}_ccdc_device having the argument as
const.
Structures found using Coccinelle and changes done by hand.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/media/platform/davinci/dm355_ccdc.c | 2 +-
drivers/media/platform/davinci/dm644x_ccdc.c | 2 +-
drivers/media/platform/davinci/isif.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c b/drivers/media/platform/davinci/dm355_ccdc.c
index 6d492dc..89cb309 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -841,7 +841,7 @@ static int ccdc_set_hw_if_params(struct vpfe_hw_if_param *params)
return 0;
}
-static struct ccdc_hw_device ccdc_hw_dev = {
+static const struct ccdc_hw_device ccdc_hw_dev = {
.name = "DM355 CCDC",
.owner = THIS_MODULE,
.hw_ops = {
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c
index 3b2d8a9..5fa0a1f 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -776,7 +776,7 @@ static void ccdc_restore_context(void)
regw(ccdc_ctx[CCDC_VP_OUT >> 2], CCDC_VP_OUT);
regw(ccdc_ctx[CCDC_PCR >> 2], CCDC_PCR);
}
-static struct ccdc_hw_device ccdc_hw_dev = {
+static const struct ccdc_hw_device ccdc_hw_dev = {
.name = "DM6446 CCDC",
.owner = THIS_MODULE,
.hw_ops = {
diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
index 5813b49..d5ff584 100644
--- a/drivers/media/platform/davinci/isif.c
+++ b/drivers/media/platform/davinci/isif.c
@@ -1000,7 +1000,7 @@ static int isif_close(struct device *device)
return 0;
}
-static struct ccdc_hw_device isif_hw_dev = {
+static const struct ccdc_hw_device isif_hw_dev = {
.name = "ISIF",
.owner = THIS_MODULE,
.hw_ops = {
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-17 12:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17 12:27 [PATCH 0/2] [media] davinci: make function arguments and structures const Bhumika Goyal
2017-10-17 12:27 ` [PATCH 1/2] [media] davinci: make function arguments const Bhumika Goyal
2017-10-17 12:27 ` [PATCH 2/2] [media] davinci: make ccdc_hw_device structures const Bhumika Goyal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®