From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] powerpc/powernv: Remove duplicate check in tce_iommu_bus_notifier()
Date: Mon, 11 Aug 2014 13:11:58 +1000 [thread overview]
Message-ID: <1407726718.4508.60.camel@pasglop> (raw)
In-Reply-To: <1407309017-13870-2-git-send-email-gwshan@linux.vnet.ibm.com>
On Wed, 2014-08-06 at 17:10 +1000, Gavin Shan wrote:
> The called function iommu_del_device() checks if the device has
> attached IOMMU group, we needn't check it again in the parent
> function call tce_iommu_bus_notifier().
The patch does more than that... it also refactors the function, which
it should either not do or document.
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
> arch/powerpc/platforms/powernv/pci.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index f91a4e5..b562b0d 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -820,17 +820,18 @@ static int tce_iommu_bus_notifier(struct notifier_block *nb,
> unsigned long action, void *data)
> {
> struct device *dev = data;
> + int ret = 0;
>
> switch (action) {
> case BUS_NOTIFY_ADD_DEVICE:
> - return iommu_add_device(dev);
> + ret = iommu_add_device(dev);
> + break;
> case BUS_NOTIFY_DEL_DEVICE:
> - if (dev->iommu_group)
> - iommu_del_device(dev);
> - return 0;
> - default:
> - return 0;
> + iommu_del_device(dev);
> + break;
> }
> +
> + return ret;
> }
>
> static struct notifier_block tce_iommu_bus_nb = {
next prev parent reply other threads:[~2014-08-11 3:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 7:10 [PATCH 1/2 v2] powerpc/powernv: Fix IOMMU group lost Gavin Shan
2014-08-06 7:10 ` [PATCH 2/2] powerpc/powernv: Remove duplicate check in tce_iommu_bus_notifier() Gavin Shan
2014-08-11 3:11 ` Benjamin Herrenschmidt [this message]
2014-08-11 9:14 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407726718.4508.60.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=gwshan@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).