Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp871700lqj; Mon, 3 Jun 2024 03:36:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVT/9my0hvVoEGOE9lVKk7Sp26YxAjq+qoElsEyvvtglSeCfWRfD4ohoJFCNy9k5ITYKmUUJpH2Q1SOaPSyEE+jKv0xhrQbik1y/ZlZFw== X-Google-Smtp-Source: AGHT+IHGzDAYsJSSZIC9MQnLcwmt6nX4kImuzCHeUazYsGPBr4XMkMCbqjAIqbowdq9qyL3Cdd5Y X-Received: by 2002:a50:9b1b:0:b0:579:c471:dbd0 with SMTP id 4fb4d7f45d1cf-57a363c94d9mr5524686a12.21.1717411009218; Mon, 03 Jun 2024 03:36:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717411009; cv=pass; d=google.com; s=arc-20160816; b=PR2E+urgipCQMGJ9JAFZ737xGTtyeOxe66bg6+2T+JOgzG9e/cwXPDFwxRpwN43UkX JuykSyjxFzQKu1pYa0YOFN56+XnssJv11UH7EVRTy8N0rO8DpKGHJ8KZn6Z90CltYHVc kd//d0Crab3dIhxmvgEmPxU/1we/IqB0fVb1AyuvXnA75CbX4z0JVbzQXSdC3aSP7lbh LY6i5fCTbrRcBsXf7MH3MjkI0o/1n0kj1qsmXlbt3V3ck9q8xOz66tPU+gBuOZ3eMnDH JlQuXo30jOTv1fZLa8kLMWqCw4kMh7T34IBikw5hdsJiEXM5ECHckQJxzRSb6K651l1r d/RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HzZ9klruY/Ztssobbt7j7Ac2UZsl8E8kYKbpCSTaTdA=; fh=EelKNb4C4N/Kh+Qnxp5AWU4KZJWkttCqVVez9a39kjc=; b=rvmqtH+0HUuKcsCEnd+eQscvc/N1QZcoo/Tha5ST9LCrWuKtLvcphSv2ztmQNeBK0l kc3mpyI1rk/gqPuyEhig5aRk1JC9Ubugd5XaM49hn8FXUt7/iHmBO57XZUheJfNxJAV5 Br9gGg0pgejl5nE8KPpO2QTHoNatHSkirqmJRJPIdDELEmpjWr1o9SKYTQVWWimNODe7 9gGli3c09YmEJLYQab+HniEpy9mZO8nBX7fZF1di+r0bw875cnVaU+MSvAb3enVQA0sc QLAktY1ViDXTY2ZqCgn8Q8VmfaNLj9qJKOwIJfc9J24Csltl26kk9l0CGqPm26NG8Mmz etdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b="KoaRP/Ar"; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-198986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c92cc0si3985880a12.478.2024.06.03.03.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 03:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b="KoaRP/Ar"; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-198986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C2BAF1F24097 for ; Mon, 3 Jun 2024 10:36:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1902C84E16; Mon, 3 Jun 2024 10:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="KoaRP/Ar" Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73AAE83CD9; Mon, 3 Jun 2024 10:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717410951; cv=none; b=DEcYVI9g3tFfD3GbcETzsZenpwSnG/8zswtcVQzdEDY0M9a/OrOpMGbvcxsr/1UUlT0WNMrm8PbiwDLJApp86aYKawXQ/4GMb2QDEuwANNALW90qX8AjXDGqvrhdrxmfdNL389eo0urUFlTxfRNheltieJ3VQqHcfLxAbK8q3kw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717410951; c=relaxed/simple; bh=oUtizzgKM4/3Y9KkrNWL/XebKvCrh4DHO7Gq6YBmIoQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NDjfZPOiENuc4CpCEcQYX/OPQbWNIkGK5VkWB3GdQ3V4hDhuGFxPtMzTTxFOFsqjkfVNYST4Fe+WmjjTroNA54GuEeZQpzHDAKDao/0IbYkUlitYOZrDr+jEjiVnwJlrNPQPe8WbQmSRkwwedsQqNigYebcVzLIeZ58mIyl37jA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=KoaRP/Ar; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4535l7pe018316; Mon, 3 Jun 2024 05:35:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=HzZ9klruY/Ztssobbt7j7Ac2UZsl8E8kYKbpCSTaTdA=; b= KoaRP/Arn34eI38X4XNrs23UxtjOxXaXqHhTstt979gLF5BYDetUofnr9UBgBJU0 4qZW5XwFDaMOAi40QnaFDZgH5bzT4GJl+GguM3p/IZlToVGmIS9WujDoBpv8NqZz 42Cd0G/yP7bqNJoM2pMspW4jfRPyQXI+YZy3NJVF15M0wJJzjCa6RGWha4BBNhgb vXzXjyfC6+LN+dc/JOtXQazvO5p27qH6zSapadA5ienWao8Z70tLrRe6i1ZAYByf H+HPwgwnc1PEn6DO2yUxxXIkcnAztQ6bzK/T3dXO4caW+OAWInbfJzznNGjVgK5v 2kubmP9aKnE7+APngHNCGQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3yg11xscbq-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 05:35:33 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 3 Jun 2024 11:35:28 +0100 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1544.9 via Frontend Transport; Mon, 3 Jun 2024 11:35:28 +0100 Received: from EDIN6ZZ2FY3.ad.cirrus.com (EDIN6ZZ2FY3.ad.cirrus.com [198.61.64.166]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 8205E820249; Mon, 3 Jun 2024 10:35:28 +0000 (UTC) From: Simon Trimmer To: CC: , , , , , , , , , Simon Trimmer Subject: [PATCH 6/7] ALSA: hda: hda_component: Move codec field into the parent Date: Mon, 3 Jun 2024 11:35:23 +0100 Message-ID: <20240603103524.32442-7-simont@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603103524.32442-1-simont@opensource.cirrus.com> References: <20240603103524.32442-1-simont@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: znmTngXIww7_pS2_kFgRvYih2P0oyzUO X-Proofpoint-ORIG-GUID: znmTngXIww7_pS2_kFgRvYih2P0oyzUO X-Proofpoint-Spam-Reason: safe There is one codec shared across all of the bound HDA components and a copy is usually stashed in the amp driver so it doesn't need to be in every hda_component. Signed-off-by: Simon Trimmer --- sound/pci/hda/cs35l41_hda.c | 7 ++++--- sound/pci/hda/cs35l56_hda.c | 2 +- sound/pci/hda/hda_component.c | 5 +---- sound/pci/hda/hda_component.h | 2 +- sound/pci/hda/tas2781_hda_i2c.c | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index ceba4f2c85f1..ee9f83b737de 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -1436,10 +1436,11 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas mutex_lock(&cs35l41->fw_mutex); comp->dev = dev; + cs35l41->codec = parent->codec; if (!cs35l41->acpi_subsystem_id) cs35l41->acpi_subsystem_id = kasprintf(GFP_KERNEL, "%.8x", - comp->codec->core.subsystem_id); - cs35l41->codec = comp->codec; + cs35l41->codec->core.subsystem_id); + strscpy(comp->name, dev_name(dev), sizeof(comp->name)); cs35l41->firmware_type = HDA_CS_DSP_FW_SPK_PROT; @@ -1470,7 +1471,7 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas mutex_unlock(&cs35l41->fw_mutex); sleep_flags = lock_system_sleep(); - if (!device_link_add(&comp->codec->core.dev, cs35l41->dev, DL_FLAG_STATELESS)) + if (!device_link_add(&cs35l41->codec->core.dev, cs35l41->dev, DL_FLAG_STATELESS)) dev_warn(dev, "Unable to create device link\n"); unlock_system_sleep(sleep_flags); diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c index df4498c77171..cc4aa90db1d1 100644 --- a/sound/pci/hda/cs35l56_hda.c +++ b/sound/pci/hda/cs35l56_hda.c @@ -697,7 +697,7 @@ static int cs35l56_hda_bind(struct device *dev, struct device *master, void *mas return -EBUSY; comp->dev = dev; - cs35l56->codec = comp->codec; + cs35l56->codec = parent->codec; strscpy(comp->name, dev_name(dev), sizeof(comp->name)); comp->playback_hook = cs35l56_hda_playback_hook; diff --git a/sound/pci/hda/hda_component.c b/sound/pci/hda/hda_component.c index 8c11c8b37799..1a9950b76866 100644 --- a/sound/pci/hda/hda_component.c +++ b/sound/pci/hda/hda_component.c @@ -134,12 +134,9 @@ static int hda_comp_match_dev_name(struct device *dev, void *data) int hda_component_manager_bind(struct hda_codec *cdc, struct hda_component_parent *parent) { - int i; - /* Init shared and component specific data */ memset(parent, 0, sizeof(*parent)); - for (i = 0; i < ARRAY_SIZE(parent->comps); i++) - parent->comps[i].codec = cdc; + parent->codec = cdc; return component_bind_all(hda_codec_dev(cdc), parent); } diff --git a/sound/pci/hda/hda_component.h b/sound/pci/hda/hda_component.h index e547e1f1e674..dd4dabeae9ee 100644 --- a/sound/pci/hda/hda_component.h +++ b/sound/pci/hda/hda_component.h @@ -19,7 +19,6 @@ struct hda_component { struct device *dev; char name[HDA_MAX_NAME_SIZE]; - struct hda_codec *codec; struct acpi_device *adev; bool acpi_notifications_supported; void (*acpi_notify)(acpi_handle handle, u32 event, struct device *dev); @@ -29,6 +28,7 @@ struct hda_component { }; struct hda_component_parent { + struct hda_codec *codec; struct hda_component comps[HDA_MAX_COMPONENTS]; }; diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index c6c1e8e81972..d7af4fd10714 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -719,7 +719,7 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, if (comp->dev) return -EBUSY; - codec = comp->codec; + codec = parent->codec; subid = codec->core.subsystem_id >> 16; switch (subid) { -- 2.34.1