All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: dgnc: Add const qualifier to struct declaration.
@ 2016-10-14  2:21 Elise Lennion
  2016-10-14  4:48 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Elise Lennion @ 2016-10-14  2:21 UTC (permalink / raw)
  To: lidza.louina, markh, gregkh, outreachy-kernel

Const qualifier added to struct declaration to make the code more
efficient.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---
 drivers/staging/dgnc/dgnc_driver.c | 2 +-
 drivers/staging/dgnc/dgnc_tty.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index fd372d3..6576674 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -93,7 +93,7 @@ struct board_id {
 	unsigned int is_pci_express;
 };
 
-static struct board_id dgnc_ids[] = {
+static const struct board_id dgnc_ids[] = {
 	{	PCI_DEVICE_CLASSIC_4_PCI_NAME,		4,	0	},
 	{	PCI_DEVICE_CLASSIC_4_422_PCI_NAME,	4,	0	},
 	{	PCI_DEVICE_CLASSIC_8_PCI_NAME,		8,	0	},
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index ef9a45b..cf8aefd 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -50,7 +50,7 @@ static unsigned char		*dgnc_TmpWriteBuf;
 /*
  * Default transparent print information.
  */
-static struct digi_t dgnc_digi_init = {
+static const struct digi_t dgnc_digi_init = {
 	.digi_flags =	DIGI_COOK,	/* Flags			*/
 	.digi_maxcps =	100,		/* Max CPS			*/
 	.digi_maxchar =	50,		/* Max chars in print queue	*/
-- 
2.7.4



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

* Re: [Outreachy kernel] [PATCH] staging: dgnc: Add const qualifier to struct declaration.
  2016-10-14  2:21 [PATCH] staging: dgnc: Add const qualifier to struct declaration Elise Lennion
@ 2016-10-14  4:48 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-10-14  4:48 UTC (permalink / raw)
  To: Elise Lennion; +Cc: lidza.louina, markh, gregkh, outreachy-kernel



On Thu, 13 Oct 2016, Elise Lennion wrote:

> Const qualifier added to struct declaration to make the code more
> efficient.

It's not an efficiency issue.  The goal is to protect the data from being
overwritten at runtime.

julia

>
> Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
> ---
>  drivers/staging/dgnc/dgnc_driver.c | 2 +-
>  drivers/staging/dgnc/dgnc_tty.c    | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
> index fd372d3..6576674 100644
> --- a/drivers/staging/dgnc/dgnc_driver.c
> +++ b/drivers/staging/dgnc/dgnc_driver.c
> @@ -93,7 +93,7 @@ struct board_id {
>  	unsigned int is_pci_express;
>  };
>
> -static struct board_id dgnc_ids[] = {
> +static const struct board_id dgnc_ids[] = {
>  	{	PCI_DEVICE_CLASSIC_4_PCI_NAME,		4,	0	},
>  	{	PCI_DEVICE_CLASSIC_4_422_PCI_NAME,	4,	0	},
>  	{	PCI_DEVICE_CLASSIC_8_PCI_NAME,		8,	0	},
> diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
> index ef9a45b..cf8aefd 100644
> --- a/drivers/staging/dgnc/dgnc_tty.c
> +++ b/drivers/staging/dgnc/dgnc_tty.c
> @@ -50,7 +50,7 @@ static unsigned char		*dgnc_TmpWriteBuf;
>  /*
>   * Default transparent print information.
>   */
> -static struct digi_t dgnc_digi_init = {
> +static const struct digi_t dgnc_digi_init = {
>  	.digi_flags =	DIGI_COOK,	/* Flags			*/
>  	.digi_maxcps =	100,		/* Max CPS			*/
>  	.digi_maxchar =	50,		/* Max chars in print queue	*/
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161014022116.GA5477%40lennorien.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

end of thread, other threads:[~2016-10-14  4:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14  2:21 [PATCH] staging: dgnc: Add const qualifier to struct declaration Elise Lennion
2016-10-14  4:48 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.