diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c index 1c668b17..b7d83684 100644 --- a/drivers/atmodem/sim.c +++ b/drivers/atmodem/sim.c @@ -565,21 +565,21 @@ static const char *const at_clck_cpwd_fac[] = { [OFONO_SIM_PASSWORD_PHCORP_PIN] = "PC", }; -static void at_pin_enable(struct ofono_sim *sim, int passwd_type, int enable, - const char *passwd, - ofono_sim_lock_unlock_cb_t cb, void *data) +static void at_pin_enable(struct ofono_sim *sim, + enum ofono_sim_password_type passwd_type, + int enable, const char *passwd, + ofono_sim_lock_unlock_cb_t cb, void *data) { GAtChat *chat = ofono_sim_get_data(sim); struct cb_data *cbd = cb_data_new(cb, data); char buf[64]; int ret; - int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac); + unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac); if (!cbd) goto error; - if (passwd_type < 0 || passwd_type >= len || - !at_clck_cpwd_fac[passwd_type]) + if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type]) goto error; snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i,\"%s\"", diff --git a/include/sim.h b/include/sim.h index 3d618270..af2fd1eb 100644 --- a/include/sim.h +++ b/include/sim.h @@ -85,7 +85,8 @@ typedef void (*ofono_sim_file_read_cb_t)(int ok, typedef void (*ofono_sim_file_write_cb_t)(int ok, void *userdata); typedef void (*ofono_sim_passwd_cb_t)(const struct ofono_error *error, - int passwd_type, void *data); + enum ofono_sim_password_type type, + void *data); typedef void (*ofono_sim_lock_unlock_cb_t)(const struct ofono_error *error, void *data); @@ -127,8 +128,8 @@ struct ofono_sim_driver { enum ofono_sim_password_type type, const char *old, const char *new, ofono_sim_lock_unlock_cb_t cb, void *data); - void (*lock)(struct ofono_sim *sim, int passwd_type, int enable, - const char *passwd, + void (*lock)(struct ofono_sim *sim, enum ofono_sim_password_type type, + int enable, const char *passwd, ofono_sim_lock_unlock_cb_t cb, void *data); }; diff --git a/src/sim.c b/src/sim.c index 7338fe7b..8f244597 100644 --- a/src/sim.c +++ b/src/sim.c @@ -78,7 +78,7 @@ struct ofono_sim { GSList *service_numbers; gboolean sdn_ready; gboolean ready; - int pin_type; + enum ofono_sim_password_type pin_type; char **language_prefs; GQueue *simop_q; gint simop_source; @@ -569,7 +569,7 @@ static DBusMessage *sim_enter_pin(DBusConnection *conn, DBusMessage *msg, struct ofono_sim *sim = data; DBusMessageIter iter; const char *typestr; - int type; + enum ofono_sim_password_type type; const char *pin; if (!sim->driver->send_passwd) @@ -611,7 +611,7 @@ static DBusMessage *sim_reset_pin(DBusConnection *conn, DBusMessage *msg, struct ofono_sim *sim = data; DBusMessageIter iter; const char *typestr; - int type; + enum ofono_sim_password_type type; const char *puk; const char *pin; @@ -926,7 +926,8 @@ static void sim_retrieve_imsi(struct ofono_sim *sim) sim->driver->read_imsi(sim, sim_imsi_cb, sim); } -static void sim_pin_query_cb(const struct ofono_error *error, int pin_type, +static void sim_pin_query_cb(const struct ofono_error *error, + enum ofono_sim_password_type pin_type, void *data) { struct ofono_sim *sim = data;