[Replicant] [libsamsung-ipc][PATCH 1/3] devices: gprs activate/deactivate handlers: pass the ipc_client struct

Fil Lupin fillupin at protonmail.com
Wed Mar 18 16:39:43 UTC 2020


Seems Ok for me by reading.

- Fil Lupin.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, February 28, 2020 11:01 PM, Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org> wrote:

> This enables to use logging inside the callbacks.
>
> At this point the ipc_client struct is already available,
> so it is safe to do that.
>
> Signed-off-by: Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
>
> configure.ac | 2 +-
> include/samsung-ipc.h | 4 ++--
> samsung-ipc/devices/aries/aries.c | 8 ++++----
> samsung-ipc/devices/crespo/crespo.c | 6 ++++--
> samsung-ipc/devices/galaxys2/galaxys2.c | 6 ++++--
> samsung-ipc/devices/i9300/i9300.c | 6 ++++--
> samsung-ipc/devices/maguro/maguro.c | 6 ++++--
> samsung-ipc/devices/n5100/n5100.c | 6 ++++--
> samsung-ipc/devices/n7100/n7100.c | 6 ++++--
> samsung-ipc/devices/piranha/piranha.c | 6 ++++--
> samsung-ipc/ipc.c | 12 ++++++++----
> samsung-ipc/ipc.h | 6 ++++--
> 12 files changed, 47 insertions(+), 27 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 2dd8c6e..805438d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,4 +1,4 @@
> -AC_INIT([libsamsung-ipc], [0.5.0], [contact at replicant.us], [libsamsung-ipc])
> +AC_INIT([libsamsung-ipc], [0.6.0], [contact at replicant.us], [libsamsung-ipc])
> AC_CONFIG_SRCDIR([Makefile.am])
> AC_CONFIG_HEADERS(config.h)
> AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
> diff --git a/include/samsung-ipc.h b/include/samsung-ipc.h
> index cc48994..80fbe5f 100644
> --- a/include/samsung-ipc.h
> +++ b/include/samsung-ipc.h
> @@ -81,8 +81,8 @@ int ipc_client_power_handlers_register(struct ipc_client *client,
> int (*power_off)(struct ipc_client *client, void *power_data),
> void *power_data);
> int ipc_client_gprs_handlers_register(struct ipc_client *client,
>
> -   int (*gprs_activate)(void *gprs_data, unsigned int cid),
> -   int (*gprs_deactivate)(void *gprs_data, unsigned int cid), void *gprs_data);
>
> -   int (*gprs_activate)(struct ipc_client *client, void *gprs_data, unsigned int cid),
> -   int (*gprs_deactivate)(struct ipc_client *client, void *gprs_data, unsigned int cid), void *gprs_data);
>
>     void ipc_client_log(struct ipc_client *client, const char *message, ...);
>     int ipc_client_log_callback_register(struct ipc_client *client,
>     diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c
>     index 3e5f681..2e73b86 100644
>     --- a/samsung-ipc/devices/aries/aries.c
>     +++ b/samsung-ipc/devices/aries/aries.c
>     @@ -779,8 +779,8 @@ int aries_data_destroy(void *transport_data,
>     return 0;
>     }
>
>     -int aries_gprs_activate(attribute((unused)) void *data,
>
>
> -                          unsigned int cid)
>
>
>
> +int aries_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                          __attribute__((unused)) void *data, unsigned int cid)
>
>
>
> {
> int rc;
>
> @@ -791,8 +791,8 @@ int aries_gprs_activate(attribute((unused)) void *data,
> return 0;
> }
>
> -int aries_gprs_deactivate(attribute((unused)) void *data,
>
> -                            unsigned int cid)
>
>
>
> +int aries_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                            __attribute__((unused)) void *data, unsigned int cid)
>
>
>
> {
> int rc;
>
> diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c
> index 89bf67b..97a6ac3 100644
> --- a/samsung-ipc/devices/crespo/crespo.c
> +++ b/samsung-ipc/devices/crespo/crespo.c
> @@ -529,13 +529,15 @@ int crespo_data_destroy(void *transport_data,
> return 0;
> }
>
> -int crespo_gprs_activate(attribute((unused)) void *data,
> +int crespo_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                           __attribute__((unused)) void *data,
>                             __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int crespo_gprs_deactivate(attribute((unused)) void *data,
> +int crespo_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                             __attribute__((unused)) void *data,
>                               __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
> index 3529cf5..78101e4 100644
> --- a/samsung-ipc/devices/galaxys2/galaxys2.c
> +++ b/samsung-ipc/devices/galaxys2/galaxys2.c
> @@ -342,13 +342,15 @@ int galaxys2_power_off(attribute((unused)) struct ipc_client *client,
> return 0;
> }
>
> -int galaxys2_gprs_activate(attribute((unused)) void *data,
> +int galaxys2_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                             __attribute__((unused)) void *data,
>                               __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int galaxys2_gprs_deactivate(attribute((unused)) void *data,
> +int galaxys2_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                               __attribute__((unused)) void *data,
>                                 __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
> index ba1481b..50f758d 100644
> --- a/samsung-ipc/devices/i9300/i9300.c
> +++ b/samsung-ipc/devices/i9300/i9300.c
> @@ -335,13 +335,15 @@ int i9300_power_off(attribute((unused)) struct ipc_client *client,
> return 0;
> }
>
> -int i9300_gprs_activate(attribute((unused)) void *data,
> +int i9300_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                          __attribute__((unused)) void *data,
>                            __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int i9300_gprs_deactivate(attribute((unused)) void *data,
> +int i9300_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                            __attribute__((unused)) void *data,
>                              __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c
> index 7b4c6be..2ccda66 100644
> --- a/samsung-ipc/devices/maguro/maguro.c
> +++ b/samsung-ipc/devices/maguro/maguro.c
> @@ -319,13 +319,15 @@ int maguro_power_off(attribute((unused)) struct ipc_client *client,
> return 0;
> }
>
> -int maguro_gprs_activate(attribute((unused)) void *data,
> +int maguro_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                           __attribute__((unused)) void *data,
>                             __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int maguro_gprs_deactivate(attribute((unused)) void *data,
> +int maguro_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                             __attribute__((unused)) void *data,
>                               __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
> index 1120c99..ea5e9be 100644
> --- a/samsung-ipc/devices/n5100/n5100.c
> +++ b/samsung-ipc/devices/n5100/n5100.c
> @@ -336,13 +336,15 @@ int n5100_power_off(attribute((unused)) struct ipc_client *client,
> return 0;
> }
>
> -int n5100_gprs_activate(attribute((unused)) void *data,
> +int n5100_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                          __attribute__((unused)) void *data,
>                            __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int n5100_gprs_deactivate(attribute((unused)) void *data,
> +int n5100_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                            __attribute__((unused)) void *data,
>                              __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
> index c9c0919..4fd800f 100644
> --- a/samsung-ipc/devices/n7100/n7100.c
> +++ b/samsung-ipc/devices/n7100/n7100.c
> @@ -335,13 +335,15 @@ int n7100_power_off(attribute((unused)) struct ipc_client *client,
> return 0;
> }
>
> -int n7100_gprs_activate(attribute((unused)) void *data,
> +int n7100_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                          __attribute__((unused)) void *data,
>                            __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int n7100_gprs_deactivate(attribute((unused)) void *data,
> +int n7100_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                            __attribute__((unused)) void *data,
>                              __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c
> index 12f4e47..8f52216 100644
> --- a/samsung-ipc/devices/piranha/piranha.c
> +++ b/samsung-ipc/devices/piranha/piranha.c
> @@ -284,13 +284,15 @@ int piranha_power_off(attribute((unused)) struct ipc_client *client,
> return 0;
> }
>
> -int piranha_gprs_activate(attribute((unused)) void *data,
> +int piranha_gprs_activate(attribute((unused)) struct ipc_client *client,
>
> -                            __attribute__((unused)) void *data,
>                              __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> }
>
> -int piranha_gprs_deactivate(attribute((unused)) void *data,
> +int piranha_gprs_deactivate(attribute((unused)) struct ipc_client *client,
>
> -                              __attribute__((unused)) void *data,
>                                __attribute__((unused)) unsigned int cid)
>
>
>
> {
> return 0;
> diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
> index c52911b..4359e45 100644
> --- a/samsung-ipc/ipc.c
> +++ b/samsung-ipc/ipc.c
> @@ -303,8 +303,10 @@ int ipc_client_power_handlers_register(struct ipc_client *client,
> }
>
> int ipc_client_gprs_handlers_register(struct ipc_client *client,
>
> -   int (*gprs_activate)(void *gprs_data, unsigned int cid),
> -   int (*gprs_deactivate)(void *gprs_data, unsigned int cid), void *gprs_data)
>
> -   int (*gprs_activate)(struct ipc_client *client, void *gprs_data,
> -                           unsigned int cid),
>
>
> -   int (*gprs_deactivate)(struct ipc_client *client, void *gprs_data,
> -                             unsigned int cid), void *gprs_data)
>
>
>
> {
> if (client == NULL || client->handlers == NULL)
>
>          return -1;
>
>
> @@ -453,7 +455,8 @@ int ipc_client_gprs_activate(struct ipc_client *client, unsigned int cid)
> return -1;
> }
>
> -   return client->handlers->gprs_activate(client->handlers->gprs_data, cid);
>
> -   return client->handlers->gprs_activate(client, client->handlers->gprs_data,
>
> -                                             cid);
>
>
>
> }
>
> int ipc_client_gprs_deactivate(struct ipc_client *client, unsigned int cid)
> @@ -463,7 +466,8 @@ int ipc_client_gprs_deactivate(struct ipc_client *client, unsigned int cid)
> return -1;
> }
>
> -   return client->handlers->gprs_deactivate(client->handlers->gprs_data, cid);
>
> -   return client->handlers->gprs_deactivate(client,
>
> -                                               client->handlers->gprs_data, cid);
>
>
>
> }
>
> int ipc_client_data_create(struct ipc_client *client)
> diff --git a/samsung-ipc/ipc.h b/samsung-ipc/ipc.h
> index 7c7f314..e6ca664 100644
> --- a/samsung-ipc/ipc.h
> +++ b/samsung-ipc/ipc.h
> @@ -57,8 +57,10 @@ struct ipc_client_handlers {
> void power_data;
> / GPRS handlers */
>
> -   int (*gprs_activate)(void *gprs_data, unsigned int cid);
> -   int (*gprs_deactivate)(void *gprs_data, unsigned int cid);
>
> -   int (*gprs_activate)(struct ipc_client *client, void *gprs_data,
> -                           unsigned int cid);
>
>
> -   int (*gprs_deactivate)(struct ipc_client *client, void *gprs_data,
> -                             unsigned int cid);
>
>
>
> void *gprs_data;
>
> -------------------
>
> 2.25.1
>
> Replicant mailing list
> Replicant at osuosl.org
> https://lists.osuosl.org/mailman/listinfo/replicant




More information about the Replicant mailing list