linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shijie.huang@arm.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/arm-smmu: add a shortcut when the @dev_node is NULL
Date: Tue, 12 Jan 2016 10:15:05 +0800	[thread overview]
Message-ID: <1452564905-2662-1-git-send-email-shijie.huang@arm.com> (raw)

When a device is added to a bus, it will trigger the chain notifier hook,
such as iommu_bus_notifier. The find_smmu_for_device() can be called here.

In some cases, the @device_node can be NULL. For example, when the device
is one of the following:
    alarmtime, serial, rtc or snd_soc.

This patch adds a shortcut for the code when the @device_node is NULL.
In my juno-r1 board, the boot time can be faster by 0.004014s.

Signed-off-by: Huang Shijie <shijie.huang@arm.com>
---
 drivers/iommu/arm-smmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 59ee4b8..6724a46 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -506,6 +506,9 @@ static struct arm_smmu_device *find_smmu_for_device(struct device *dev)
 	struct arm_smmu_master *master = NULL;
 	struct device_node *dev_node = dev_get_dev_node(dev);
 
+	if (!dev_node)
+		return NULL;
+
 	spin_lock(&arm_smmu_devices_lock);
 	list_for_each_entry(smmu, &arm_smmu_devices, list) {
 		master = find_smmu_master(smmu, dev_node);
-- 
2.5.0

             reply	other threads:[~2016-01-12  2:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  2:15 Huang Shijie [this message]
2016-01-20 12:02 ` [PATCH] iommu/arm-smmu: add a shortcut when the @dev_node is NULL Joerg Roedel
2016-01-20 13:34   ` Huang Shijie
2016-01-20 14:46     ` Robin Murphy
2016-01-20 16:00       ` Jon Medhurst (Tixy)
2016-01-21  2:04       ` Huang Shijie

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=1452564905-2662-1-git-send-email-shijie.huang@arm.com \
    --to=shijie.huang@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).