From 1d86dbc6c847620bbd1a5f2e4787d743a561e4c1 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 1 Jun 2021 11:20:37 -0500 Subject: radio-settings: Do not use enum ofono_access_mode Originally the enum was only meant to signify a single radio access mode preference, but over time its meaning was overloaded to be a bitfield with multiple preferences. Switch away from using an enum value to using an unsigned int to make it clearer that the value is a bitfield. --- src/radio-settings.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/radio-settings.c b/src/radio-settings.c index 02bb90cd..a80e4c18 100644 --- a/src/radio-settings.c +++ b/src/radio-settings.c @@ -44,11 +44,11 @@ static GSList *g_drivers = NULL; struct ofono_radio_settings { DBusMessage *pending; int flags; - enum ofono_radio_access_mode mode; + unsigned int mode; enum ofono_radio_band_gsm band_gsm; enum ofono_radio_band_umts band_umts; ofono_bool_t fast_dormancy; - enum ofono_radio_access_mode pending_mode; + unsigned int pending_mode; enum ofono_radio_band_gsm pending_band_gsm; enum ofono_radio_band_umts pending_band_umts; ofono_bool_t fast_dormancy_pending; @@ -60,7 +60,7 @@ struct ofono_radio_settings { struct ofono_atom *atom; }; -static const char *radio_access_mode_to_string(enum ofono_radio_access_mode m) +static const char *radio_access_mode_to_string(unsigned int m) { switch (m) { case OFONO_RADIO_ACCESS_MODE_ANY: @@ -86,7 +86,7 @@ static const char *radio_access_mode_to_string(enum ofono_radio_access_mode m) } static gboolean radio_access_mode_from_string(const char *str, - enum ofono_radio_access_mode *mode) + unsigned int *mode) { if (g_str_equal(str, "any")) { @@ -379,7 +379,7 @@ static void radio_band_set_callback(const struct ofono_error *error, } static void radio_set_rat_mode(struct ofono_radio_settings *rs, - enum ofono_radio_access_mode mode) + unsigned int mode) { DBusConnection *conn = ofono_dbus_get_connection(); const char *path; @@ -528,8 +528,7 @@ static void radio_query_band(struct ofono_radio_settings *rs) } static void radio_rat_mode_query_callback(const struct ofono_error *error, - enum ofono_radio_access_mode mode, - void *data) + int mode, void *data) { struct ofono_radio_settings *rs = data; DBusMessage *reply; @@ -594,7 +593,7 @@ static DBusMessage *radio_set_property(DBusConnection *conn, DBusMessage *msg, if (g_strcmp0(property, "TechnologyPreference") == 0) { const char *value; - enum ofono_radio_access_mode mode; + unsigned int mode; if (rs->driver->set_rat_mode == NULL) return __ofono_error_not_implemented(msg); -- cgit v1.2.1