From nobody Mon Jun 15 16:28:53 2026 Received: from mail-dl1-f67.google.com (mail-dl1-f67.google.com [74.125.82.67]) (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 EF5DA171CD for ; Sat, 11 Apr 2026 18:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775931680; cv=none; b=MiBsgv6U1KEoH/cpP3IBYhYVrL7iQUeGoaedq8pj7LDvDHWo6+w1DK++g3Ak3clxQblG9Nn0lvBvu1sj3u4LZHxri5zDFkUM9Sx84o3SL0qc9OGn//RBmk8+yWNqwxZPJJEsbwEbJKqPsPd0KGwixhutwMaVJdFalARYrh/f+RY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775931680; c=relaxed/simple; bh=A1iRjkm1KKZKizaqwpsevV1a/zeklVKSBq1nLSDjKJ0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=cqMn9eZT4K2D+AJuSMmSiS4KhPG9acZ9rWQftyvMDeMini9uqKFCfgy3Vg346o+O6KV5QgBgCq+MRxlATuww8jStOJ5mEKuWUvb/0TlfmrpqK1fFsO+zpWRYsyKmMTlFe0Z1Iw+kNZjoyjOfQSKHQ54Y72jHyV89vwBOiFoJi08= 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=O3t5fM9V; arc=none smtp.client-ip=74.125.82.67 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="O3t5fM9V" Received: by mail-dl1-f67.google.com with SMTP id a92af1059eb24-12c42a23c8eso440904c88.1 for ; Sat, 11 Apr 2026 11:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775931678; x=1776536478; 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=DqrPr1FaYRhKQEWInixscQtNUjWWsyNu8DLckOP7xwk=; b=O3t5fM9VJFA1N3rOvwZOw0/xks9EdOGp38kWUdkX6NG36EOsO8hrLrfhxaOY1PtTG0 lxmd4hJpxg52XGCZNlFACc+53K1/rPbOqzjV+P2BH+L/ORqG9sbiCqH0g382Nie6qEVX 7L28aR7El2rg4fLPRnUlRaJdtLgNXhlF0Ble+X/Te/lT+4kBbWtVmnmluxmwE8qr5XQu JJLZIH2ItPsMG0t5Gp03fEfWT4LoaDqfrnhHC8x7YicQWQV1qdoyU4QOeUNVzXgolwhA McA+FIks/weJD+sBQ5GEVSpq2L9/4Xiafg1UNJhFX9Eb8swgE/zXv3w5QluW9LIBIMyE 2z8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775931678; x=1776536478; 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=DqrPr1FaYRhKQEWInixscQtNUjWWsyNu8DLckOP7xwk=; b=D4gcSJeTk+oyN7O/N8nB3Jluzg2D306/s77jShANUNKWb0fzUX8zxmdHZwmPJHGw1F gPyGu7Oj6ycYYMTFeR+s2URJumnhJExs1o9ucMdNcpNHnUt7RpsWcODBVmCWwy4uWvyq 3jA7DT9bGVWmTa37JXNmlR8MUFxMtJ6Xtm716WFtveJLWc4GagvIdMgzxW+y55/Wrqp9 8IsAkBg2RlJMKKHKWH6RexTo4bAnlN04bIT4o/eMtOFdI0z+/b4+ZeNZ8l6MZeRh9Lse ZmQsHZ+FCj7FYfNwvJENf1Wmu9bJjCyOB4om4UHzfmI4iVcJvP82rPxoNdTZyrqDs0RT TbuQ== X-Forwarded-Encrypted: i=1; AJvYcCX0yDdNhTvZExzQ7kwzZv/jW9yA0NQPcijgwpy7H+kqxv9ikKOSHyrdCuzWKWVPNjL2NDp806ZaU+iU+c8=@vger.kernel.org X-Gm-Message-State: AOJu0YwHvfzKXLTKJny/WSmBUTmk+rpgehquwpoLpM1fPjAsPaWvrkSn 0t3+VtJtkr4HFy7bq5QDvMcrTNgonP5kM50Kv+ob/La2yQgzEXDFASk/6VGbjZNS X-Gm-Gg: AeBDiettiKO1Ohsxb1lNui3qfcYe4b+4WyAGZlF0Q8TX9UUeKMwc1yRb87Tq5hVVAbB ikAiJjQJ0WiRXY1VkS8Eoq4ns82CT/RB/nnwue/gHniYTBZXkybnqUDyqmw+2AQYfHvY4lXY5rV YcG0HoEq7QZfsmlg3vLR43QurbGFqRBPpmcJ7Myq5aWLAIGHPQSlQoHy1GwnA8JjimPVDarB3I0 dQiXvgdD6/Bp+miqIOipuKfCS4bQRxTGAJKdibxsEDmLHIif7XfCgx//ErfVlOodb4sKeL2MMVz CxeNBwDhAayK0SSllA94z/KgAAHTcsOwXUsa0cGpraw0OHwfxj3H1OnQSbETwFRQme+1sldZ5m4 2tTlT3CByd3trvtnAD0qiNqQm/fwbw+p2yWOaVxzrdKM/f592nFmIHzqvvRxFiZJb5ICAzzxgaR wqSMcdcxpwXz7QGFC7gtc0gTPyRq5kw6FrzLqkyGNw7d0zZJqVS6yi8lI= X-Received: by 2002:a05:7022:fd01:b0:12c:8b9:7200 with SMTP id a92af1059eb24-12c34eeca8amr4974556c88.17.1775931678009; Sat, 11 Apr 2026 11:21:18 -0700 (PDT) Received: from localhost.localdomain ([76.32.119.210]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2d562ac344csm9455531eec.25.2026.04.11.11.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Apr 2026 11:21:17 -0700 (PDT) From: Hungyu Lin To: Vaibhav Agarwal , Mark Greer Cc: Johan Hovold , Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Hungyu Lin Subject: [PATCH] greybus: audio: extract topology size retrieval into a helper Date: Sat, 11 Apr 2026 18:20:55 +0000 Message-Id: <20260411182055.24413-1-dennylin0707@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" The topology retrieval code currently mixes the size query with allocation and data fetch in a single function. Extract the size query into a helper to make the control flow clearer. No functional change. Signed-off-by: Hungyu Lin --- drivers/staging/greybus/audio_gb.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/audio_gb.c b/drivers/staging/greybus/a= udio_gb.c index 9d8994fdb41a..d95f8b7d4ce2 100644 --- a/drivers/staging/greybus/audio_gb.c +++ b/drivers/staging/greybus/audio_gb.c @@ -8,21 +8,33 @@ #include #include "audio_codec.h" =20 +static int gb_audio_gb_get_topology_size(struct gb_connection *connection, + u16 *size) +{ + struct gb_audio_get_topology_size_response size_resp; + int ret; + + ret =3D gb_operation_sync(connection, GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE, + NULL, 0, &size_resp, sizeof(size_resp)); + if (ret) + return ret; + + *size =3D le16_to_cpu(size_resp.size); + return 0; +} + /* TODO: Split into separate calls */ int gb_audio_gb_get_topology(struct gb_connection *connection, struct gb_audio_topology **topology) { - 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, - NULL, 0, &size_resp, sizeof(size_resp)); + ret =3D gb_audio_gb_get_topology_size(connection, &size); if (ret) return ret; =20 - size =3D le16_to_cpu(size_resp.size); if (size < sizeof(*topo)) return -ENODATA; =20 --=20 2.34.1