diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2014-02-28 09:59:19 +0100 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2014-03-11 09:25:12 +0100 |
commit | e9feac058cf85795c2f55d1a977ee4fb9fa2f833 (patch) | |
tree | 68a5d3fcbc1ed3f6b55643b8adbb38ba66e57c96 /include/usbg | |
parent | 7310bf251a8b83ee71c912a88d0e7b9a64ea1a78 (diff) | |
download | libusbg-e9feac058cf85795c2f55d1a977ee4fb9fa2f833.tar.gz libusbg-e9feac058cf85795c2f55d1a977ee4fb9fa2f833.tar.bz2 libusbg-e9feac058cf85795c2f55d1a977ee4fb9fa2f833.zip |
libusbg: Add return value to usb function related functions.
Each usbg_set_*() may fail so it should have a return value
to notify user about reason of failure.
To be consistent with rest of API usbg_create_function()
should also return error code to notify user about reasons
of failure instead of binary information (NULL or not).
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Diffstat (limited to 'include/usbg')
-rw-r--r-- | include/usbg/usbg.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h index 17084bb..005f9eb 100644 --- a/include/usbg/usbg.h +++ b/include/usbg/usbg.h @@ -435,10 +435,12 @@ extern int usbg_set_gadget_product(usbg_gadget *g, int lang, char *prd); * @param type Type of function * @param instance Function instance name * @param f_attrs Function attributes to be set. If NULL setting is omitted. - * @return Pointer to function or NULL if it cannot be created + * @param f Pointer to be filled with pointer to function + * @note Given strings are assumed to be in US English + * @return 0 on success usbg_error if error occurred */ -extern usbg_function *usbg_create_function(usbg_gadget *g, usbg_function_type type, - char *instance, usbg_function_attrs *f_attrs); +extern int usbg_create_function(usbg_gadget *g, usbg_function_type type, + char *instance, usbg_function_attrs *f_attrs, usbg_function **f); /** * @brief Get function name length @@ -640,29 +642,33 @@ extern usbg_function_attrs *usbg_get_function_attrs(usbg_function *f, * @brief Set attributes of given function * @param f Pointer to function * @param f_attrs Attributes to be set + * @return 0 on success, usbg_error if error occurred */ -extern void usbg_set_function_attrs(usbg_function *f, usbg_function_attrs *f_attrs); +extern int usbg_set_function_attrs(usbg_function *f, usbg_function_attrs *f_attrs); /** * @brief Set USB function network device address * @param f Pointer to function * @param addr Pointer to Ethernet address + * @return 0 on success, usbg_error if error occurred */ -extern void usbg_set_net_dev_addr(usbg_function *f, struct ether_addr *addr); +extern int usbg_set_net_dev_addr(usbg_function *f, struct ether_addr *addr); /** * @brief Set USB function network host address * @param f Pointer to function * @param addr Pointer to Ethernet address + * @return 0 on success, usbg_error if error occurred */ -extern void usbg_set_net_host_addr(usbg_function *f, struct ether_addr *addr); +extern int usbg_set_net_host_addr(usbg_function *f, struct ether_addr *addr); /** * @brief Set USB function network qmult * @param f Pointer to function * @param qmult Queue length multiplier + * @return 0 on success, usbg_error if error occurred */ -extern void usbg_set_net_qmult(usbg_function *f, int qmult); +extern int usbg_set_net_qmult(usbg_function *f, int qmult); /** * @def usbg_for_each_gadget(g, s) |