From nobody Fri Sep 5 20:03:52 2025 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 2F86CC32774 for ; Tue, 23 Aug 2022 11:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244127AbiHWLc3 (ORCPT ); Tue, 23 Aug 2022 07:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243315AbiHWLY5 (ORCPT ); Tue, 23 Aug 2022 07:24:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42353876B6; Tue, 23 Aug 2022 02:23:58 -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 BE70D612F4; Tue, 23 Aug 2022 09:23:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0F7EC4314A; Tue, 23 Aug 2022 09:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246637; bh=hL/16M+dei/IXOjD5UfzwMn82C1KO1dHKyhbnjte2ME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fw98ut9huRWEUQwR1fVhwueHujHg1CniWvMaFQ6Z/tRKIqd4bmMt416MqE9kmxx7O 2QAtS1HWtoQ1r8Ye0SLQN9v5IKP1SAGksQJIumw2xZRyLz7HwnAkkcYnQtUZmza216 JJiH4NEG6neSI1XaFHbYLGB0WynRHFHXpbJ1AVOY= 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.4 173/389] soundwire: bus_type: fix remove and shutdown support Date: Tue, 23 Aug 2022 10:24:11 +0200 Message-Id: <20220823080122.860846311@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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@linu= x.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 4a465f55039f..2fe5a51918c8 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -155,12 +155,8 @@ int __sdw_register_driver(struct sdw_driver *drv, stru= ct module *owner) =20 drv->driver.owner =3D owner; drv->driver.probe =3D sdw_drv_probe; - - if (drv->remove) - drv->driver.remove =3D sdw_drv_remove; - - if (drv->shutdown) - drv->driver.shutdown =3D sdw_drv_shutdown; + drv->driver.remove =3D sdw_drv_remove; + drv->driver.shutdown =3D sdw_drv_shutdown; =20 return driver_register(&drv->driver); } --=20 2.35.1