Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp627090rdb; Tue, 16 Jan 2024 10:35:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8uicx/kPXyYHmaIDXSC0rXyAion4mZKZYQ1RMjL9+ZGR2HYq/cI1P5KxiOBPQY2gVYl4t X-Received: by 2002:a17:902:b692:b0:1d4:638f:3ff6 with SMTP id c18-20020a170902b69200b001d4638f3ff6mr8083383pls.66.1705430129843; Tue, 16 Jan 2024 10:35:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705430129; cv=pass; d=google.com; s=arc-20160816; b=k7IXzsQMv9Tw9oZQZvVeF41oVcTmGfsbBWAh/TqtbdmFvnPuatb4s5hhjJxQMjcOYz 6v6M5nBOCF0atdQScH8gaW+IqWHOqGqHG4gDqUdBd6Jmqpb1DueJ2yW5mkjag2vHxcvB Z1mVQ7v1e8REQ4J2hnv+NMg1LrjiW2Six/VZI7vEEBuaWZk1wMB3xQxHwZz7dXZDp7SC 2TzLadLRh6eFtwXuOafrHAFAJnceY/TouvPfmB48eZ7lIGdgl+GFRSraYVWGR6RjG1RQ QqNdI6GOHTtxU82EB053v2eMu0uwj0GoLj8TfJ4vvU72GZ5vYXs56fu+3aG8/h2YxK47 8Vbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=wp5WPET3bVqzGMsl5saniHHrHy4T7/FoqJGEcedTjzE=; fh=1cBP4yUsWtFxDFPHZM+aS+EvY4rM/X0cEdaF6xFumok=; b=nodj1JwUhqooa/psvn79LVi3flPQpOO1kPnWnt8lszYGbW9puTWQcALXbNSb7XadO0 5l3gJUkDyWHnaCZ3wiQ1ZMfgc7MTsCBHYq8h1zpNAa5sbx1Ubq7I8Hby/nnZMyzGYg1m ELGJi0fCsG8gV06yF+3E5i2W2ab2us5vRuZepZWNLJf8yJ7rgvJIeW6qrlXQNSEuUtYj uFsFiPOXjobG4ciPBWGMpdy/Nlb29RMdAes3xqEIP1y2mhAie+eqQcwuU9SkpKM4N0VZ 0bmZthuom5hEUe+vNmMyv+3uTxidZ/UFLTxpxlbkdIovaUqu3r1eaZhGbxILF4aCjeaW l/XQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iKtlOPFq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-27701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z6-20020a1709028f8600b001d5b9356020si6933634plo.440.2024.01.16.10.35.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:35:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iKtlOPFq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-27701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 836372859F7 for ; Tue, 16 Jan 2024 18:35:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77D3C1CD38; Tue, 16 Jan 2024 18:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iKtlOPFq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EE9513FE5; Tue, 16 Jan 2024 18:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705430118; cv=none; b=lfMypQDfvaxK/CXiPd0Tscc1oBtIAZXTWFNieoyckyT8tplwI9J3Qva6m8chSK1hEtsVj/voiQvkRSDi1ybdfERZe+cTVq2Lt59phoCxhvRvP+XA6wLRbUElY4OKTJnAZAqYp5E7drL3ViuuOKKzCNlCfcrqLdXwMII05RfYBU4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705430118; c=relaxed/simple; bh=MnY2gVubEGri9ggkfjnpG/sTnNx4BdvXPjR2PSZ83GE=; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=ZEFieGH8UrS6A4ocYAORHs6VGGa78yKFqQCJ66q/03mfreZKRw23ai/G2bOJA6aX0TljSK2ggB2Q7u/86B4n3FcYLXL8KBRREbCwUsF4vDPEqgVvC10cC4rL/nDvVSHg6kYLDUYv6R+zsusS9j0JyrqBLoe+LR5woi266lQA2DY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iKtlOPFq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4A09C433C7; Tue, 16 Jan 2024 18:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705430118; bh=MnY2gVubEGri9ggkfjnpG/sTnNx4BdvXPjR2PSZ83GE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=iKtlOPFqFaAmH1K/7wOYsOyKeMSUCGDMwgk42s0cLKwHQqKxXxyXfCYNB29supvRu lxMM/8gNABx8D8EG1w2Kw6Cn64lBlbWD4PBfKqihB3SXSNxOOazlhcv58mZDz1SrPc whI157N2nOgTtOzEIgp332p44e+vjwsXduG5IANcIivFsg79jF77pVzcvclKrhhbNN jUQDLi1u+uwWAFjw4ddjRpN2/7hIzFpFmrzbU0Yl5PNucgdthNjRiBUp1xQ5aa/daj jUU13N7bJwOO8S4VBFEHMTKci0a4DM4GNNmvw0tRFb6cU/AZyMPuW4JnSy/As8ofsP LV9qr1N44b3ZQ== Date: Tue, 16 Jan 2024 12:35:16 -0600 From: Bjorn Helgaas To: Philipp Stanner Cc: Jonathan Corbet , Hans de Goede , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Bjorn Helgaas , Sam Ravnborg , dakr@redhat.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org Subject: Re: [PATCH 07/10] pci: devres: give mwi its own callback Message-ID: <20240116183516.GA101535@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240115144655.32046-9-pstanner@redhat.com> On Mon, Jan 15, 2024 at 03:46:18PM +0100, Philipp Stanner wrote: > managing mwi with devres can easily be done with its own callback, > without the necessity to store any state about it in a device-related > struct. s/managing/Managing/ s/mwi/MWI/ since this is an initialism. Also in subject (but would be even better if it could mention an actual function name). > Remove the mwi state from the devres-struct. > Make the devres-mwi functions set a separate devres-callback. Wrap to fill 75 columns (or add blank lines if you intend multiple paragraphs). s/devres-struct/struct pci_devres/ to make this greppable. s/the devres-mwi functions/pcim_set_mwi()/ similarly. > Signed-off-by: Philipp Stanner > --- > drivers/pci/devres.c | 23 +++++++++++------------ > drivers/pci/pci.h | 1 - > 2 files changed, 11 insertions(+), 13 deletions(-) > > diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c > index de8cf6f87dd7..911c2037d9fd 100644 > --- a/drivers/pci/devres.c > +++ b/drivers/pci/devres.c > @@ -378,24 +378,26 @@ void __iomem *devm_pci_remap_cfg_resource(struct device *dev, > } > EXPORT_SYMBOL(devm_pci_remap_cfg_resource); > > +static void __pcim_clear_mwi(void *pdev_raw) > +{ > + struct pci_dev *pdev = pdev_raw; > + > + pci_clear_mwi(pdev); > +} > + > /** > * pcim_set_mwi - a device-managed pci_set_mwi() > - * @dev: the PCI device for which MWI is enabled > + * @pdev: the PCI device for which MWI is enabled > * > * Managed pci_set_mwi(). > * > * RETURNS: An appropriate -ERRNO error value on error, or zero for success. > */ > -int pcim_set_mwi(struct pci_dev *dev) > +int pcim_set_mwi(struct pci_dev *pdev) > { > - struct pci_devres *dr; > - > - dr = find_pci_dr(dev); > - if (!dr) > - return -ENOMEM; > + devm_add_action(&pdev->dev, __pcim_clear_mwi, pdev); > > - dr->mwi = 1; > - return pci_set_mwi(dev); > + return pci_set_mwi(pdev); > } > EXPORT_SYMBOL(pcim_set_mwi); > > @@ -405,9 +407,6 @@ static void pcim_release(struct device *gendev, void *res) > struct pci_dev *dev = to_pci_dev(gendev); > struct pci_devres *this = res; > > - if (this->mwi) > - pci_clear_mwi(dev); > - > if (this->restore_intx) > pci_intx(dev, this->orig_intx); > > diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h > index 3d9908a69ebf..667bfdd61d5e 100644 > --- a/drivers/pci/pci.h > +++ b/drivers/pci/pci.h > @@ -811,7 +811,6 @@ static inline pci_power_t mid_pci_get_power_state(struct pci_dev *pdev) > struct pci_devres { > unsigned int orig_intx:1; > unsigned int restore_intx:1; > - unsigned int mwi:1; > }; > > struct pci_devres *find_pci_dr(struct pci_dev *pdev); > -- > 2.43.0 >