Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2322739imu; Thu, 24 Jan 2019 10:43:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN7fmeLSOI9X4m1HM1yjYlm/tkyZQtMjKw3m2j7uAmuFsopoawrG+/ImHLQHR2QETMw0j693 X-Received: by 2002:a17:902:9045:: with SMTP id w5mr7392813plz.32.1548355424860; Thu, 24 Jan 2019 10:43:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548355424; cv=none; d=google.com; s=arc-20160816; b=lr5Epnjsx/tYwIw5xsWe0OJGVh0lfs/8MqT2gynCxZX2scEGSMyjv81SSa56wg9MRR 8wZj1d0o7FePw+YRABpit52S8sT3d8Km5hyySpnTeRY86R2EAJPHPj7IIt4fQo8/Seg5 nz/VB5XefJnFmP9/ZxvUg0ppmLpspJ6UXHQ64izXLK28vLN6X3jueqmu3IwLZG6jfAA8 SDy1l5G+QLgNcod9Yr3eYAJsqJsUBCAKIIeYFfPOYkYsljMDLajhuP0VUcQ72khqgBRw 4rQnNB7V+lpClEQS0EecJWJidQ/595o2kj1ryZ/PlkUqjr2EMUJDhVscLgEeqChtLwYs eo8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=dRqocTdC7Js275MuaxG4jRUaxboxQv/T20Pip4opG68=; b=sGjmpO/kCCmaRcBVsV+091bWDLRWRrxbp9hFDaYEr8xvM2pHsruT60fV29U5g+43tg P1MJU6+DKXbjnruDfb1ZfAreSRQlRvZXoGe8OMbbM1lYOGyLX+citrai43CuH+ydf/N5 0r0+yWCxElmfUjJemE7QQdK7+BiXm5FlbfdzDOTBvj1BsdfWB0pzA6YJj5UqKAKXGjEe 6X4rR9zMAYZpaayd0IR6ysLYO9WXzImqQkSSmPqhNESS892w3W9xguaoh+eF7aGq8kYs QEAmUrHst+Ay38WFkD7Vsa678g8XuaMAn405jR+mnNWeaZ5C7ct92rFccJF008NkxFXp CD0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12si22714039pgb.563.2019.01.24.10.43.29; Thu, 24 Jan 2019 10:43:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbfAXSnJ (ORCPT + 99 others); Thu, 24 Jan 2019 13:43:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:58962 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725936AbfAXSnJ (ORCPT ); Thu, 24 Jan 2019 13:43:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D88DCAE56; Thu, 24 Jan 2019 18:43:07 +0000 (UTC) Date: Thu, 24 Jan 2019 19:43:06 +0100 Message-ID: From: Takashi Iwai To: Sameer Pujar Cc: , , , Subject: Re: [PATCH] ALSA: hda: runtime PM is always active In-Reply-To: <770a8e0e-3e20-6997-3342-98a3656e14c1@nvidia.com> References: <1548345432-11449-1-git-send-email-spujar@nvidia.com> <770a8e0e-3e20-6997-3342-98a3656e14c1@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jan 2019 19:15:12 +0100, Sameer Pujar wrote: > > > On 1/24/2019 9:34 PM, Takashi Iwai wrote: > > On Thu, 24 Jan 2019 16:57:11 +0100, > > Sameer Pujar wrote: > >> The runtime PM count is incremented and set to active during hda codec > >> device init, but it is decremented and set to suspend during exit only. > >> Hence the runtime PM status is always active and hda device cannot be > >> put to runtime suspend. Keeping device usage active for entire period, > >> though nothing really happening on the device, seems unnecessary. > >> > >> This patch avoides incrementing runtime PM usage count of the device. > >> > >> Signed-off-by: Sameer Pujar > >> Reviewed-by: Ravindra Lokhande > >> Reviewed-by: Mohan Kumar D > > This breaks the existing things, I'm afraid. > > Did you really test and verify the behavior...? > > > > The runtime PM refcount is decremented at snd_hda_codec_register(), > > and that's the place to let runtime suspend of the codec really > > effective. (It's not about the controller, though.) > > > It worked fine at my end. I could put the device to runtime suspend > and resume it back multiple times. > Since you are suggesting it could break things, let me rework on the > patch and dig up a little more to > see if there is better way to fix this. Well, I don't see what you want to "fix". Do you see any bug? thanks, Takashi > > Thanks, > Sameer. > > > thanks, > > > > Takashi > > > > > >> --- > >> sound/hda/hdac_device.c | 6 ------ > >> 1 file changed, 6 deletions(-) > >> > >> diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c > >> index 95b073e..72aa342 100644 > >> --- a/sound/hda/hdac_device.c > >> +++ b/sound/hda/hdac_device.c > >> @@ -31,9 +31,6 @@ static void default_release(struct device *dev) > >> * > >> * Returns zero for success or a negative error code. > >> * > >> - * This function increments the runtime PM counter and marks it active. > >> - * The caller needs to turn it off appropriately later. > >> - * > >> * The caller needs to set the device's release op properly by itself. > >> */ > >> int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus, > >> @@ -55,8 +52,6 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus, > >> codec->bus = bus; > >> codec->addr = addr; > >> codec->type = HDA_DEV_CORE; > >> - pm_runtime_set_active(&codec->dev); > >> - pm_runtime_get_noresume(&codec->dev); > >> atomic_set(&codec->in_pm, 0); > >> err = snd_hdac_bus_add_device(bus, codec); > >> @@ -123,7 +118,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init); > >> */ > >> void snd_hdac_device_exit(struct hdac_device *codec) > >> { > >> - pm_runtime_put_noidle(&codec->dev); > >> snd_hdac_bus_remove_device(codec->bus, codec); > >> kfree(codec->vendor_name); > >> kfree(codec->chip_name); > >> -- > >> 2.7.4 > >> > >> >