[Replicant] [libsamsung-ipc][PATCH 2/3] devices: data_create/data_destroy handlers: pass the ipc_client struct

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri Feb 28 23:01:09 UTC 2020


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>
---
 samsung-ipc/devices/aries/aries.c       | 6 ++++--
 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                       | 6 ++++--
 samsung-ipc/ipc.h                       | 8 ++++----
 10 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c
index 2e73b86..694831b 100644
--- a/samsung-ipc/devices/aries/aries.c
+++ b/samsung-ipc/devices/aries/aries.c
@@ -755,7 +755,8 @@ int aries_power_off(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int aries_data_create(void **transport_data,
+int aries_data_create(__attribute__((unused)) struct ipc_client *client,
+                      void **transport_data,
                       __attribute__((unused)) void **power_data,
                       __attribute__((unused)) void **gprs_data)
 {
@@ -767,7 +768,8 @@ int aries_data_create(void **transport_data,
     return 0;
 }
 
-int aries_data_destroy(void *transport_data,
+int aries_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                       void *transport_data,
                        __attribute__((unused)) void *power_data,
                        __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c
index 97a6ac3..8f89d0b 100644
--- a/samsung-ipc/devices/crespo/crespo.c
+++ b/samsung-ipc/devices/crespo/crespo.c
@@ -505,7 +505,8 @@ int crespo_power_off(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int crespo_data_create(void **transport_data,
+int crespo_data_create(__attribute__((unused)) struct ipc_client *client,
+                       void **transport_data,
                        __attribute__((unused)) void **power_data,
                        __attribute__((unused)) void **gprs_data)
 {
@@ -517,7 +518,8 @@ int crespo_data_create(void **transport_data,
     return 0;
 }
 
-int crespo_data_destroy(void *transport_data,
+int crespo_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                        void *transport_data,
                         __attribute__((unused)) void *power_data,
                         __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index 78101e4..4f7783f 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -356,7 +356,8 @@ int galaxys2_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int galaxys2_data_create(void **transport_data,
+int galaxys2_data_create(__attribute__((unused)) struct ipc_client *client,
+                         void **transport_data,
                          __attribute__((unused)) void **power_data,
                          __attribute__((unused)) void **gprs_data)
 {
@@ -368,7 +369,8 @@ int galaxys2_data_create(void **transport_data,
     return 0;
 }
 
-int galaxys2_data_destroy(void *transport_data,
+int galaxys2_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                          void *transport_data,
                           __attribute__((unused)) void *power_data,
                           __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index 50f758d..cb14f38 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -349,7 +349,8 @@ int i9300_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int i9300_data_create(void **transport_data,
+int i9300_data_create(__attribute__((unused)) struct ipc_client *client,
+                      void **transport_data,
                       __attribute__((unused)) void **power_data,
                       __attribute__((unused)) void **gprs_data)
 {
@@ -361,7 +362,8 @@ int i9300_data_create(void **transport_data,
     return 0;
 }
 
-int i9300_data_destroy(void *transport_data,
+int i9300_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                       void *transport_data,
                        __attribute__((unused)) void *power_data,
                        __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c
index 2ccda66..3207c8b 100644
--- a/samsung-ipc/devices/maguro/maguro.c
+++ b/samsung-ipc/devices/maguro/maguro.c
@@ -333,7 +333,8 @@ int maguro_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int maguro_data_create(void **transport_data,
+int maguro_data_create(__attribute__((unused)) struct ipc_client *client,
+                       void **transport_data,
                        __attribute__((unused)) void **power_data,
                        __attribute__((unused)) void **gprs_data)
 {
@@ -345,7 +346,8 @@ int maguro_data_create(void **transport_data,
     return 0;
 }
 
-int maguro_data_destroy(void *transport_data,
+int maguro_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                        void *transport_data,
                         __attribute__((unused)) void *power_data,
                         __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index ea5e9be..0e48668 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -350,7 +350,8 @@ int n5100_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int n5100_data_create(void **transport_data,
+int n5100_data_create(__attribute__((unused)) struct ipc_client *client,
+                      void **transport_data,
                       __attribute__((unused)) void **power_data,
                       __attribute__((unused)) void **gprs_data)
 {
@@ -362,7 +363,8 @@ int n5100_data_create(void **transport_data,
     return 0;
 }
 
-int n5100_data_destroy(void *transport_data,
+int n5100_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                       void *transport_data,
                        __attribute__((unused)) void *power_data,
                        __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index 4fd800f..384a863 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -349,7 +349,8 @@ int n7100_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int n7100_data_create(void **transport_data,
+int n7100_data_create(__attribute__((unused)) struct ipc_client *client,
+                      void **transport_data,
                       __attribute__((unused)) void **power_data,
                       __attribute__((unused)) void **gprs_data)
 {
@@ -361,7 +362,8 @@ int n7100_data_create(void **transport_data,
     return 0;
 }
 
-int n7100_data_destroy(void *transport_data,
+int n7100_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                       void *transport_data,
                        __attribute__((unused)) void *power_data,
                        __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c
index 8f52216..e1c85fa 100644
--- a/samsung-ipc/devices/piranha/piranha.c
+++ b/samsung-ipc/devices/piranha/piranha.c
@@ -298,7 +298,8 @@ int piranha_gprs_deactivate(__attribute__((unused)) struct ipc_client *client,
     return 0;
 }
 
-int piranha_data_create(void **transport_data,
+int piranha_data_create(__attribute__((unused)) struct ipc_client *client,
+                        void **transport_data,
                         __attribute__((unused)) void **power_data,
                         __attribute__((unused)) void **gprs_data)
 {
@@ -310,7 +311,8 @@ int piranha_data_create(void **transport_data,
     return 0;
 }
 
-int piranha_data_destroy(void *transport_data,
+int piranha_data_destroy(__attribute__((unused)) struct ipc_client *client,
+                         void *transport_data,
                          __attribute__((unused)) void *power_data,
                          __attribute__((unused)) void *gprs_data)
 {
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index 4359e45..74756fc 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -477,7 +477,8 @@ int ipc_client_data_create(struct ipc_client *client)
       return -1;
     }
 
-    return client->handlers->data_create(&client->handlers->transport_data,
+    return client->handlers->data_create(client,
+                                         &client->handlers->transport_data,
                                          &client->handlers->power_data,
                                          &client->handlers->power_data);
 }
@@ -489,7 +490,8 @@ int ipc_client_data_destroy(struct ipc_client *client)
         return -1;
     }
 
-    return client->handlers->data_destroy(client->handlers->transport_data,
+    return client->handlers->data_destroy(client,
+                                          client->handlers->transport_data,
                                           client->handlers->power_data,
                                           client->handlers->power_data);
 }
diff --git a/samsung-ipc/ipc.h b/samsung-ipc/ipc.h
index e6ca664..c238428 100644
--- a/samsung-ipc/ipc.h
+++ b/samsung-ipc/ipc.h
@@ -65,10 +65,10 @@ struct ipc_client_handlers {
     void *gprs_data;
 
     /* Data */
-    int (*data_create)(void **transport_data, void **power_data,
-                       void **gprs_data);
-    int (*data_destroy)(void *transport_data, void *power_data,
-                        void *gprs_data);
+    int (*data_create)(struct ipc_client *client, void **transport_data,
+                       void **power_data, void **gprs_data);
+    int (*data_destroy)(struct ipc_client *client, void *transport_data,
+                        void *power_data, void *gprs_data);
 };
 
 struct ipc_client_gprs_specs {
-- 
2.25.1



More information about the Replicant mailing list