1. common usage macro for kernel list.
list_for_each_entry(pos, head, member)
@pos: the type * to use as a loop cursor
@head: the head for your list
@member: the name of the list_struct within the struct
2. error macro for driver common usage
ERR_PTR -> set error flag
IS_ERR -> judge if error occur
3. kernel resources management
struct resource *platform_get_resource (struct platform_device *dev, unsigned int type, unsigned int num) -> get resource for a device.
4. kernel clock management(recursion)
no clk controller available in FPGA
5. #define ioremap_nocache (cookie, size) __arm_ioremap(cookie, size, MT_DEVICE)
arch/arm/mm/ioremap.c -> void __iomem *__arm_ioremap (unsigned long phys_addr, size_t size, unsigned int mtype)
void __iomem *__arm_ioremap_pfn (unsigned long pfn, unsigned long offset, size_t size, unsigned int mtype)
remap_area_supersections/remap_area_sections/remap_area_pages
static inline void flush_cache_vmap (unsigned long start, unsigned long end)->used when creating mappings in kernel space for pages
PFN -> page frame number
6. VIPT (virtually-index-physically-tagged) cache
7. static inline const char *dev_name(const struct device *dev)
8. Macro definition for reduntant struct, eg:
#define SDMMC_PLATFORM_DATA(id, bits, clk, name) /
static struct sd_slot slot_data_##id = { /
.pdev = &sirfsoc_sdmmc_device_##id, /
.bus_width = MMC_CAP_MAX_BUS_##bits##BITS, /
.clk_name = clk, /
.sdmmc_name = name, /
};