lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1355678760-27357-12-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
Date:	Sun, 16 Dec 2012 18:25:57 +0100
From:	Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
To:	Hideki EIRAKU <hdk@...l.co.jp>
Cc:	Paul Mundt <lethal@...ux-sh.org>,
	Magnus Damm <magnus.damm@...il.com>,
	Simon Horman <horms@...ge.net.au>, linux-sh@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Katsuya MATSUBARA <matsu@...l.co.jp>,
	Damian Hobson-Garcia <dhobsong@...l.co.jp>
Subject: [PATCH/WIP/RFC 11/14] shmobile-ipmmu: Store a struct shmobile_iommu_arch_data in archdata.iommu

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
---
 drivers/iommu/shmobile-iommu.c |   20 +++++++++++++++++---
 include/linux/sh_iommu.h       |   10 ++++++++--
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/shmobile-iommu.c b/drivers/iommu/shmobile-iommu.c
index 423993c..f27d842 100644
--- a/drivers/iommu/shmobile-iommu.c
+++ b/drivers/iommu/shmobile-iommu.c
@@ -308,25 +308,39 @@ static int shmobile_iommu_attach_all_devices(void)
 		ret = PTR_ERR(iommu_mapping);
 		goto err;
 	}
-	for (dev = ipmmu_devices; dev; dev = dev->archdata.iommu) {
+	for (dev = ipmmu_devices; dev; ) {
+		struct shmobile_iommu_arch_data *data = dev->archdata.iommu;
+
 		if (arm_iommu_attach_device(dev, iommu_mapping))
 			pr_err("arm_iommu_attach_device failed\n");
+
+		dev = data->next;
 	}
 err:
 	spin_unlock(&lock_add);
 	return 0;
 }
 
-void ipmmu_add_device(struct device *dev)
+int ipmmu_add_device(struct device *dev)
 {
+	struct shmobile_iommu_arch_data *data;
+
+	data = kzalloc(sizeof(*data), GFP_KERNEL);
+	if (data == NULL)
+		return -ENOMEM;
+
+	dev->archdata.iommu = data;
+
 	spin_lock(&lock_add);
-	dev->archdata.iommu = ipmmu_devices;
+	data->next = ipmmu_devices;
 	ipmmu_devices = dev;
 	if (!IS_ERR_OR_NULL(iommu_mapping)) {
 		if (arm_iommu_attach_device(dev, iommu_mapping))
 			pr_err("arm_iommu_attach_device failed\n");
 	}
 	spin_unlock(&lock_add);
+
+	return 0;
 }
 
 int ipmmu_iommu_init(struct shmobile_ipmmu *ipmmu)
diff --git a/include/linux/sh_iommu.h b/include/linux/sh_iommu.h
index cc669a0..8b7b51d 100644
--- a/include/linux/sh_iommu.h
+++ b/include/linux/sh_iommu.h
@@ -1,10 +1,16 @@
 #ifndef __SH_IOMMU_H__
 #define __SH_IOMMU_H__
 
+struct device;
+
+struct shmobile_iommu_arch_data {
+	struct device *next;
+};
+
 #ifdef CONFIG_SHMOBILE_IPMMU_TLB
-void ipmmu_add_device(struct device *dev);
+int ipmmu_add_device(struct device *dev);
 #else
-static inline void ipmmu_add_device(struct device *dev)
+static inline int ipmmu_add_device(struct device *dev)
 {
 }
 #endif
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ