October 2017
Intermediate to advanced
586 pages
14h 8m
English
Here, the driver will take ownership of the memory region and map it into the virtual address space. We will discuss this more in Chapter 11, Kernel Memory Management:
struct resource *res;
void __iomem *base;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
/*
* Here one can request and map the memory region
* using request_mem_region(res->start, resource_size(res), pdev->name)
* and ioremap(iores->start, resource_size(iores)
*
* These function are discussed in chapter 11, Kernel Memory Management.
*/
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
platform_get_resource() will set the start and end fields of struct res according to the memory region present in the first (index ...
Read now
Unlock full access