2017-06-15 11:58:41

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] crypto: n2: make of_device_ids const

of_device_ids are not supposed to change at runtime. All functions
working with of_device_ids provided by <linux/of.h> work with const
of_device_ids. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
2001 2168 48 4217 1079 drivers/crypto/n2_core.o

File size after constify dummy_tlb_ops.:
text data bss dec hex filename
3601 536 48 4185 1059 drivers/crypto/n2_core.o

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/crypto/n2_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 4ecb77a..2694513 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -2169,7 +2169,7 @@ static int n2_mau_remove(struct platform_device *dev)
return 0;
}

-static struct of_device_id n2_crypto_match[] = {
+static const struct of_device_id n2_crypto_match[] = {
{
.name = "n2cp",
.compatible = "SUNW,n2-cwq",
@@ -2196,7 +2196,7 @@ static int n2_mau_remove(struct platform_device *dev)
.remove = n2_crypto_remove,
};

-static struct of_device_id n2_mau_match[] = {
+static const struct of_device_id n2_mau_match[] = {
{
.name = "ncp",
.compatible = "SUNW,n2-mau",
--
1.9.1


2017-06-15 15:11:11

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] crypto: n2: make of_device_ids const

From: Arvind Yadav <[email protected]>
Date: Thu, 15 Jun 2017 17:28:10 +0530

> of_device_ids are not supposed to change at runtime. All functions
> working with of_device_ids provided by <linux/of.h> work with const
> of_device_ids. So mark the non-const structs as const.
>
> File size before:
> text data bss dec hex filename
> 2001 2168 48 4217 1079 drivers/crypto/n2_core.o
>
> File size after constify dummy_tlb_ops.:
> text data bss dec hex filename
> 3601 536 48 4185 1059 drivers/crypto/n2_core.o
>
> Signed-off-by: Arvind Yadav <[email protected]>

Acked-by: David S. Miller <[email protected]>

2017-06-20 03:42:42

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: n2: make of_device_ids const

On Thu, Jun 15, 2017 at 05:28:10PM +0530, Arvind Yadav wrote:
> of_device_ids are not supposed to change at runtime. All functions
> working with of_device_ids provided by <linux/of.h> work with const
> of_device_ids. So mark the non-const structs as const.
>
> File size before:
> text data bss dec hex filename
> 2001 2168 48 4217 1079 drivers/crypto/n2_core.o
>
> File size after constify dummy_tlb_ops.:
> text data bss dec hex filename
> 3601 536 48 4185 1059 drivers/crypto/n2_core.o
>
> Signed-off-by: Arvind Yadav <[email protected]>

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt