/* alignment check */
if (!is_aligned(size, SZ_64K)) {
- dev_err(&mmu->dev,
+ dev_err(mmu->dev,
"MMU %s: size(0x%lx) is not multiple of 64KB.\n",
mmu->name, size);
return -EINVAL;
}
if (size > (1 << mmu->addrspace)) {
- dev_err(&mmu->dev,
+ dev_err(mmu->dev,
"MMU %s: size(0x%lx) is larger than external device "
" memory space size (0x%x.\n", mmu->name, size,
(1 << mmu->addrspace));
pte_t *ptep;
int prot_pmd, prot_pte;
- dev_dbg(&mmu->dev,
+ dev_dbg(mmu->dev,
"MMU %s: mapping in ARM MMU, v=0x%08lx, p=0x%08lx, sz=0x%lx\n",
mmu->name, virt, phys, size);
pmd_t *pmdp;
pte_t *ptep;
- dev_dbg(&mmu->dev,
+ dev_dbg(mmu->dev,
"MMU %s: unmapping in ARM MMU, v=0x%08lx, sz=0x%lx\n",
mmu->name, virt, size);
found_victim:
/* The last entry cannot be locked? */
if (lock.victim == (mmu->nr_tlb_entries - 1)) {
- dev_err(&mmu->dev, "MMU %s: TLB is full.\n", mmu->name);
+ dev_err(mmu->dev, "MMU %s: TLB is full.\n", mmu->name);
return -EBUSY;
}
* alignment check
*/
if (!is_aligned(size, MINIMUM_PAGESZ)) {
- dev_err(&mmu->dev,
+ dev_err(mmu->dev,
"MMU %s: size(0x%lx) is not multiple of 4KB.\n",
mmu->name, size);
return -EINVAL;
}
if (!is_aligned(devadr, MINIMUM_PAGESZ)) {
- dev_err(&mmu->dev,
+ dev_err(mmu->dev,
"MMU %s: external device address(0x%lx) is not"
" aligned.\n", mmu->name, devadr);
return -EINVAL;
}
if (!is_aligned(padr, MINIMUM_PAGESZ)) {
- dev_err(&mmu->dev,
+ dev_err(mmu->dev,
"MMU %s: physical address(0x%lx) is not aligned.\n",
mmu->name, padr);
return -EINVAL;
/* address validity check */
if ((devadr < mmu->memsize) ||
(devadr >= (1 << mmu->addrspace))) {
- dev_err(&mmu->dev,
+ dev_err(mmu->dev,
"MMU %s: illegal address/size for %s().\n",
mmu->name, __FUNCTION__);
return -EINVAL;
mapsize = 1 << (tmp_ent->order + PAGE_SHIFT);
if ((_vadr + size > tmp_ent->vadr) &&
(_vadr < tmp_ent->vadr + mapsize)) {
- dev_err(&mmu->dev, "MMU %s: exmap page overlap!\n",
+ dev_err(mmu->dev, "MMU %s: exmap page overlap!\n",
mmu->name);
up_write(&mmu->exmap_sem);
return -EINVAL;
if (!mmu->exmap_tbl[idx].valid)
goto found_free;
- dev_err(&mmu->dev, "MMU %s: TLB is full.\n", mmu->name);
+ dev_err(mmu->dev, "MMU %s: TLB is full.\n", mmu->name);
status = -EBUSY;
goto fail;
/* freeing allocated memory */
if (ent->type == EXMAP_TYPE_MEM) {
omap_mmu_free_pages((unsigned long)ent->buf, ent->order);
- dev_dbg(&mmu->dev, "MMU %s: freeing 0x%lx bytes @ adr 0x%8p\n",
+ dev_dbg(mmu->dev, "MMU %s: freeing 0x%lx bytes @ adr 0x%8p\n",
mmu->name, size, ent->buf);
}
goto found_map;
}
up_write(&mmu->exmap_sem);
- dev_warn(&mmu->dev, "MMU %s: address %06lx not found in exmap_tbl.\n",
+ dev_warn(mmu->dev, "MMU %s: address %06lx not found in exmap_tbl.\n",
mmu->name, devadr);
return -EINVAL;
found_map:
if (ent->usecount > 0) {
- dev_err(&mmu->dev, "MMU %s: exmap reference count is not 0.\n"
+ dev_err(mmu->dev, "MMU %s: exmap reference count is not 0.\n"
" idx=%d, vadr=%p, order=%d, usecount=%d\n",
mmu->name, idx, ent->vadr, ent->order, ent->usecount);
up_write(&mmu->exmap_sem);
if (ent->vadr == vadr)
goto found_map; /* continue */
- dev_err(&mmu->dev, "MMU %s: illegal exmap_tbl grouping!\n"
+ dev_err(mmu->dev, "MMU %s: illegal exmap_tbl grouping!\n"
"expected vadr = %p, exmap_tbl[%d].vadr = %p\n",
mmu->name, vadr, idx, ent->vadr);
up_write(&mmu->exmap_sem);
ret = request_irq(mmu->irq, omap_mmu_interrupt, IRQF_DISABLED,
mmu->name, mmu);
if (ret < 0) {
- dev_err(&mmu->dev, "MMU %s: failed to register MMU interrupt:"
+ dev_err(mmu->dev, "MMU %s: failed to register MMU interrupt:"
" %d\n", mmu->name, ret);
goto fail;
}
void *vadr = omap_mmu_to_virt(mmu, p);
if (!exmap_valid(mmu, vadr, count)) {
- dev_err(&mmu->dev, "MMU %s: external device address %08lx / "
+ dev_err(mmu->dev, "MMU %s: external device address %08lx / "
"size %08x is not valid!\n", mmu->name, p, count);
return -EFAULT;
}
void *vadr = omap_mmu_to_virt(mmu, p);
if (!exmap_valid(mmu, vadr, count)) {
- dev_err(&mmu->dev, "MMU %s: external device address %08lx "
+ dev_err(mmu->dev, "MMU %s: external device address %08lx "
"/ size %08x is not valid!\n", mmu->name, p, count);
return -EFAULT;
}
struct bin_attribute *attr,
char *buf, loff_t offset, size_t count)
{
- return omap_mmu_mem_read(&mmu->dev.kobj, attr, buf, offset, count);
+ return omap_mmu_mem_read(&mmu->dev->kobj, attr, buf, offset, count);
}
EXPORT_SYMBOL_GPL(__omap_mmu_mem_read);
struct bin_attribute *attr,
char *buf, loff_t offset, size_t count)
{
- return omap_mmu_mem_write(&mmu->dev.kobj, attr, buf, offset, count);
+ return omap_mmu_mem_write(&mmu->dev->kobj, attr, buf, offset, count);
}
EXPORT_SYMBOL_GPL(__omap_mmu_mem_write);
{
int ret;
- mmu->dev.class = &omap_mmu_class;
- strlcpy(mmu->dev.bus_id, mmu->name, KOBJ_NAME_LEN);
- dev_set_drvdata(&mmu->dev, mmu);
+ mmu->dev = device_create(&omap_mmu_class, NULL, 0, "%s", mmu->name);
+ if (unlikely(IS_ERR(mmu->dev)))
+ return PTR_ERR(mmu->dev);
+ dev_set_drvdata(mmu->dev, mmu);
- mmu->exmap_tbl = kzalloc(sizeof(struct exmap_tbl) * mmu->nr_tlb_entries,
+ mmu->exmap_tbl = kcalloc(mmu->nr_tlb_entries, sizeof(struct exmap_tbl),
GFP_KERNEL);
if (!mmu->exmap_tbl)
return -ENOMEM;
goto err_mm_alloc;
}
- ret = device_register(&mmu->dev);
- if (unlikely(ret))
- goto err_dev_register;
-
init_rwsem(&mmu->exmap_sem);
ret = omap_mmu_init(mmu);
if (unlikely(ret))
goto err_mmu_init;
- ret = device_create_file(&mmu->dev, &dev_attr_mmu);
+ ret = device_create_file(mmu->dev, &dev_attr_mmu);
if (unlikely(ret))
goto err_dev_create_mmu;
- ret = device_create_file(&mmu->dev, &dev_attr_exmap);
+ ret = device_create_file(mmu->dev, &dev_attr_exmap);
if (unlikely(ret))
goto err_dev_create_exmap;
if (likely(mmu->membase)) {
dev_attr_mem.size = mmu->memsize;
- ret = device_create_bin_file(&mmu->dev,
+ ret = device_create_bin_file(mmu->dev,
&dev_attr_mem);
if (unlikely(ret))
goto err_bin_create_mem;
}
-
return 0;
err_bin_create_mem:
- device_remove_file(&mmu->dev, &dev_attr_exmap);
+ device_remove_file(mmu->dev, &dev_attr_exmap);
err_dev_create_exmap:
- device_remove_file(&mmu->dev, &dev_attr_mmu);
+ device_remove_file(mmu->dev, &dev_attr_mmu);
err_dev_create_mmu:
omap_mmu_shutdown(mmu);
err_mmu_init:
- device_unregister(&mmu->dev);
-err_dev_register:
kfree(mmu->twl_mm);
mmu->twl_mm = NULL;
err_mm_alloc:
kfree(mmu->exmap_tbl);
mmu->exmap_tbl = NULL;
+ device_unregister(mmu->dev);
return ret;
}
EXPORT_SYMBOL_GPL(omap_mmu_register);
omap_mmu_shutdown(mmu);
omap_mmu_kmem_release();
- device_remove_file(&mmu->dev, &dev_attr_mmu);
- device_remove_file(&mmu->dev, &dev_attr_exmap);
+ device_remove_file(mmu->dev, &dev_attr_mmu);
+ device_remove_file(mmu->dev, &dev_attr_exmap);
if (likely(mmu->membase))
- device_remove_bin_file(&mmu->dev,
- &dev_attr_mem);
+ device_remove_bin_file(mmu->dev, &dev_attr_mem);
+
+ device_unregister(mmu->dev);
kfree(mmu->exmap_tbl);
mmu->exmap_tbl = NULL;
__mmdrop(mmu->twl_mm);
mmu->twl_mm = NULL;
}
-
- device_unregister(&mmu->dev);
}
EXPORT_SYMBOL_GPL(omap_mmu_unregister);