From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DD1FEB64DA for ; Thu, 20 Jul 2023 14:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232177AbjGTOVk (ORCPT ); Thu, 20 Jul 2023 10:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbjGTOVh (ORCPT ); Thu, 20 Jul 2023 10:21:37 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A348D2137 for ; Thu, 20 Jul 2023 07:21:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6263422C6D; Thu, 20 Jul 2023 14:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689862895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3GQaBlG3C2XqFtdty5BDZEIOWAvouaxyDbtfsHm8S8Y=; b=vs8NpfUPAFAiOeU6XWCwxNJK+Wr8WjJ24qHqGnFqwJn9BGCLZAF12iYd/8siaEO21kR++E B37rPN2L7DTo9yEI8dp2YCwG+4YuL/5yI5h/TZFI3v3FnUr/VfYEkJVHanxL65ZTAK8X28 JMSTRI9HG+FSYVyI92HEpeHjjzoLy9w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689862895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3GQaBlG3C2XqFtdty5BDZEIOWAvouaxyDbtfsHm8S8Y=; b=YY5NZ9mhapfUHGJKAYR9Tqx9iUCLqR6TiFgw2XERatjTO9X2Z+H4jkmrSkS4GhL2gPGTo4 rw6R7if9BaoKObBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 32FEC138EC; Thu, 20 Jul 2023 14:21:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4QydC+9CuWQYcAAAMHmgww (envelope-from ); Thu, 20 Jul 2023 14:21:35 +0000 Date: Thu, 20 Jul 2023 16:21:34 +0200 Message-ID: <87v8eeiryp.wl-tiwai@suse.de> From: Takashi Iwai To: Stefan Binding Cc: Mark Brown , Jaroslav Kysela , Takashi Iwai , , , Subject: Re: [PATCH v1 10/11] ALSA: hda: cs35l41: Add device_link between HDA and cs35l41_hda In-Reply-To: <20230720133147.1294337-11-sbinding@opensource.cirrus.com> References: <20230720133147.1294337-1-sbinding@opensource.cirrus.com> <20230720133147.1294337-11-sbinding@opensource.cirrus.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Jul 2023 15:31:46 +0200, Stefan Binding wrote: > > To ensure consistency between the HDA core and the CS35L41 HDA > driver, add a device_link between them. This ensures that the > HDA core will suspend first, and resume second, meaning the > amp driver will not miss any events from the playback hook from > the HDA core during system suspend and resume. > > Signed-off-by: Stefan Binding > --- > sound/pci/hda/cs35l41_hda.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c > index 70aa819cfbd64..175378cdf9dfa 100644 > --- a/sound/pci/hda/cs35l41_hda.c > +++ b/sound/pci/hda/cs35l41_hda.c > @@ -1063,6 +1063,7 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas > { > struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); > struct hda_component *comps = master_data; > + unsigned int sleep_flags; > int ret = 0; > > if (!comps || cs35l41->index < 0 || cs35l41->index >= HDA_MAX_COMPONENTS) > @@ -1102,6 +1103,11 @@ 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(&comps->codec->core.dev, cs35l41->dev, DL_FLAG_STATELESS)) > + dev_warn(dev, "Unable to create device link\n"); > + unlock_system_sleep(sleep_flags); Is lock_system_sleep() mandatory for device_link_add()? The function takes its rw lock for the race, I suppose. thanks, Takashi