* [PATCH] hwmon: (fschmd) Make const arrays static const
@ 2022-10-05 15:27 Colin Ian King
2022-10-05 18:31 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-10-05 15:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon; +Cc: kernel-janitors, linux-kernel
Don't populate the read-only const arrays names and watchdog_minors
on the stack but instead make them static const. Also makes the
object code a little smaller.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/hwmon/fschmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index 0a77d6161928..e1f426e86f36 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -1083,9 +1083,9 @@ static int fschmd_detect(struct i2c_client *client,
static int fschmd_probe(struct i2c_client *client)
{
struct fschmd_data *data;
- const char * const names[7] = { "Poseidon", "Hermes", "Scylla",
+ static const char * const names[7] = { "Poseidon", "Hermes", "Scylla",
"Heracles", "Heimdall", "Hades", "Syleus" };
- const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
+ static const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
int i, err;
enum chips kind = i2c_match_id(fschmd_id, client)->driver_data;
--
2.37.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (fschmd) Make const arrays static const
2022-10-05 15:27 [PATCH] hwmon: (fschmd) Make const arrays static const Colin Ian King
@ 2022-10-05 18:31 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-10-05 18:31 UTC (permalink / raw)
To: Colin Ian King; +Cc: Jean Delvare, linux-hwmon, kernel-janitors, linux-kernel
On Wed, Oct 05, 2022 at 04:27:52PM +0100, Colin Ian King wrote:
> Don't populate the read-only const arrays names and watchdog_minors
> on the stack but instead make them static const. Also makes the
> object code a little smaller.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Applied to hwmon-next.
Thanks,
Guenter
> ---
> drivers/hwmon/fschmd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
> index 0a77d6161928..e1f426e86f36 100644
> --- a/drivers/hwmon/fschmd.c
> +++ b/drivers/hwmon/fschmd.c
> @@ -1083,9 +1083,9 @@ static int fschmd_detect(struct i2c_client *client,
> static int fschmd_probe(struct i2c_client *client)
> {
> struct fschmd_data *data;
> - const char * const names[7] = { "Poseidon", "Hermes", "Scylla",
> + static const char * const names[7] = { "Poseidon", "Hermes", "Scylla",
> "Heracles", "Heimdall", "Hades", "Syleus" };
> - const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
> + static const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
> int i, err;
> enum chips kind = i2c_match_id(fschmd_id, client)->driver_data;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-05 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-05 15:27 [PATCH] hwmon: (fschmd) Make const arrays static const Colin Ian King
2022-10-05 18:31 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox