Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3512573rwa; Tue, 23 Aug 2022 06:05:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR48WWVxSlBstO5H3cATYTTPs0b0zGgxO9odlnFgVYPuAR9x2Fm9e9ajVLfFkZeNeOziRAXd X-Received: by 2002:a62:cdc2:0:b0:536:5c11:c342 with SMTP id o185-20020a62cdc2000000b005365c11c342mr14153461pfg.42.1661259908812; Tue, 23 Aug 2022 06:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661259908; cv=none; d=google.com; s=arc-20160816; b=XWsPz5/8VjLqOt6dhPt+4k8gQSjd/ho/q19w93uOwClh8L4EhoFdJVe7lHOR/a6rcJ yAN44gOjwVQ1RuFMcKckRYLCp3OgzC7NBO3w/a0zKYOaecwZeXKkWkvhocq1UcO4h1rT EG1q6qWPETfAahtpIQ/p5IFPSX59GWFVQReSZIynnuEj1T9l9MTel5mRvZRw/tIuj4Jr HFjtjfFPcz1G9rpFQ7XL6P3+412Th4xs0CtKtWApEuE8UwAMi7qP7BzaDKvnDbX3Wl7f p/PsniNVBYTnNvgJ9AVkxMxa7YQSypIRHNFyoXOLUXBwSJ4C/4vnUgy4G+NF+z+ec33b 28gg== 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=U77oYOYSnpoRxu9tunJX98eAO6KVvvsL5z23zScZhfI=; b=k3mAgt4o2hfY9LPPuaxs9P0uqBIFyivlrEbtXfVbhA24x4sVMDlppkg4RpvuuI88rx 3Xkms9ptRoa0WazjHARdGBkYai9Gy9dwYV0IKSuygIa8/ihjg7Z/bhELgcJC1ZNA2My9 +p2GQO8vR6e80KOdkDJdyVYHNk5J5mhJtW6yn1QBfBCvjlPVJYX+X1hPPxXrbBgkaklZ L6l9ibeNGusJadLEoFe+Q+pHiPqpqwXSwkRRQYClzrp8EITdCiy4SiPvQi1RHv+QFNYU oIq7+JZSy4/9/MiZ98G0/jJQZpa8KDbXaP21JOMZmMhmKQlKNFBo91YDb3S4aqdO/RiP gEkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fw98ut9h; 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 i15-20020a170902cf0f00b0016d19a07f40si14695173plg.55.2022.08.23.06.04.57; Tue, 23 Aug 2022 06:05:08 -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=fw98ut9h; 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 S1357864AbiHWLc2 (ORCPT + 99 others); Tue, 23 Aug 2022 07:32:28 -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-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 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, 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