#include <linux/module.h>
#include <linux/hardirq.h>
#include <linux/topology.h>
#define define_id_show_func(name) \
static ssize_t name##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
return sprintf(buf, "%d\n", topology_##name(dev->id)); \
#define define_siblings_show_map(name, mask) \
static ssize_t name##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
return cpumap_print_to_pagebuf(false, buf, topology_##mask(dev->id));\
#define define_siblings_show_list(name, mask) \
static ssize_t name##_list_show(struct device *dev, \
struct device_attribute *attr, \
return cpumap_print_to_pagebuf(true, buf, topology_##mask(dev->id));\
#define define_siblings_show_func(name, mask) \
define_siblings_show_map(name, mask); \
define_siblings_show_list(name, mask)
define_id_show_func(physical_package_id);
static DEVICE_ATTR_RO(physical_package_id);
define_id_show_func(core_id);
static DEVICE_ATTR_RO(core_id);
define_siblings_show_func(thread_siblings, sibling_cpumask);
static DEVICE_ATTR_RO(thread_siblings);
static DEVICE_ATTR_RO(thread_siblings_list);
define_siblings_show_func(core_siblings, core_cpumask);
static DEVICE_ATTR_RO(core_siblings);
static DEVICE_ATTR_RO(core_siblings_list);
define_id_show_func(book_id);
static DEVICE_ATTR_RO(book_id);
define_siblings_show_func(book_siblings, book_cpumask);
static DEVICE_ATTR_RO(book_siblings);
static DEVICE_ATTR_RO(book_siblings_list);