2022-10-05 16:17:47

by Colin Ian King

[permalink] [raw]
Subject: [PATCH] Input: dlink-dir685-touchkeys: Make array bl_data static const

Don't populate the read-only array bl_data on the stack but instead
make it static const. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/input/keyboard/dlink-dir685-touchkeys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/input/keyboard/dlink-dir685-touchkeys.c
index a69dcc3bd30c..7db7fb175869 100644
--- a/drivers/input/keyboard/dlink-dir685-touchkeys.c
+++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c
@@ -64,7 +64,7 @@ static int dir685_tk_probe(struct i2c_client *client,
{
struct dir685_touchkeys *tk;
struct device *dev = &client->dev;
- u8 bl_data[] = { 0xa7, 0x40 };
+ static const u8 bl_data[] = { 0xa7, 0x40 };
int err;
int i;

--
2.37.3


2022-10-06 08:23:37

by Mattijs Korpershoek

[permalink] [raw]
Subject: Re: [PATCH] Input: dlink-dir685-touchkeys: Make array bl_data static const

On Wed, Oct 05, 2022 at 16:48, Colin Ian King <[email protected]> wrote:

> Don't populate the read-only array bl_data on the stack but instead
> make it static const. Also makes the object code a little smaller.
>
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Mattijs Korpershoek <[email protected]>

> ---
> drivers/input/keyboard/dlink-dir685-touchkeys.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/input/keyboard/dlink-dir685-touchkeys.c
> index a69dcc3bd30c..7db7fb175869 100644
> --- a/drivers/input/keyboard/dlink-dir685-touchkeys.c
> +++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c
> @@ -64,7 +64,7 @@ static int dir685_tk_probe(struct i2c_client *client,
> {
> struct dir685_touchkeys *tk;
> struct device *dev = &client->dev;
> - u8 bl_data[] = { 0xa7, 0x40 };
> + static const u8 bl_data[] = { 0xa7, 0x40 };
> int err;
> int i;
>
> --
> 2.37.3

2022-10-06 09:58:54

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] Input: dlink-dir685-touchkeys: Make array bl_data static const

On Wed, Oct 5, 2022 at 5:48 PM Colin Ian King <[email protected]> wrote:

> Don't populate the read-only array bl_data on the stack but instead
> make it static const. Also makes the object code a little smaller.
>
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij