This driver doesn't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.
Signed-off-by: Uwe Kleine-König <redacted>
---
arch/powerpc/platforms/44x/ppc476.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
This driver doesn't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
Well, even if the member was used, a 0 init is useless because as soon
as you initialise one field of the struct, the compiler initialise
everything else with 0.
This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.
Signed-off-by: Uwe Kleine-König <redacted>
Hello,
On Wed, Aug 07, 2024 at 07:50:26AM +0200, Christophe Leroy wrote:
Le 04/08/2024 à 13:20, Uwe Kleine-König a écrit :
quoted
This driver doesn't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
Well, even if the member was used, a 0 init is useless because as soon as
you initialise one field of the struct, the compiler initialise everything
else with 0.
Yeah, there are different shades of "useless". I'd say that if the
driver_data member is used, e.g. like:
static const struct i2c_device_id avr_id[] = {
{
.name = "akebono-avr",
.driver_data = 0,
}, {
.name = "akebono-arduino",
.driver_data = 1,
}, {
}
};
the assignment to driver_data in the first entry is useless as it
doesn't make a difference for the compiler, but still has a benefit for
the human reader of the code. So I would keep that one.
From: Michael Ellerman <hidden> Date: 2024-08-12 12:23:25
On Sun, 04 Aug 2024 13:20:31 +0200, Uwe Kleine-König wrote:
This driver doesn't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.
[...]