Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288042
b: refs/heads/master
c: 891003a
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Feb 28, 2012
1 parent 7ee8591 commit 6dcdc8c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a365fbf354907430e6852f0c373b4b3eeff81ba3
refs/heads/master: 891003abb0db6bfffd61b76ad0ed39bb7c3db8e1
3 changes: 2 additions & 1 deletion trunk/arch/arm/mach-omap2/mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ static void __exit omap2_mbox_exit(void)
platform_driver_unregister(&omap2_mbox_driver);
}

module_init(omap2_mbox_init);
/* must be ready before omap3isp is probed */
subsys_initcall(omap2_mbox_init);
module_exit(omap2_mbox_exit);

MODULE_LICENSE("GPL v2");
Expand Down
59 changes: 45 additions & 14 deletions trunk/drivers/iommu/omap-iommu-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ static ssize_t debug_read_ver(struct file *file, char __user *userbuf,
static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
struct omap_iommu *obj = dev_to_omap_iommu(dev);
char *p, *buf;
ssize_t bytes;

Expand All @@ -67,7 +68,8 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
static ssize_t debug_read_tlb(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
struct omap_iommu *obj = dev_to_omap_iommu(dev);
char *p, *buf;
ssize_t bytes, rest;

Expand Down Expand Up @@ -97,7 +99,8 @@ static ssize_t debug_write_pagetable(struct file *file,
struct iotlb_entry e;
struct cr_regs cr;
int err;
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
struct omap_iommu *obj = dev_to_omap_iommu(dev);
char buf[MAXCOLUMN], *p = buf;

count = min(count, sizeof(buf));
Expand Down Expand Up @@ -184,7 +187,8 @@ static ssize_t dump_ioptable(struct omap_iommu *obj, char *buf, ssize_t len)
static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
struct omap_iommu *obj = dev_to_omap_iommu(dev);
char *p, *buf;
size_t bytes;

Expand Down Expand Up @@ -212,7 +216,8 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
struct omap_iommu *obj = dev_to_omap_iommu(dev);
char *p, *buf;
struct iovm_struct *tmp;
int uninitialized_var(i);
Expand Down Expand Up @@ -254,7 +259,7 @@ static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
char *p, *buf;
struct iovm_struct *area;
ssize_t bytes;
Expand All @@ -268,8 +273,8 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf,

mutex_lock(&iommu_debug_lock);

area = omap_find_iovm_area(obj, (u32)ppos);
if (IS_ERR(area)) {
area = omap_find_iovm_area(dev, (u32)ppos);
if (!area) {
bytes = -EINVAL;
goto err_out;
}
Expand All @@ -287,7 +292,7 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
size_t count, loff_t *ppos)
{
struct omap_iommu *obj = file->private_data;
struct device *dev = file->private_data;
struct iovm_struct *area;
char *p, *buf;

Expand All @@ -305,8 +310,8 @@ static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
goto err_out;
}

area = omap_find_iovm_area(obj, (u32)ppos);
if (IS_ERR(area)) {
area = omap_find_iovm_area(dev, (u32)ppos);
if (!area) {
count = -EINVAL;
goto err_out;
}
Expand Down Expand Up @@ -350,7 +355,7 @@ DEBUG_FOPS(mem);
{ \
struct dentry *dent; \
dent = debugfs_create_file(#attr, mode, parent, \
obj, &debug_##attr##_fops); \
dev, &debug_##attr##_fops); \
if (!dent) \
return -ENOMEM; \
}
Expand All @@ -362,20 +367,29 @@ static int iommu_debug_register(struct device *dev, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_iommu *obj = platform_get_drvdata(pdev);
struct omap_iommu_arch_data *arch_data;
struct dentry *d, *parent;

if (!obj || !obj->dev)
return -EINVAL;

arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL);
if (!arch_data)
return -ENOMEM;

arch_data->iommu_dev = obj;

dev->archdata.iommu = arch_data;

d = debugfs_create_dir(obj->name, iommu_debug_root);
if (!d)
return -ENOMEM;
goto nomem;
parent = d;

d = debugfs_create_u8("nr_tlb_entries", 400, parent,
(u8 *)&obj->nr_tlb_entries);
if (!d)
return -ENOMEM;
goto nomem;

DEBUG_ADD_FILE_RO(ver);
DEBUG_ADD_FILE_RO(regs);
Expand All @@ -384,6 +398,22 @@ static int iommu_debug_register(struct device *dev, void *data)
DEBUG_ADD_FILE_RO(mmap);
DEBUG_ADD_FILE(mem);

return 0;

nomem:
kfree(arch_data);
return -ENOMEM;
}

static int iommu_debug_unregister(struct device *dev, void *data)
{
if (!dev->archdata.iommu)
return 0;

kfree(dev->archdata.iommu);

dev->archdata.iommu = NULL;

return 0;
}

Expand Down Expand Up @@ -411,6 +441,7 @@ module_init(iommu_debug_init)
static void __exit iommu_debugfs_exit(void)
{
debugfs_remove_recursive(iommu_debug_root);
omap_foreach_iommu_device(NULL, iommu_debug_unregister);
}
module_exit(iommu_debugfs_exit)

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/iommu/omap-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,8 @@ static int __init omap_iommu_init(void)

return platform_driver_register(&omap_iommu_driver);
}
module_init(omap_iommu_init);
/* must be ready before omap3isp is probed */
subsys_initcall(omap_iommu_init);

static void __exit omap_iommu_exit(void)
{
Expand Down

0 comments on commit 6dcdc8c

Please sign in to comment.