aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xen-selfballoon.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-14 18:32:50 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-14 18:32:50 -0500
commit070680218379e15c1901f4bf21b98e3cbf12b527 (patch)
tree8bb5afe22614ee94e06d650618949a192181de0f /drivers/xen/xen-selfballoon.c
parentd369a5d8fc70710236ae2d06a0e42dce483712df (diff)
xen-balloon: convert sysdev_class to a regular subsystem
After all sysdev classes are ported to regular driver core entities, the sysdev implementation will be entirely removed from the kernel. Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/xen/xen-selfballoon.c')
-rw-r--r--drivers/xen/xen-selfballoon.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c
index d93c70857e03..b7b9e95f8717 100644
--- a/drivers/xen/xen-selfballoon.c
+++ b/drivers/xen/xen-selfballoon.c
@@ -266,21 +266,20 @@ static void selfballoon_process(struct work_struct *work)
266 266
267#ifdef CONFIG_SYSFS 267#ifdef CONFIG_SYSFS
268 268
269#include <linux/sysdev.h>
270#include <linux/capability.h> 269#include <linux/capability.h>
271 270
272#define SELFBALLOON_SHOW(name, format, args...) \ 271#define SELFBALLOON_SHOW(name, format, args...) \
273 static ssize_t show_##name(struct sys_device *dev, \ 272 static ssize_t show_##name(struct device *dev, \
274 struct sysdev_attribute *attr, \ 273 struct device_attribute *attr, \
275 char *buf) \ 274 char *buf) \
276 { \ 275 { \
277 return sprintf(buf, format, ##args); \ 276 return sprintf(buf, format, ##args); \
278 } 277 }
279 278
280SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled); 279SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled);
281 280
282static ssize_t store_selfballooning(struct sys_device *dev, 281static ssize_t store_selfballooning(struct device *dev,
283 struct sysdev_attribute *attr, 282 struct device_attribute *attr,
284 const char *buf, 283 const char *buf,
285 size_t count) 284 size_t count)
286{ 285{
@@ -303,13 +302,13 @@ static ssize_t store_selfballooning(struct sys_device *dev,
303 return count; 302 return count;
304} 303}
305 304
306static SYSDEV_ATTR(selfballooning, S_IRUGO | S_IWUSR, 305static DEVICE_ATTR(selfballooning, S_IRUGO | S_IWUSR,
307 show_selfballooning, store_selfballooning); 306 show_selfballooning, store_selfballooning);
308 307
309SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval); 308SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval);
310 309
311static ssize_t store_selfballoon_interval(struct sys_device *dev, 310static ssize_t store_selfballoon_interval(struct device *dev,
312 struct sysdev_attribute *attr, 311 struct device_attribute *attr,
313 const char *buf, 312 const char *buf,
314 size_t count) 313 size_t count)
315{ 314{
@@ -325,13 +324,13 @@ static ssize_t store_selfballoon_interval(struct sys_device *dev,
325 return count; 324 return count;
326} 325}
327 326
328static SYSDEV_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, 327static DEVICE_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR,
329 show_selfballoon_interval, store_selfballoon_interval); 328 show_selfballoon_interval, store_selfballoon_interval);
330 329
331SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis); 330SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis);
332 331
333static ssize_t store_selfballoon_downhys(struct sys_device *dev, 332static ssize_t store_selfballoon_downhys(struct device *dev,
334 struct sysdev_attribute *attr, 333 struct device_attribute *attr,
335 const char *buf, 334 const char *buf,
336 size_t count) 335 size_t count)
337{ 336{
@@ -347,14 +346,14 @@ static ssize_t store_selfballoon_downhys(struct sys_device *dev,
347 return count; 346 return count;
348} 347}
349 348
350static SYSDEV_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, 349static DEVICE_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR,
351 show_selfballoon_downhys, store_selfballoon_downhys); 350 show_selfballoon_downhys, store_selfballoon_downhys);
352 351
353 352
354SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis); 353SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis);
355 354
356static ssize_t store_selfballoon_uphys(struct sys_device *dev, 355static ssize_t store_selfballoon_uphys(struct device *dev,
357 struct sysdev_attribute *attr, 356 struct device_attribute *attr,
358 const char *buf, 357 const char *buf,
359 size_t count) 358 size_t count)
360{ 359{
@@ -370,14 +369,14 @@ static ssize_t store_selfballoon_uphys(struct sys_device *dev,
370 return count; 369 return count;
371} 370}
372 371
373static SYSDEV_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, 372static DEVICE_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR,
374 show_selfballoon_uphys, store_selfballoon_uphys); 373 show_selfballoon_uphys, store_selfballoon_uphys);
375 374
376SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n", 375SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n",
377 selfballoon_min_usable_mb); 376 selfballoon_min_usable_mb);
378 377
379static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, 378static ssize_t store_selfballoon_min_usable_mb(struct device *dev,
380 struct sysdev_attribute *attr, 379 struct device_attribute *attr,
381 const char *buf, 380 const char *buf,
382 size_t count) 381 size_t count)
383{ 382{
@@ -393,7 +392,7 @@ static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev,
393 return count; 392 return count;
394} 393}
395 394
396static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, 395static DEVICE_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR,
397 show_selfballoon_min_usable_mb, 396 show_selfballoon_min_usable_mb,
398 store_selfballoon_min_usable_mb); 397 store_selfballoon_min_usable_mb);
399 398
@@ -401,8 +400,8 @@ static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR,
401#ifdef CONFIG_FRONTSWAP 400#ifdef CONFIG_FRONTSWAP
402SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking); 401SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking);
403 402
404static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, 403static ssize_t store_frontswap_selfshrinking(struct device *dev,
405 struct sysdev_attribute *attr, 404 struct device_attribute *attr,
406 const char *buf, 405 const char *buf,
407 size_t count) 406 size_t count)
408{ 407{
@@ -424,13 +423,13 @@ static ssize_t store_frontswap_selfshrinking(struct sys_device *dev,
424 return count; 423 return count;
425} 424}
426 425
427static SYSDEV_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, 426static DEVICE_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR,
428 show_frontswap_selfshrinking, store_frontswap_selfshrinking); 427 show_frontswap_selfshrinking, store_frontswap_selfshrinking);
429 428
430SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia); 429SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia);
431 430
432static ssize_t store_frontswap_inertia(struct sys_device *dev, 431static ssize_t store_frontswap_inertia(struct device *dev,
433 struct sysdev_attribute *attr, 432 struct device_attribute *attr,
434 const char *buf, 433 const char *buf,
435 size_t count) 434 size_t count)
436{ 435{
@@ -447,13 +446,13 @@ static ssize_t store_frontswap_inertia(struct sys_device *dev,
447 return count; 446 return count;
448} 447}
449 448
450static SYSDEV_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, 449static DEVICE_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR,
451 show_frontswap_inertia, store_frontswap_inertia); 450 show_frontswap_inertia, store_frontswap_inertia);
452 451
453SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis); 452SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis);
454 453
455static ssize_t store_frontswap_hysteresis(struct sys_device *dev, 454static ssize_t store_frontswap_hysteresis(struct device *dev,
456 struct sysdev_attribute *attr, 455 struct device_attribute *attr,
457 const char *buf, 456 const char *buf,
458 size_t count) 457 size_t count)
459{ 458{
@@ -469,21 +468,21 @@ static ssize_t store_frontswap_hysteresis(struct sys_device *dev,
469 return count; 468 return count;
470} 469}
471 470
472static SYSDEV_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, 471static DEVICE_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR,
473 show_frontswap_hysteresis, store_frontswap_hysteresis); 472 show_frontswap_hysteresis, store_frontswap_hysteresis);
474 473
475#endif /* CONFIG_FRONTSWAP */ 474#endif /* CONFIG_FRONTSWAP */
476 475
477static struct attribute *selfballoon_attrs[] = { 476static struct attribute *selfballoon_attrs[] = {
478 &attr_selfballooning.attr, 477 &dev_attr_selfballooning.attr,
479 &attr_selfballoon_interval.attr, 478 &dev_attr_selfballoon_interval.attr,
480 &attr_selfballoon_downhysteresis.attr, 479 &dev_attr_selfballoon_downhysteresis.attr,
481 &attr_selfballoon_uphysteresis.attr, 480 &dev_attr_selfballoon_uphysteresis.attr,
482 &attr_selfballoon_min_usable_mb.attr, 481 &dev_attr_selfballoon_min_usable_mb.attr,
483#ifdef CONFIG_FRONTSWAP 482#ifdef CONFIG_FRONTSWAP
484 &attr_frontswap_selfshrinking.attr, 483 &dev_attr_frontswap_selfshrinking.attr,
485 &attr_frontswap_hysteresis.attr, 484 &dev_attr_frontswap_hysteresis.attr,
486 &attr_frontswap_inertia.attr, 485 &dev_attr_frontswap_inertia.attr,
487#endif 486#endif
488 NULL 487 NULL
489}; 488};
@@ -494,12 +493,12 @@ static struct attribute_group selfballoon_group = {
494}; 493};
495#endif 494#endif
496 495
497int register_xen_selfballooning(struct sys_device *sysdev) 496int register_xen_selfballooning(struct device *dev)
498{ 497{
499 int error = -1; 498 int error = -1;
500 499
501#ifdef CONFIG_SYSFS 500#ifdef CONFIG_SYSFS
502 error = sysfs_create_group(&sysdev->kobj, &selfballoon_group); 501 error = sysfs_create_group(&dev->kobj, &selfballoon_group);
503#endif 502#endif
504 return error; 503 return error;
505} 504}