aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/device
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2012-09-05 09:53:36 +0200
committerSimon Busch <morphis@gravedo.de>2012-09-09 12:23:21 +0200
commit3a9c878ca37442aca10917306fffb625c46b0ec4 (patch)
tree0d60e6b6ab27f6e8e7746b3b1abb6f7097f1dc59 /samsung-ipc/device
parentdb180081a182a2cd5652f9b1c147b974bae54811 (diff)
downloadexternal_libsamsung-ipc-3a9c878ca37442aca10917306fffb625c46b0ec4.zip
external_libsamsung-ipc-3a9c878ca37442aca10917306fffb625c46b0ec4.tar.gz
external_libsamsung-ipc-3a9c878ca37442aca10917306fffb625c46b0ec4.tar.bz2
ipc: refactor ipc_client_gprs_get_iface method to return iface name instead of using a parameter
Allocating memory and setting a pointer to it for the user via a parameter is kind of unnecessary. It's better to return the pointer instead.
Diffstat (limited to 'samsung-ipc/device')
-rw-r--r--samsung-ipc/device/aries/aries_ipc.c9
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.c6
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_ipc.c12
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_ipc.h2
4 files changed, 14 insertions, 15 deletions
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c
index 4860724..d987822 100644
--- a/samsung-ipc/device/aries/aries_ipc.c
+++ b/samsung-ipc/device/aries/aries_ipc.c
@@ -835,9 +835,10 @@ int aries_ipc_gprs_deactivate(void *data)
return 0;
}
-int aries_ipc_gprs_get_iface(char **iface, int cid)
+char* aries_ipc_gprs_get_iface(int cid)
{
struct ifreq ifr;
+ char *iface;
int fd;
int rc;
int i;
@@ -854,13 +855,11 @@ int aries_ipc_gprs_get_iface(char **iface, int cid)
continue;
} else {
asprintf(iface, "%s%d", GPRS_IFACE_PREFIX, i);
- return 0;
+ return iface;
}
}
- *iface = NULL;
-
- return -1;
+ return NULL;
}
int aries_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *cap)
diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c
index 33386d9..437c680 100644
--- a/samsung-ipc/device/crespo/crespo_ipc.c
+++ b/samsung-ipc/device/crespo/crespo_ipc.c
@@ -587,11 +587,11 @@ int crespo_ipc_power_off(void *io_data)
return 0;
}
-int crespo_ipc_gprs_get_iface(char **iface, int cid)
+char* crespo_ipc_gprs_get_iface(int cid)
{
+ char *iface;
asprintf(iface, "%s%d", GPRS_IFACE_PREFIX, 0);
-
- return 0;
+ return iface;
}
int crespo_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *cap)
diff --git a/samsung-ipc/device/xmm6260/xmm6260_ipc.c b/samsung-ipc/device/xmm6260/xmm6260_ipc.c
index ccc7a2c..f7fbcc9 100644
--- a/samsung-ipc/device/xmm6260/xmm6260_ipc.c
+++ b/samsung-ipc/device/xmm6260/xmm6260_ipc.c
@@ -344,16 +344,16 @@ int xmm6260_ipc_power_off(void *io_data)
return 0;
}
-int xmm6260_ipc_gprs_get_iface(char **iface, int cid)
+char* xmm6260_ipc_gprs_get_iface(int cid)
{
- if(cid > GPRS_IFACE_COUNT) {
- *iface = NULL;
- return -1;
- }
+ char *iface;
+
+ if(cid > GPRS_IFACE_COUNT)
+ return NULL;
asprintf(iface, "%s%d", GPRS_IFACE_PREFIX, cid - 1);
- return 0;
+ return iface;
}
int xmm6260_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *cap)
diff --git a/samsung-ipc/device/xmm6260/xmm6260_ipc.h b/samsung-ipc/device/xmm6260/xmm6260_ipc.h
index 58bd8a2..ac006d5 100644
--- a/samsung-ipc/device/xmm6260/xmm6260_ipc.h
+++ b/samsung-ipc/device/xmm6260/xmm6260_ipc.h
@@ -46,7 +46,7 @@ int xmm6260_ipc_read(void *data, unsigned int size, void *io_data);
int xmm6260_ipc_write(void *data, unsigned int size, void *io_data);
int xmm6260_ipc_power_on(void *io_data);
int xmm6260_ipc_power_off(void *io_data);
-int xmm6260_ipc_gprs_get_iface(char **iface, int cid);
+char* xmm6260_ipc_gprs_get_iface(int cid);
int xmm6260_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *cap);
void *xmm6260_ipc_common_data_create(void);
int xmm6260_ipc_common_data_destroy(void *io_data);