]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: atmel-sha204a - Use named initializers for struct i2c_device_id
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Wed, 20 May 2026 07:01:29 +0000 (09:01 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 29 May 2026 05:55:58 +0000 (13:55 +0800)
While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

This patch doesn't modify the compiled array, only its representation in
source form benefits. The former was confirmed with x86 and arm64
builds.

For consistency also assign .driver_data for the array item that the
driver relies on i2c_get_match_data() returning NULL for.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-sha204a.c

index a51e1f1e008848e96fa9d3eb8aac5266b05288e2..4c9af737b33aa203c50079467107f4a4b70d7b47 100644 (file)
@@ -216,8 +216,8 @@ static const struct of_device_id atmel_sha204a_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, atmel_sha204a_dt_ids);
 
 static const struct i2c_device_id atmel_sha204a_id[] = {
-       { "atsha204", (kernel_ulong_t)&atsha204_quality },
-       { "atsha204a" },
+       { .name = "atsha204", .driver_data = (kernel_ulong_t)&atsha204_quality },
+       { .name = "atsha204a", .driver_data = (kernel_ulong_t)NULL },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, atmel_sha204a_id);