Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 0/5] drivers/char: Constify static variables
@ 2020-07-01 20:09 Rikard Falkeborn
  2020-07-01 20:09 ` [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[] Rikard Falkeborn
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Rikard Falkeborn @ 2020-07-01 20:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann
  Cc: Rikard Falkeborn, Amit Shah, Matt Mackall, Herbert Xu,
	Nicolas Saenz Julienne, Florian Fainelli, Ray Jui, Scott Branden,
	Corey Minyard, virtualization, openipmi-developer,
	bcm-kernel-feedback-list, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

Constify some static variables (mostly structs) that are not modified.

Rikard Falkeborn (5):
  hwrng: bcm2835 - Constify bcm2835_rng_devtype[]
  hwrng: nomadik - Constify nmk_rng_ids[]
  hwrng: virtio - Constify id_table[]
  ipmi: watchdog: Constify ident
  virtio_console: Constify some static variables

 drivers/char/hw_random/bcm2835-rng.c | 2 +-
 drivers/char/hw_random/nomadik-rng.c | 2 +-
 drivers/char/hw_random/virtio-rng.c  | 2 +-
 drivers/char/ipmi/ipmi_watchdog.c    | 2 +-
 drivers/char/virtio_console.c        | 8 ++++----
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.27.0


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

* [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[]
  2020-07-01 20:09 [PATCH 0/5] drivers/char: Constify static variables Rikard Falkeborn
@ 2020-07-01 20:09 ` Rikard Falkeborn
  2020-07-01 21:52   ` Florian Fainelli
  2020-07-01 20:09 ` [PATCH 2/5] hwrng: nomadik - Constify nmk_rng_ids[] Rikard Falkeborn
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Rikard Falkeborn @ 2020-07-01 20:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann
  Cc: Rikard Falkeborn, linux-kernel, Matt Mackall, Herbert Xu,
	Nicolas Saenz Julienne, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel

bcm2835_rng_devtype[] is not modified and can be made const to allow the
compiler to put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
   2392     176       0    2568     a08 drivers/char/hw_random/bcm2835-rng.o

After:
   text    data     bss     dec     hex filename
   2464     104       0    2568     a08 drivers/char/hw_random/bcm2835-rng.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/char/hw_random/bcm2835-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index cbf5eaea662c..0839236a6d19 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -188,7 +188,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 
 MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match);
 
-static struct platform_device_id bcm2835_rng_devtype[] = {
+static const struct platform_device_id bcm2835_rng_devtype[] = {
 	{ .name = "bcm2835-rng" },
 	{ .name = "bcm63xx-rng" },
 	{ /* sentinel */ }
-- 
2.27.0


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

* [PATCH 2/5] hwrng: nomadik - Constify nmk_rng_ids[]
  2020-07-01 20:09 [PATCH 0/5] drivers/char: Constify static variables Rikard Falkeborn
  2020-07-01 20:09 ` [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[] Rikard Falkeborn
@ 2020-07-01 20:09 ` Rikard Falkeborn
  2020-07-02  7:51   ` Arnd Bergmann
  2020-07-01 20:09 ` [PATCH 3/5] hwrng: virtio - Constify id_table[] Rikard Falkeborn
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Rikard Falkeborn @ 2020-07-01 20:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann
  Cc: Rikard Falkeborn, Matt Mackall, Herbert Xu, linux-crypto,
	linux-kernel

nmk_rng_ids[] is not modified and can be made const to allow the
compiler to put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
    652     216       4     872     368 drivers/char/hw_random/nomadik-rng.o

After:
   text    data     bss     dec     hex filename
    676     192       4     872     368 drivers/char/hw_random/nomadik-rng.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/char/hw_random/nomadik-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/nomadik-rng.c b/drivers/char/hw_random/nomadik-rng.c
index 74ed29f42e4f..b0ded41eb865 100644
--- a/drivers/char/hw_random/nomadik-rng.c
+++ b/drivers/char/hw_random/nomadik-rng.c
@@ -76,7 +76,7 @@ static int nmk_rng_remove(struct amba_device *dev)
 	return 0;
 }
 
-static struct amba_id nmk_rng_ids[] = {
+static const struct amba_id nmk_rng_ids[] = {
 	{
 		.id	= 0x000805e1,
 		.mask	= 0x000fffff, /* top bits are rev and cfg: accept all */
-- 
2.27.0


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

* [PATCH 3/5] hwrng: virtio - Constify id_table[]
  2020-07-01 20:09 [PATCH 0/5] drivers/char: Constify static variables Rikard Falkeborn
  2020-07-01 20:09 ` [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[] Rikard Falkeborn
  2020-07-01 20:09 ` [PATCH 2/5] hwrng: nomadik - Constify nmk_rng_ids[] Rikard Falkeborn
@ 2020-07-01 20:09 ` Rikard Falkeborn
  2020-07-02  8:58 ` [PATCH 0/5] drivers/char: Constify static variables Arnd Bergmann
  2020-07-09 12:54 ` Herbert Xu
  4 siblings, 0 replies; 8+ messages in thread
From: Rikard Falkeborn @ 2020-07-01 20:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann
  Cc: Rikard Falkeborn, Matt Mackall, Herbert Xu, linux-crypto,
	linux-kernel

id_table[] is not modified and an be made const to allow the compiler to
put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
   1746     192       8    1946     79a drivers/char/hw_random/virtio-rng.o

After:
   text    data     bss     dec     hex filename
   1762     176       8    1946     79a drivers/char/hw_random/virtio-rng.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/char/hw_random/virtio-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 79a6e47b5fbc..a90001e02bf7 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -195,7 +195,7 @@ static int virtrng_restore(struct virtio_device *vdev)
 }
 #endif
 
-static struct virtio_device_id id_table[] = {
+static const struct virtio_device_id id_table[] = {
 	{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
 	{ 0 },
 };
-- 
2.27.0


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

* Re: [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[]
  2020-07-01 20:09 ` [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[] Rikard Falkeborn
@ 2020-07-01 21:52   ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2020-07-01 21:52 UTC (permalink / raw)
  To: Rikard Falkeborn, Greg Kroah-Hartman, Arnd Bergmann
  Cc: linux-kernel, Matt Mackall, Herbert Xu, Nicolas Saenz Julienne,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel



On 7/1/2020 1:09 PM, Rikard Falkeborn wrote:
> bcm2835_rng_devtype[] is not modified and can be made const to allow the
> compiler to put it in read-only memory.
> 
> Before:
>    text    data     bss     dec     hex filename
>    2392     176       0    2568     a08 drivers/char/hw_random/bcm2835-rng.o
> 
> After:
>    text    data     bss     dec     hex filename
>    2464     104       0    2568     a08 drivers/char/hw_random/bcm2835-rng.o
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH 2/5] hwrng: nomadik - Constify nmk_rng_ids[]
  2020-07-01 20:09 ` [PATCH 2/5] hwrng: nomadik - Constify nmk_rng_ids[] Rikard Falkeborn
@ 2020-07-02  7:51   ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2020-07-02  7:51 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Greg Kroah-Hartman, Matt Mackall, Herbert Xu,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE,
	linux-kernel@vger.kernel.org

On Wed, Jul 1, 2020 at 11:48 PM Rikard Falkeborn
<rikard.falkeborn@gmail.com> wrote:
>
> nmk_rng_ids[] is not modified and can be made const to allow the
> compiler to put it in read-only memory.
>
> Before:
>    text    data     bss     dec     hex filename
>     652     216       4     872     368 drivers/char/hw_random/nomadik-rng.o
>
> After:
>    text    data     bss     dec     hex filename
>     676     192       4     872     368 drivers/char/hw_random/nomadik-rng.o

Moving 24 bytes into the .rodata section is probably not a worth
the change, but the patch is correct and I agree this should be
.rodata anway.

> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

> ---
>  drivers/char/hw_random/nomadik-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/nomadik-rng.c b/drivers/char/hw_random/nomadik-rng.c
> index 74ed29f42e4f..b0ded41eb865 100644
> --- a/drivers/char/hw_random/nomadik-rng.c
> +++ b/drivers/char/hw_random/nomadik-rng.c
> @@ -76,7 +76,7 @@ static int nmk_rng_remove(struct amba_device *dev)
>         return 0;
>  }
>
> -static struct amba_id nmk_rng_ids[] = {
> +static const struct amba_id nmk_rng_ids[] = {
>         {
>                 .id     = 0x000805e1,
>                 .mask   = 0x000fffff, /* top bits are rev and cfg: accept all */
> --
> 2.27.0
>

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

* Re: [PATCH 0/5] drivers/char: Constify static variables
  2020-07-01 20:09 [PATCH 0/5] drivers/char: Constify static variables Rikard Falkeborn
                   ` (2 preceding siblings ...)
  2020-07-01 20:09 ` [PATCH 3/5] hwrng: virtio - Constify id_table[] Rikard Falkeborn
@ 2020-07-02  8:58 ` Arnd Bergmann
  2020-07-09 12:54 ` Herbert Xu
  4 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2020-07-02  8:58 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Greg Kroah-Hartman, Amit Shah, Matt Mackall, Herbert Xu,
	Nicolas Saenz Julienne, Florian Fainelli, Ray Jui, Scott Branden,
	Corey Minyard, virtualization, openipmi-developer,
	bcm-kernel-feedback-list,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE,
	moderated list:BROADCOM BCM2835 ARM ARCHITECTURE, Linux ARM,
	linux-kernel@vger.kernel.org

On Wed, Jul 1, 2020 at 11:48 PM Rikard Falkeborn
<rikard.falkeborn@gmail.com> wrote:
>
> Constify some static variables (mostly structs) that are not modified.
>
> Rikard Falkeborn (5):
>   hwrng: bcm2835 - Constify bcm2835_rng_devtype[]
>   hwrng: nomadik - Constify nmk_rng_ids[]
>   hwrng: virtio - Constify id_table[]
>   ipmi: watchdog: Constify ident
>   virtio_console: Constify some static variables

I just realized it was a series rather than a single patch I received. They
all look correct, so

Acked-by: Arnd Bergmann <arnd@arndb.de>

but if you do more of those, I would suggest not including the 'size'
output for the small variables as that is not the main point here.

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

* Re: [PATCH 0/5] drivers/char: Constify static variables
  2020-07-01 20:09 [PATCH 0/5] drivers/char: Constify static variables Rikard Falkeborn
                   ` (3 preceding siblings ...)
  2020-07-02  8:58 ` [PATCH 0/5] drivers/char: Constify static variables Arnd Bergmann
@ 2020-07-09 12:54 ` Herbert Xu
  4 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2020-07-09 12:54 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Greg Kroah-Hartman, Arnd Bergmann, Amit Shah, Matt Mackall,
	Nicolas Saenz Julienne, Florian Fainelli, Ray Jui, Scott Branden,
	Corey Minyard, virtualization, openipmi-developer,
	bcm-kernel-feedback-list, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

On Wed, Jul 01, 2020 at 10:09:45PM +0200, Rikard Falkeborn wrote:
> Constify some static variables (mostly structs) that are not modified.
> 
> Rikard Falkeborn (5):
>   hwrng: bcm2835 - Constify bcm2835_rng_devtype[]
>   hwrng: nomadik - Constify nmk_rng_ids[]
>   hwrng: virtio - Constify id_table[]
>   ipmi: watchdog: Constify ident
>   virtio_console: Constify some static variables
> 
>  drivers/char/hw_random/bcm2835-rng.c | 2 +-
>  drivers/char/hw_random/nomadik-rng.c | 2 +-
>  drivers/char/hw_random/virtio-rng.c  | 2 +-
>  drivers/char/ipmi/ipmi_watchdog.c    | 2 +-
>  drivers/char/virtio_console.c        | 8 ++++----
>  5 files changed, 8 insertions(+), 8 deletions(-)

Patches 1-3 applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2020-07-09 12:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-01 20:09 [PATCH 0/5] drivers/char: Constify static variables Rikard Falkeborn
2020-07-01 20:09 ` [PATCH 1/5] hwrng: bcm2835 - Constify bcm2835_rng_devtype[] Rikard Falkeborn
2020-07-01 21:52   ` Florian Fainelli
2020-07-01 20:09 ` [PATCH 2/5] hwrng: nomadik - Constify nmk_rng_ids[] Rikard Falkeborn
2020-07-02  7:51   ` Arnd Bergmann
2020-07-01 20:09 ` [PATCH 3/5] hwrng: virtio - Constify id_table[] Rikard Falkeborn
2020-07-02  8:58 ` [PATCH 0/5] drivers/char: Constify static variables Arnd Bergmann
2020-07-09 12:54 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox