Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5954600iog; Thu, 23 Jun 2022 08:27:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJ7PIWG/kZxz+2xvKaT2c3kZHIVvISnJZyHPKf6LqTIRZCN5lR25N6f5bb3Hw2YnPJ/IyZ X-Received: by 2002:a63:7c53:0:b0:40c:f729:9fe9 with SMTP id l19-20020a637c53000000b0040cf7299fe9mr8041550pgn.317.1655998074832; Thu, 23 Jun 2022 08:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655998074; cv=none; d=google.com; s=arc-20160816; b=g2Ia/DYhm8C2FvO6InMAtnzNMAI9/hVVmV66531GPCztXiHMK2vDOcnvWHo9Cz1L7E Lr29X6/AE6AEikCq8VZpKtMx2OhZHFgf8AECMu+IyezQkzUPenaTJc76+VYHAuBs9oof 0Agl9wtNnJXbmzdB89pJaRTjXuIYBy2yiknjl9eN6CnC8phgd5NiW2bNvpopX5vmWSNe yFkPlrXvPns208bolNSTCfXKyy5Q+wPWDx2MQ0Ixwe1sK057HnKvgN0WZrejnIosxkKz yW0qjASYMjpiIHe0Wn4Oui4IBgD3pr4Unov1zrs0R17qKnPCGzcAuGWORlFKeqNHedS5 KZqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6U0Fj2UlG+L0EX02i4VI5AVsJCA8HPDBFFpF0w8Ck4A=; b=BPPhwqBXNfDjV1Uh10RKoXIyUNKc/fXxKuOmkIGfp4dQuIw208aqu3jUKd+4JJD2Nv xtievu4WXP4wwmrjmIX9sbjEbqDdIaokg70Ewvx2BrONcWMlp6wieMbGlfdb0UFVhNOS lsNxGF9MRHPwYROXezP6RPFcSHRpLLEUy2R8Jer91gmTYCUM73H2mA31frRK6qf6xbCt GTLPak6smPf8YCr60TFcmMDPIE++IGSWSSw7UBakxCZiBjboht09Qg5LI3jfs78hiN5L 8EUhSJ2JyAwJ0dCz6stRmBKJF0tsanI05NDsqd3CYglIR1uAfFA/qE4XacqjoWottQnB DgSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hCU8lBo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170902e14400b0016223c6e629si22066137pla.235.2022.06.23.08.27.43; Thu, 23 Jun 2022 08:27:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hCU8lBo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbiFWO4S (ORCPT + 99 others); Thu, 23 Jun 2022 10:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbiFWO4Q (ORCPT ); Thu, 23 Jun 2022 10:56:16 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34229B5E for ; Thu, 23 Jun 2022 07:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655996175; x=1687532175; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=AT8JAPkS8YJRYuTDNqpAngPAp17BB/bvcfqew+27oho=; b=hCU8lBo6Ey0rGXwn8k1+doy3x/VvmX0AnQ8J3iceaOJV+4vYGuoNIhBE h910P+mCd5RHzq/taTBJNhnVD3RAtRZdiVjH64CN8YjgkcEJIOSZsL2Hm nqdbIbb7fsbCuloDxjiZ4yFf7iyIo5G0xfarHqWP1i2YnxmHfD9drBRCI yUNiU8hGBnyc4ehqbzxJkPzhI/F7qWjYop1L9RF4OryH5NJQuG/zFMplV WkkiTOnxYVgTnEsnz9tWcxzryJzs0sTIDEfiYsve2aQSAuigmoO+yjZHH NGkK8l4K1WPf0xHHEpi8/hZ7PSRQSFF2u8SmP3nGjiwCnuyL1q8kncGlw A==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="281817793" X-IronPort-AV: E=Sophos;i="5.92,216,1650956400"; d="scan'208";a="281817793" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 07:55:54 -0700 X-IronPort-AV: E=Sophos;i="5.92,216,1650956400"; d="scan'208";a="691055713" Received: from rames2-mobl.amr.corp.intel.com (HELO [10.213.181.118]) ([10.213.181.118]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 07:55:53 -0700 Message-ID: Date: Thu, 23 Jun 2022 09:54:36 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.9.1 Subject: Re: [PATCH] soundwire: bus_type: fix remove and shutdown support Content-Language: en-US To: Vinod Koul , Bard Liao Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, srinivas.kandagatla@linaro.org, sanyog.r.kale@intel.com, bard.liao@intel.com References: <20220610015105.25987-1-yung-chuan.liao@linux.intel.com> From: Pierre-Louis Bossart In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/23/22 02:55, Vinod Koul wrote: > On 10-06-22, 09:51, Bard Liao wrote: >> From: Pierre-Louis Bossart >> >> The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used >> conditionally, if the driver provides these routines. >> >> These helpers already test if the driver provides a .remove or >> .shutdown callback, so there's no harm in invoking the >> sdw_drv_remove() and sdw_drv_shutdown() unconditionally. > > Okay sounds good > >> In addition, the current code is imbalanced with >> dev_pm_domain_attach() called from sdw_drv_probe(), but >> dev_pm_domain_detach() called from sdw_drv_remove() only if the driver >> provides a .remove callback. > > Am not sure I follow what is imbalance, pm_domain_attach/detach? Yes, the dev_pm_domain_detach() is done conditionally, depending on the presence of a driver .remove callback, that's not so good. >> Fixes: 9251345dca24b ("soundwire: Add SoundWire bus type") > > How is this a fix is still unclear to me. At best I think this is code > optimization and removing checks which maybe redundant. I think the Fixes tag is appropriate for the dev_pm_domain_detach() problem, but if you want to drop it that's fine with me. >> Signed-off-by: Pierre-Louis Bossart >> Reviewed-by: Rander Wang >> Signed-off-by: Bard Liao >> --- >> drivers/soundwire/bus_type.c | 8 ++------ >> 1 file changed, 2 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c >> index 893296f3fe39..b81e04dd3a9f 100644 >> --- a/drivers/soundwire/bus_type.c >> +++ b/drivers/soundwire/bus_type.c >> @@ -193,12 +193,8 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner) >> >> drv->driver.owner = owner; >> drv->driver.probe = sdw_drv_probe; >> - >> - if (drv->remove) >> - drv->driver.remove = sdw_drv_remove; >> - >> - if (drv->shutdown) >> - drv->driver.shutdown = sdw_drv_shutdown; >> + drv->driver.remove = sdw_drv_remove; >> + drv->driver.shutdown = sdw_drv_shutdown; >> >> return driver_register(&drv->driver); >> } >> -- >> 2.17.1 >