diff options
Diffstat (limited to 'drivers/xen/xen-selfballoon.c')
-rw-r--r-- | drivers/xen/xen-selfballoon.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index d93c70857e03..767ff656d5a7 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/mman.h> | 74 | #include <linux/mman.h> |
75 | #include <linux/module.h> | 75 | #include <linux/module.h> |
76 | #include <linux/workqueue.h> | 76 | #include <linux/workqueue.h> |
77 | #include <linux/device.h> | ||
77 | #include <xen/balloon.h> | 78 | #include <xen/balloon.h> |
78 | #include <xen/tmem.h> | 79 | #include <xen/tmem.h> |
79 | #include <xen/xen.h> | 80 | #include <xen/xen.h> |
@@ -266,21 +267,20 @@ static void selfballoon_process(struct work_struct *work) | |||
266 | 267 | ||
267 | #ifdef CONFIG_SYSFS | 268 | #ifdef CONFIG_SYSFS |
268 | 269 | ||
269 | #include <linux/sysdev.h> | ||
270 | #include <linux/capability.h> | 270 | #include <linux/capability.h> |
271 | 271 | ||
272 | #define SELFBALLOON_SHOW(name, format, args...) \ | 272 | #define SELFBALLOON_SHOW(name, format, args...) \ |
273 | static ssize_t show_##name(struct sys_device *dev, \ | 273 | static ssize_t show_##name(struct device *dev, \ |
274 | struct sysdev_attribute *attr, \ | 274 | struct device_attribute *attr, \ |
275 | char *buf) \ | 275 | char *buf) \ |
276 | { \ | 276 | { \ |
277 | return sprintf(buf, format, ##args); \ | 277 | return sprintf(buf, format, ##args); \ |
278 | } | 278 | } |
279 | 279 | ||
280 | SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled); | 280 | SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled); |
281 | 281 | ||
282 | static ssize_t store_selfballooning(struct sys_device *dev, | 282 | static ssize_t store_selfballooning(struct device *dev, |
283 | struct sysdev_attribute *attr, | 283 | struct device_attribute *attr, |
284 | const char *buf, | 284 | const char *buf, |
285 | size_t count) | 285 | size_t count) |
286 | { | 286 | { |
@@ -303,13 +303,13 @@ static ssize_t store_selfballooning(struct sys_device *dev, | |||
303 | return count; | 303 | return count; |
304 | } | 304 | } |
305 | 305 | ||
306 | static SYSDEV_ATTR(selfballooning, S_IRUGO | S_IWUSR, | 306 | static DEVICE_ATTR(selfballooning, S_IRUGO | S_IWUSR, |
307 | show_selfballooning, store_selfballooning); | 307 | show_selfballooning, store_selfballooning); |
308 | 308 | ||
309 | SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval); | 309 | SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval); |
310 | 310 | ||
311 | static ssize_t store_selfballoon_interval(struct sys_device *dev, | 311 | static ssize_t store_selfballoon_interval(struct device *dev, |
312 | struct sysdev_attribute *attr, | 312 | struct device_attribute *attr, |
313 | const char *buf, | 313 | const char *buf, |
314 | size_t count) | 314 | size_t count) |
315 | { | 315 | { |
@@ -325,13 +325,13 @@ static ssize_t store_selfballoon_interval(struct sys_device *dev, | |||
325 | return count; | 325 | return count; |
326 | } | 326 | } |
327 | 327 | ||
328 | static SYSDEV_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, | 328 | static DEVICE_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, |
329 | show_selfballoon_interval, store_selfballoon_interval); | 329 | show_selfballoon_interval, store_selfballoon_interval); |
330 | 330 | ||
331 | SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis); | 331 | SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis); |
332 | 332 | ||
333 | static ssize_t store_selfballoon_downhys(struct sys_device *dev, | 333 | static ssize_t store_selfballoon_downhys(struct device *dev, |
334 | struct sysdev_attribute *attr, | 334 | struct device_attribute *attr, |
335 | const char *buf, | 335 | const char *buf, |
336 | size_t count) | 336 | size_t count) |
337 | { | 337 | { |
@@ -347,14 +347,14 @@ static ssize_t store_selfballoon_downhys(struct sys_device *dev, | |||
347 | return count; | 347 | return count; |
348 | } | 348 | } |
349 | 349 | ||
350 | static SYSDEV_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, | 350 | static DEVICE_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, |
351 | show_selfballoon_downhys, store_selfballoon_downhys); | 351 | show_selfballoon_downhys, store_selfballoon_downhys); |
352 | 352 | ||
353 | 353 | ||
354 | SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis); | 354 | SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis); |
355 | 355 | ||
356 | static ssize_t store_selfballoon_uphys(struct sys_device *dev, | 356 | static ssize_t store_selfballoon_uphys(struct device *dev, |
357 | struct sysdev_attribute *attr, | 357 | struct device_attribute *attr, |
358 | const char *buf, | 358 | const char *buf, |
359 | size_t count) | 359 | size_t count) |
360 | { | 360 | { |
@@ -370,14 +370,14 @@ static ssize_t store_selfballoon_uphys(struct sys_device *dev, | |||
370 | return count; | 370 | return count; |
371 | } | 371 | } |
372 | 372 | ||
373 | static SYSDEV_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, | 373 | static DEVICE_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, |
374 | show_selfballoon_uphys, store_selfballoon_uphys); | 374 | show_selfballoon_uphys, store_selfballoon_uphys); |
375 | 375 | ||
376 | SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n", | 376 | SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n", |
377 | selfballoon_min_usable_mb); | 377 | selfballoon_min_usable_mb); |
378 | 378 | ||
379 | static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, | 379 | static ssize_t store_selfballoon_min_usable_mb(struct device *dev, |
380 | struct sysdev_attribute *attr, | 380 | struct device_attribute *attr, |
381 | const char *buf, | 381 | const char *buf, |
382 | size_t count) | 382 | size_t count) |
383 | { | 383 | { |
@@ -393,7 +393,7 @@ static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, | |||
393 | return count; | 393 | return count; |
394 | } | 394 | } |
395 | 395 | ||
396 | static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, | 396 | static DEVICE_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, |
397 | show_selfballoon_min_usable_mb, | 397 | show_selfballoon_min_usable_mb, |
398 | store_selfballoon_min_usable_mb); | 398 | store_selfballoon_min_usable_mb); |
399 | 399 | ||
@@ -401,8 +401,8 @@ static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, | |||
401 | #ifdef CONFIG_FRONTSWAP | 401 | #ifdef CONFIG_FRONTSWAP |
402 | SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking); | 402 | SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking); |
403 | 403 | ||
404 | static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, | 404 | static ssize_t store_frontswap_selfshrinking(struct device *dev, |
405 | struct sysdev_attribute *attr, | 405 | struct device_attribute *attr, |
406 | const char *buf, | 406 | const char *buf, |
407 | size_t count) | 407 | size_t count) |
408 | { | 408 | { |
@@ -424,13 +424,13 @@ static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, | |||
424 | return count; | 424 | return count; |
425 | } | 425 | } |
426 | 426 | ||
427 | static SYSDEV_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, | 427 | static DEVICE_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, |
428 | show_frontswap_selfshrinking, store_frontswap_selfshrinking); | 428 | show_frontswap_selfshrinking, store_frontswap_selfshrinking); |
429 | 429 | ||
430 | SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia); | 430 | SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia); |
431 | 431 | ||
432 | static ssize_t store_frontswap_inertia(struct sys_device *dev, | 432 | static ssize_t store_frontswap_inertia(struct device *dev, |
433 | struct sysdev_attribute *attr, | 433 | struct device_attribute *attr, |
434 | const char *buf, | 434 | const char *buf, |
435 | size_t count) | 435 | size_t count) |
436 | { | 436 | { |
@@ -447,13 +447,13 @@ static ssize_t store_frontswap_inertia(struct sys_device *dev, | |||
447 | return count; | 447 | return count; |
448 | } | 448 | } |
449 | 449 | ||
450 | static SYSDEV_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, | 450 | static DEVICE_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, |
451 | show_frontswap_inertia, store_frontswap_inertia); | 451 | show_frontswap_inertia, store_frontswap_inertia); |
452 | 452 | ||
453 | SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis); | 453 | SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis); |
454 | 454 | ||
455 | static ssize_t store_frontswap_hysteresis(struct sys_device *dev, | 455 | static ssize_t store_frontswap_hysteresis(struct device *dev, |
456 | struct sysdev_attribute *attr, | 456 | struct device_attribute *attr, |
457 | const char *buf, | 457 | const char *buf, |
458 | size_t count) | 458 | size_t count) |
459 | { | 459 | { |
@@ -469,21 +469,21 @@ static ssize_t store_frontswap_hysteresis(struct sys_device *dev, | |||
469 | return count; | 469 | return count; |
470 | } | 470 | } |
471 | 471 | ||
472 | static SYSDEV_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, | 472 | static DEVICE_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, |
473 | show_frontswap_hysteresis, store_frontswap_hysteresis); | 473 | show_frontswap_hysteresis, store_frontswap_hysteresis); |
474 | 474 | ||
475 | #endif /* CONFIG_FRONTSWAP */ | 475 | #endif /* CONFIG_FRONTSWAP */ |
476 | 476 | ||
477 | static struct attribute *selfballoon_attrs[] = { | 477 | static struct attribute *selfballoon_attrs[] = { |
478 | &attr_selfballooning.attr, | 478 | &dev_attr_selfballooning.attr, |
479 | &attr_selfballoon_interval.attr, | 479 | &dev_attr_selfballoon_interval.attr, |
480 | &attr_selfballoon_downhysteresis.attr, | 480 | &dev_attr_selfballoon_downhysteresis.attr, |
481 | &attr_selfballoon_uphysteresis.attr, | 481 | &dev_attr_selfballoon_uphysteresis.attr, |
482 | &attr_selfballoon_min_usable_mb.attr, | 482 | &dev_attr_selfballoon_min_usable_mb.attr, |
483 | #ifdef CONFIG_FRONTSWAP | 483 | #ifdef CONFIG_FRONTSWAP |
484 | &attr_frontswap_selfshrinking.attr, | 484 | &dev_attr_frontswap_selfshrinking.attr, |
485 | &attr_frontswap_hysteresis.attr, | 485 | &dev_attr_frontswap_hysteresis.attr, |
486 | &attr_frontswap_inertia.attr, | 486 | &dev_attr_frontswap_inertia.attr, |
487 | #endif | 487 | #endif |
488 | NULL | 488 | NULL |
489 | }; | 489 | }; |
@@ -494,12 +494,12 @@ static struct attribute_group selfballoon_group = { | |||
494 | }; | 494 | }; |
495 | #endif | 495 | #endif |
496 | 496 | ||
497 | int register_xen_selfballooning(struct sys_device *sysdev) | 497 | int register_xen_selfballooning(struct device *dev) |
498 | { | 498 | { |
499 | int error = -1; | 499 | int error = -1; |
500 | 500 | ||
501 | #ifdef CONFIG_SYSFS | 501 | #ifdef CONFIG_SYSFS |
502 | error = sysfs_create_group(&sysdev->kobj, &selfballoon_group); | 502 | error = sysfs_create_group(&dev->kobj, &selfballoon_group); |
503 | #endif | 503 | #endif |
504 | return error; | 504 | return error; |
505 | } | 505 | } |