summaryrefslogtreecommitdiff
path: root/lib/test_debug_virtual.c
blob: b7cc0aaee1734647e34e4055bb4e12a68987cc3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/export.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/sizes.h>
#include <linux/io.h>

#include <asm/page.h>
#ifdef CONFIG_MIPS
#include <asm/bootinfo.h>
#endif

struct foo {
	unsigned int bar;
};

static struct foo *foo;

static int __init test_debug_virtual_init(void)
{
	phys_addr_t pa;
	void *va;

	va = (void *)VMALLOC_START;
	pa = virt_to_phys(va);

	pr_info("PA: %pa for VA: 0x%lx\n", &pa, (unsigned long)va);

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

	pa = virt_to_phys(foo);
	va = foo;
	pr_info("PA: %pa for VA: 0x%lx\n", &pa, (unsigned long)va);

	return 0;
}
module_init(test_debug_virtual_init);

static void __exit test_debug_virtual_exit(void)
{
	kfree(foo);
}
module_exit(test_debug_virtual_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Test module for CONFIG_DEBUG_VIRTUAL");
tro/kernel/commit/drivers/pwm/pwm-tegra.c?id=3dd0a909479c1d372341d749b4ff94cd638b57da'>pwm: Fill in missing .owner fieldsThierry Reding 2013-05-18drivers/pwm: don't check resource with devm_ioremap_resourceWolfram Sang 2013-04-23pwm: Constify OF match tablesThierry Reding 2013-02-26Merge tag 'for-3.9-rc1' of git://gitorious.org/linux-pwm/linux-pwmLinus Torvalds 2013-02-15pwm: tegra: assume CONFIG_OFStephen Warren 2013-01-22pwm: Convert to devm_ioremap_resource()Thierry Reding 2012-11-28pwm: remove use of __devexitBill Pemberton 2012-11-28pwm: remove use of __devexit_pBill Pemberton 2012-08-17pwm: Remove a redundant error message when devm_request_and_ioremap failsAxel Lin 2012-07-23pwm: Convert pwm-tegra to use devm_clk_get()Axel Lin 2012-07-02pwm: tegra: Add device tree supportThierry Reding 2012-07-02pwm: Add NVIDIA Tegra SoC supportThierry Reding