As I was studying the code of the mxs-auart.c driver I noticed the following declaration:
enum mxs_auart_type {
    IMX23_AUART,
    IMX28_AUART,
    ASM9260_AUART,
};
and then later on:
static const struct platform_device_id mxs_auart_devtype[] = {
    { .name = "mxs-auart-imx23", .driver_data = IMX23_AUART },
    { .name = "mxs-auart-imx28", .driver_data = IMX28_AUART },
    { .name = "as-auart-asm9260", .driver_data = ASM9260_AUART },
    { /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, mxs_auart_devtype);
static const struct of_device_id mxs_auart_dt_ids[] = {
    {
        .compatible = "fsl,imx28-auart",
        .data = &mxs_auart_devtype[IMX28_AUART]
    }, {
        .compatible = "fsl,imx23-auart",
        .data = &mxs_auart_devtype[IMX23_AUART]
    }, {
        .compatible = "alphascale,asm9260-auart",
        .data = &mxs_auart_devtype[ASM9260_AUART]
    }, { /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);
The thing I don't understand about this is how can IMX28_AUART, for example, be used like .data = &mxs_auart_devtype[IMX28_AUART]. Don't we have to instanciate a variable beforehand to use the enum values by doing as an example enum mxs_auart_type value = IMX28_AUART?
I am aware that in enumerations in C, values are equal to integer starting by default at 0 but I can't help but feel confused about this.
Can anyone help me understand this a bit better? Thanks
 
     
    