2

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?

Jeff Mercado
  • 129,526
  • 32
  • 251
  • 272
Woodrow Douglass
  • 2,605
  • 3
  • 25
  • 41

1 Answers1

1

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.

Jens Gustedt
  • 76,821
  • 6
  • 102
  • 177