Hi Jonas,

Using an enumeration to name flags feels awkward.  I would #define these:

#define AUTH_F_USE_SGATH (1<<0)
#define AUTH_F_SWAP_CREDENTIALS (1<<1)
#define AUTH_F_ALWAYS_ALL_PARAMS (1<<2)

Actually we prefer enums for enumerations with multiple related values or ones that can be extended. It is fine to use a #define if you have a single random value, but if you have a series of related flags, just use an enum. This also forces one to keep naming consistent per item M11 of doc/coding-style.txt.

The compiler can also treat enums as first class citizens, making them available in the debugger, etc.


Abbreviating ALWAYS to ALW is awkward...

+1

+
+struct ofono_modem;

I think you might as well just pull in modem.h here.


This is bad advice. If the header file is only using a pointer to a structure, a forward declaration is enough. Including the entire modem.h file here would just be extra work for the preprocessor and compiler, nothing more. I prefer my compilation times to be fast ;)

+static int gemalto_lte_probe(struct ofono_lte *lte, unsigned int vendor,
+                                void *data)
+{
+    GAtChat *chat = data;
+    struct gemalto_lte_driver_data *ldd;
+
+    ldd = g_new0(struct gemalto_lte_driver_data, 1);
+
+    ldd->chat = g_at_chat_clone(chat);
+
+    ofono_lte_set_data(lte, ldd);
+
+    g_idle_add(gemalto_lte_delayed_register, lte);

Why do you need to delay the registration?

It is not allowed to call register from within the probe method. That is because register might trigger driver method calls, but until probe() returns the driver isn't set. Some atoms do not do this (yet) and you can get away with it, but it is bad practice in general.

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to