mm/memory_hotplug: prevalidate the address range being added with platform
[linux-2.6-microblaze.git] / mm / backing-dev.c
index 408d505..eca555f 100644 (file)
@@ -32,6 +32,8 @@ LIST_HEAD(bdi_list);
 /* bdi_wq serves all asynchronous writeback tasks */
 struct workqueue_struct *bdi_wq;
 
+#define K(x) ((x) << (PAGE_SHIFT - 10))
+
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
@@ -69,7 +71,6 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
        global_dirty_limits(&background_thresh, &dirty_thresh);
        wb_thresh = wb_calc_thresh(wb, dirty_thresh);
 
-#define K(x) ((x) << (PAGE_SHIFT - 10))
        seq_printf(m,
                   "BdiWriteback:       %10lu kB\n"
                   "BdiReclaimable:     %10lu kB\n"
@@ -98,7 +99,6 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
                   nr_more_io,
                   nr_dirty_time,
                   !list_empty(&bdi->bdi_list), bdi->wb.state);
-#undef K
 
        return 0;
 }
@@ -146,15 +146,13 @@ static ssize_t read_ahead_kb_store(struct device *dev,
        return count;
 }
 
-#define K(pages) ((pages) << (PAGE_SHIFT - 10))
-
 #define BDI_SHOW(name, expr)                                           \
 static ssize_t name##_show(struct device *dev,                         \
-                          struct device_attribute *attr, char *page)   \
+                          struct device_attribute *attr, char *buf)    \
 {                                                                      \
        struct backing_dev_info *bdi = dev_get_drvdata(dev);            \
                                                                        \
-       return snprintf(page, PAGE_SIZE-1, "%lld\n", (long long)expr);  \
+       return sysfs_emit(buf, "%lld\n", (long long)expr);              \
 }                                                                      \
 static DEVICE_ATTR_RW(name);
 
@@ -200,11 +198,11 @@ BDI_SHOW(max_ratio, bdi->max_ratio)
 
 static ssize_t stable_pages_required_show(struct device *dev,
                                          struct device_attribute *attr,
-                                         char *page)
+                                         char *buf)
 {
        dev_warn_once(dev,
                "the stable_pages_required attribute has been removed. Use the stable_writes queue attribute instead.\n");
-       return snprintf(page, PAGE_SIZE-1, "%d\n", 0);
+       return sysfs_emit(buf, "%d\n", 0);
 }
 static DEVICE_ATTR_RO(stable_pages_required);