mirror of git://git.sysmocom.de/ofono
isimodem: Adapt and refactor ssn driver
This commit is contained in:
parent
3942066eae
commit
d365237a65
|
@ -38,8 +38,7 @@
|
||||||
#include <ofono/ssn.h>
|
#include <ofono/ssn.h>
|
||||||
|
|
||||||
#include "isimodem.h"
|
#include "isimodem.h"
|
||||||
|
#include "ss.h"
|
||||||
#define PN_SS 0x06
|
|
||||||
|
|
||||||
struct ssn_data {
|
struct ssn_data {
|
||||||
GIsiClient *client;
|
GIsiClient *client;
|
||||||
|
@ -48,17 +47,20 @@ struct ssn_data {
|
||||||
static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
|
static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
|
||||||
void *user)
|
void *user)
|
||||||
{
|
{
|
||||||
GIsiModem *idx = user;
|
GIsiModem *modem = user;
|
||||||
struct ssn_data *data = g_try_new0(struct ssn_data, 1);
|
struct ssn_data *sd;
|
||||||
|
|
||||||
if (data == NULL)
|
sd = g_try_new0(struct ssn_data, 1);
|
||||||
|
if (sd == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
data->client = g_isi_client_create(idx, PN_SS);
|
sd->client = g_isi_client_create(modem, PN_SS);
|
||||||
if (data->client == NULL)
|
if (sd->client == NULL) {
|
||||||
|
g_free(sd);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
ofono_ssn_set_data(ssn, data);
|
ofono_ssn_set_data(ssn, sd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -67,10 +69,11 @@ static void isi_ssn_remove(struct ofono_ssn *ssn)
|
||||||
{
|
{
|
||||||
struct ssn_data *data = ofono_ssn_get_data(ssn);
|
struct ssn_data *data = ofono_ssn_get_data(ssn);
|
||||||
|
|
||||||
|
ofono_ssn_set_data(ssn, NULL);
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ofono_ssn_set_data(ssn, NULL);
|
|
||||||
g_isi_client_destroy(data->client);
|
g_isi_client_destroy(data->client);
|
||||||
g_free(data);
|
g_free(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue