I'm writing a linux kernel module, and trying to use astyle to help me follow the coding standard. It seems to be formatting a spi_driver
structure incorrectly and I'm wondering if anyone knows why. This is the code before passing to astyle (with the command astyle --style=linux lightmod.c
):
static struct spi_driver light_driver = {
.driver = {
.name = "light",
.owner = THIS_MODULE,
},
.probe = light_probe,
.remove = __devexit_p(light_remove),
};
And this is the output:
static struct spi_driver light_driver = {
.driver = {
.name = "light",
.owner = THIS_MODULE,
},
.probe = light_probe,
.remove = __devexit_p(light_remove),
};
Why is it indenting .remove
this way? Does anyone know?
I don't think that there is a deep reason for this. Astyle simply seems not be able to handle C99's designated initializers correctly. If you use oldstyle initializers it formats them fine.