static int palinfo_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int hotcpu = (unsigned long)hcpu; switch (action) { case CPU_ONLINE: create_palinfo_proc_entries(hotcpu); break; case CPU_DEAD: remove_palinfo_proc_entries(hotcpu); break; } return NOTIFY_OK; }
static void __exit palinfo_exit(void) { int i = 0; /* remove all nodes: depth first pass. Could optimize this */ for_each_online_cpu(i) { remove_palinfo_proc_entries(i); } /* * Remove the top level entry finally */ remove_proc_entry(palinfo_dir->name, NULL); /* * Unregister from cpu notifier callbacks */ unregister_hotcpu_notifier(&palinfo_cpu_notifier); }