From nobody Sun Jun 14 01:35:34 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 590B93A2574 for ; Mon, 4 May 2026 17:13:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777914834; cv=none; b=KsSa66ulbiB606gNgxxXMFrFRmnyl0iJJ5HwGBzo8o37mFlytfwcuQCKG3MIze6y02AGSXR14bm2KJ5J47M8elRt2+tH17RMh5teJhGYuujKES8y6jlpWG2mlvQvFF+jl1Ydor5Wmf2XOgNh2BlaY2vAexckr/zPxAiE2nq23nM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777914834; c=relaxed/simple; bh=j8i04D00ioHsprik3B8EdTafBAqo3Lytp2sXnUpJRu4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=d7L9fcxRV+0h0oVidenMjZAZMy02Zj50ilRazv1qTHd2tBCu0hK3ZlHW0iQCWBcn7O//t2DloKxepDVwZBkhwhF8RdaqBnIIdoNxPOiF/+as+0TYAC4HOrtuyabCpiStsw9foHkF8tL5DEtWpeb/p8rpLdj19z6E9yhtIWMcaZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fu4g/Z5K; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fu4g/Z5K" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4891f625344so46106405e9.0 for ; Mon, 04 May 2026 10:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777914832; x=1778519632; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YVyX/l6EVBhcYm4HveFR/2Y6ddEwga1Q1M3z5qjkJEA=; b=fu4g/Z5KbWPQEX8lebHk7IjBPHAeSUP8lpczK6cPudVW1QIze+oxhVgApusfJYpz+H fPhE3Lk/mzs9GlwLnEtw4MPYCE13Gx4USndbm0LSs+gQQfuObvJHSZrRt8gh/vncJJO0 +h3c+aZ4CZnCMgN0a3SzvObWQitcBN2rfdp4oHVgryJ+o9OO53x++/PWPCwdkopbvDy4 Pl9nkh9eyIcoI+JoE0APL0GgGZnueDfUMsWWIFR0Rzeql8e4Rs5ZwiLH3SNA6cQqa2TW LCXZ8LGYhJGl2UsemFWigmTnVf4mwH/HnZeL4RfV2kr3Z7yBQ1xWB4g7dqLyZWvDs1D/ kbFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777914832; x=1778519632; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YVyX/l6EVBhcYm4HveFR/2Y6ddEwga1Q1M3z5qjkJEA=; b=NLY342AWU2Npbkv53k1ruR6DuCE2ICAvcj9zZ1uRieEH8az2NlwCmjkiCnAMyDI55v jj/fxNSsFvbQ+btzD7TCOz0AfpPfq8je/0NSS2eOwoI4YTFDQo2usz9t7I0R8pTnaKqS EKCzWd6WlptiIbde5SPdtZRNgCMmaAkPnDk9LZVi5jzJwPMpxGTgphBWLDgtMYGKPNnJ 6AHmTPXL0AB4hnE4GpRxC9VAY2+ZE09TbZWNsv2VfrsRKomGBXjZuiyl1INICh63lcXK klg7v7Y160NBq5FJIUXIdLAg39AoY1Th5NnJjTzxzded3Fka6cUDST8aB3PLnOLGx05C eMYw== X-Forwarded-Encrypted: i=1; AFNElJ/OSd1lY10phQGMsqcdMH7BPDw2s48oCbfuKucUVyuw5PX/vlc7YoKdbR3TyF+47XWc/lKaLKbBGe7mjzc=@vger.kernel.org X-Gm-Message-State: AOJu0YygzyDyso651ylkw+heY/EPi5MRJYAiIJTBADDUDytXGFqp5e0t PCI0AWUvt16XRpiHR8RoVrcXqVNPNQSEtLnJaEulZ8ezmX9cl8iWX/2A X-Gm-Gg: AeBDievVD4mPA9K+Zac+Axq65qpgiUmPf/mYkce8I5Eeb/sbJyWb2ypeBKHdLTTmWSx mbv2OD1vqmVczu7kP3fwdCXWL47Bu5EfEqY4y+Z+EPFRCB5uRAE5wy7eyFswSuf6oC1DowMyHEt oFQAriCo79ohUWhHT6qrc4n5Lvg63FQByRucfroeNLyAaSKdWPMGKGz1Rx5ILx9NWHYBRd7suTF e56gcuodie2JStuvTjoiDwS0C0nZPvxPlC/jt+J8/cRawtA9TmAYeNV3HuV9sfsK/S4RJhqdIHg etaGyBNp/9nE7GwNL0nS7bhNHrg6xHVt2MPMqINfuTe0bofndLKM2R/tvJc3v3+zueziAZ4avGu IPqLeBFJu24lcj86WWd8iB17aqRi+2OqLyuvB3CJl18+J6ELKuwuUyWrW69py69QmAA9+BED1Qo QcwvJVV9dvyqYBdR3qL1k/FgGNQv7V+mbYYlijfEjWBNKlRlnwU8A89hcZFT7F803v476PVaxJ5 n7U4e3k X-Received: by 2002:a05:600c:4186:b0:48d:50a:6ef4 with SMTP id 5b1f17b1804b1-48d14260d69mr3945825e9.11.1777914831633; Mon, 04 May 2026 10:13:51 -0700 (PDT) Received: from localhost.localdomain ([105.39.209.175]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a81ed6bafsm603830925e9.2.2026.05.04.10.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2026 10:13:50 -0700 (PDT) From: Khaled Saleh To: Vaibhav Agarwal , Mark Greer , Johan Hovold , Alex Elder , Greg Kroah-Hartman Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, khaled.saleh.req@gmail.com Subject: [PATCH] staging: greybus: split gb_audio_gb_get_topology() Date: Mon, 4 May 2026 19:13:30 +0200 Message-Id: <20260504171330.83727-1-khaled.saleh.req@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Split gb_audio_gb_get_topology() into smaller helper functions to improve readability and maintainability. No functional change intended. Signed-off-by: Khaled Saleh --- drivers/staging/greybus/audio_gb.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/staging/greybus/audio_gb.c b/drivers/staging/greybus/a= udio_gb.c index 9d8994fdb41a..b5ead09532c8 100644 --- a/drivers/staging/greybus/audio_gb.c +++ b/drivers/staging/greybus/audio_gb.c @@ -8,13 +8,10 @@ #include #include "audio_codec.h" =20 -/* TODO: Split into separate calls */ -int gb_audio_gb_get_topology(struct gb_connection *connection, - struct gb_audio_topology **topology) +static int gb_audio_gb_get_topology_size(struct gb_connection *connection, + u16 *size) { struct gb_audio_get_topology_size_response size_resp; - struct gb_audio_topology *topo; - u16 size; int ret; =20 ret =3D gb_operation_sync(connection, GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE, @@ -22,10 +19,24 @@ int gb_audio_gb_get_topology(struct gb_connection *conn= ection, if (ret) return ret; =20 - size =3D le16_to_cpu(size_resp.size); - if (size < sizeof(*topo)) + *size =3D le16_to_cpu(size_resp.size); + if (*size < sizeof(struct gb_audio_topology)) return -ENODATA; =20 + return 0; +} + +int gb_audio_gb_get_topology(struct gb_connection *connection, + struct gb_audio_topology **topology) +{ + struct gb_audio_topology *topo; + u16 size; + int ret; + + ret =3D gb_audio_gb_get_topology_size(connection, &size); + if (ret) + return ret; + topo =3D kzalloc(size, GFP_KERNEL); if (!topo) return -ENOMEM; --=20 2.34.1