diff mbox series

[BlueZ,v3,1/4] profiles/gap: Some code cleanup

Message ID 20240510150938.1492169-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 1cb5708fe7cf840ed63f6e450c21fc9cb2ce5b4b
Headers show
Series [BlueZ,v3,1/4] profiles/gap: Some code cleanup | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:TYPO_SPELLING: 'unecessary' may be misspelled - perhaps 'unnecessary'? #91: Just removing unecessary function and code duplication. ^^^^^^^^^^ /github/workspace/src/src/13661723.patch total: 0 errors, 1 warnings, 89 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13661723.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz May 10, 2024, 3:09 p.m. UTC
From: "Felipe F. Tonello" <eu@felipetonello.com>

Just removing unecessary function and code duplication.
---
 profiles/gap/gas.c | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

Comments

patchwork-bot+bluetooth@kernel.org May 10, 2024, 4:50 p.m. UTC | #1
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 10 May 2024 11:09:35 -0400 you wrote:
> From: "Felipe F. Tonello" <eu@felipetonello.com>
> 
> Just removing unecessary function and code duplication.
> ---
>  profiles/gap/gas.c | 42 ++++++++++++++++++++----------------------
>  1 file changed, 20 insertions(+), 22 deletions(-)

Here is the summary with links:
  - [BlueZ,v3,1/4] profiles/gap: Some code cleanup
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1cb5708fe7cf
  - [BlueZ,v3,2/4] src/adapter: Added connection parameter load/store functions
    (no matching commit)
  - [BlueZ,v3,3/4] src/device: Added function to set connection parameters
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d391bf4cf320
  - [BlueZ,v3,4/4] profiles/gap: Added support for PPCP characteristic
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d6fe19bccba0

You are awesome, thank you!
bluez.test.bot@gmail.com May 10, 2024, 5:54 p.m. UTC | #2
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=852343

---Test result---

Test Summary:
CheckPatch                    FAIL      1.57 seconds
GitLint                       PASS      0.81 seconds
BuildEll                      PASS      24.18 seconds
BluezMake                     PASS      1646.05 seconds
MakeCheck                     PASS      13.67 seconds
MakeDistcheck                 PASS      173.75 seconds
CheckValgrind                 PASS      244.10 seconds
CheckSmatch                   PASS      346.75 seconds
bluezmakeextell               PASS      117.90 seconds
IncrementalBuild              PASS      6038.21 seconds
ScanBuild                     PASS      966.73 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v3,1/4] profiles/gap: Some code cleanup
WARNING:TYPO_SPELLING: 'unecessary' may be misspelled - perhaps 'unnecessary'?
#91: 
Just removing unecessary function and code duplication.
              ^^^^^^^^^^

/github/workspace/src/src/13661723.patch total: 0 errors, 1 warnings, 89 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13661723.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c
index 400818d67591..713b9aaf28f2 100644
--- a/profiles/gap/gas.c
+++ b/profiles/gap/gas.c
@@ -50,10 +50,18 @@  struct gas {
 	struct gatt_db_attribute *attr;
 };
 
+static void gas_reset(struct gas *gas)
+{
+	gas->attr = NULL;
+	gatt_db_unref(gas->db);
+	gas->db = NULL;
+	bt_gatt_client_unref(gas->client);
+	gas->client = NULL;
+}
+
 static void gas_free(struct gas *gas)
 {
-	gatt_db_unref(gas->db);
-	bt_gatt_client_unref(gas->client);
+	gas_reset(gas);
 	btd_device_unref(gas->device);
 	g_free(gas);
 }
@@ -152,7 +160,7 @@  static void handle_appearance(struct gas *gas, uint16_t value_handle)
 		DBG("Failed to send request to read appearance");
 }
 
-static bool uuid_cmp(uint16_t u16, const bt_uuid_t *uuid)
+static inline bool uuid_cmp(uint16_t u16, const bt_uuid_t *uuid)
 {
 	bt_uuid_t lhs;
 
@@ -188,11 +196,6 @@  static void handle_characteristic(struct gatt_db_attribute *attr,
 	}
 }
 
-static void handle_gap_service(struct gas *gas)
-{
-	gatt_db_service_foreach_char(gas->attr, handle_characteristic, gas);
-}
-
 static int gap_probe(struct btd_service *service)
 {
 	struct btd_device *device = btd_service_get_device(service);
@@ -246,16 +249,7 @@  static void foreach_gap_service(struct gatt_db_attribute *attr, void *user_data)
 	}
 
 	gas->attr = attr;
-	handle_gap_service(gas);
-}
-
-static void gas_reset(struct gas *gas)
-{
-	gas->attr = NULL;
-	gatt_db_unref(gas->db);
-	gas->db = NULL;
-	bt_gatt_client_unref(gas->client);
-	gas->client = NULL;
+	gatt_db_service_foreach_char(gas->attr, handle_characteristic, gas);
 }
 
 static int gap_accept(struct btd_service *service)
@@ -266,13 +260,15 @@  static int gap_accept(struct btd_service *service)
 	struct gas *gas = btd_service_get_user_data(service);
 	char addr[18];
 	bt_uuid_t gap_uuid;
+	int err = 0;
 
 	ba2str(device_get_address(device), addr);
 	DBG("GAP profile accept (%s)", addr);
 
 	if (!gas) {
 		error("GAP service not handled by profile");
-		return -1;
+		err = -1;
+		goto _finish;
 	}
 
 	gas->db = gatt_db_ref(db);
@@ -285,12 +281,14 @@  static int gap_accept(struct btd_service *service)
 	if (!gas->attr) {
 		error("GAP attribute not found");
 		gas_reset(gas);
-		return -1;
+		err = -1;
 	}
 
-	btd_service_connecting_complete(service, 0);
+_finish:
 
-	return 0;
+	btd_service_connecting_complete(service, err);
+
+	return err;
 }
 
 static int gap_disconnect(struct btd_service *service)