Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3027691rwb; Mon, 15 Aug 2022 16:26:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR7BV7r1wsHEgqE/GkadNwLAu9Lv49rQsIOEkubYqnBJQazvvvxN1LkhK9Uc/gqDEDEqnZ82 X-Received: by 2002:a05:6402:540f:b0:440:d9a4:aebf with SMTP id ev15-20020a056402540f00b00440d9a4aebfmr16257287edb.196.1660605964206; Mon, 15 Aug 2022 16:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605964; cv=none; d=google.com; s=arc-20160816; b=hUF07lZRYQhEyWvUuHlfxJCVjGfOxrpjlHCU/NKkcBdYTOK8cLL/B54Kl8Nf/aqK/z aJJY+y86IA8Jt2YS3lgCo27tcu7vcLm8sEL8yfqBg9d6W5NGG+WG+TMG1KtQU6mFo62x zjWqbnX+WFGxDk3M7XXER5Ki+cWcOPFW5U9MFvK8nP6epA+SGvUpOFuZ0qbQi+5dtAg3 h0QPTBDVtdzFJ5n8wqfPUGz/RSLLSxFGvNThNiY+ZO0guUtNGV4OOtxhVB/fVTggqIDl 4mxNoTtQIQkOuG5kcG65ezxgPjFdTrhuS+K6TJJ/RxViC7ioNy33RznGSnCsZ+uJBPYZ B0Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IIN8wRImjDwR1NKhqTXL/MNUeNpjfw68mP49tg0JNk8=; b=Y8ghhgqqJZXR2Ekl1DJeYv+KsksGAjTxL/27UnsWWG31n1YgGf41eig7m520S9sDy6 X70hpKxs/fO6gLN/4945/xTpc/6r3C4S3m0C4niKYwZ56Wst1oWB2dD/g8RfffM1GBA4 7aRfbQ3UEFca7JT1B9WWM/Ms2fAyKe9SiPzZaaW6W6fEUtJdxhPTJ05Ne9rL0MerHuDe T2ZiJyAADKx5s8Ns6nMSZUpiPPHsf827W7xBe1Xu6bXuGjXqrP7p0pDcg5yorJ2W27aA 5x03kb+sFEG97SXR2MqSauTKCJJnu1O8GBgDoVowUHwqLR2ZcnaUfklLqlCeyKAPZSWo 4xuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PDLfeddT; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa41-20020a1709076d2900b00732eb37e3bdsi8465952ejc.884.2022.08.15.16.25.38; Mon, 15 Aug 2022 16:26:04 -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=@linuxfoundation.org header.s=korg header.b=PDLfeddT; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232198AbiHOWCY (ORCPT + 99 others); Mon, 15 Aug 2022 18:02:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344357AbiHOV7r (ORCPT ); Mon, 15 Aug 2022 17:59:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B72E24B; Mon, 15 Aug 2022 12:35:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36FAF610A5; Mon, 15 Aug 2022 19:34:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7BDC433C1; Mon, 15 Aug 2022 19:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592084; bh=yg6v+E6w4tYGmjS7g1TgMXBUqPL+Zz2rnmZLUdugTHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDLfeddTlAcMKRumkErsJ/AU6zrX22cQae0ybhABJXwxuLNs+omQ0e8SPHc0OvDVk Pa9rNk3BhS55GTN8px27FU4qYbTYLWSWYeF92IHFnz6lQBcq9FeoTTkBAmY6NQsFA1 EI2DaQr/bF5XbfhiN6fZDcmmDK7pKVn37RRoecv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0727/1095] soundwire: bus_type: fix remove and shutdown support Date: Mon, 15 Aug 2022 20:02:06 +0200 Message-Id: <20220815180459.449738445@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Pierre-Louis Bossart [ Upstream commit df6407782964dc7e35ad84230abb38f46314b245 ] 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. 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. Fixes: 9251345dca24b ("soundwire: Add SoundWire bus type") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20220610015105.25987-1-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- 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.35.1