Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280077
b: refs/heads/master
c: 6c9d290
h: refs/heads/master
i:
  280075: 4b0cca2
v: v3
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Dec 21, 2011
1 parent 6f81ada commit 8b2e7b1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3fbacffbe9744920a80c04efc507c6a42e355c59
refs/heads/master: 6c9d290952642873548a78dfa0eecc4c82b9af1d
67 changes: 34 additions & 33 deletions trunk/arch/powerpc/platforms/pseries/cmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <linux/sched.h>
#include <linux/stringify.h>
#include <linux/swap.h>
#include <linux/sysdev.h>
#include <linux/device.h>
#include <asm/firmware.h>
#include <asm/hvcall.h>
#include <asm/mmu.h>
Expand Down Expand Up @@ -65,7 +65,7 @@ static unsigned int oom_kb = CMM_OOM_KB;
static unsigned int cmm_debug = CMM_DEBUG;
static unsigned int cmm_disabled = CMM_DISABLE;
static unsigned long min_mem_mb = CMM_MIN_MEM_MB;
static struct sys_device cmm_sysdev;
static struct device cmm_dev;

MODULE_AUTHOR("Brian King <brking@linux.vnet.ibm.com>");
MODULE_DESCRIPTION("IBM System p Collaborative Memory Manager");
Expand Down Expand Up @@ -347,25 +347,25 @@ static int cmm_thread(void *dummy)
}

#define CMM_SHOW(name, format, args...) \
static ssize_t show_##name(struct sys_device *dev, \
struct sysdev_attribute *attr, \
static ssize_t show_##name(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
return sprintf(buf, format, ##args); \
} \
static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL)
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)

CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages));
CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target));

static ssize_t show_oom_pages(struct sys_device *dev,
struct sysdev_attribute *attr, char *buf)
static ssize_t show_oom_pages(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages));
}

static ssize_t store_oom_pages(struct sys_device *dev,
struct sysdev_attribute *attr,
static ssize_t store_oom_pages(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long val = simple_strtoul (buf, NULL, 10);
Expand All @@ -379,17 +379,18 @@ static ssize_t store_oom_pages(struct sys_device *dev,
return count;
}

static SYSDEV_ATTR(oom_freed_kb, S_IWUSR| S_IRUGO,
static DEVICE_ATTR(oom_freed_kb, S_IWUSR | S_IRUGO,
show_oom_pages, store_oom_pages);

static struct sysdev_attribute *cmm_attrs[] = {
&attr_loaned_kb,
&attr_loaned_target_kb,
&attr_oom_freed_kb,
static struct device_attribute *cmm_attrs[] = {
&dev_attr_loaned_kb,
&dev_attr_loaned_target_kb,
&dev_attr_oom_freed_kb,
};

static struct sysdev_class cmm_sysdev_class = {
static struct bus_type cmm_subsys = {
.name = "cmm",
.dev_name = "cmm",
};

/**
Expand All @@ -398,47 +399,47 @@ static struct sysdev_class cmm_sysdev_class = {
* Return value:
* 0 on success / other on failure
**/
static int cmm_sysfs_register(struct sys_device *sysdev)
static int cmm_sysfs_register(struct device *dev)
{
int i, rc;

if ((rc = sysdev_class_register(&cmm_sysdev_class)))
if ((rc = subsys_system_register(&cmm_subsys, NULL)))
return rc;

sysdev->id = 0;
sysdev->cls = &cmm_sysdev_class;
dev->id = 0;
dev->bus = &cmm_subsys;

if ((rc = sysdev_register(sysdev)))
goto class_unregister;
if ((rc = device_register(dev)))
goto subsys_unregister;

for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) {
if ((rc = sysdev_create_file(sysdev, cmm_attrs[i])))
if ((rc = device_create_file(dev, cmm_attrs[i])))
goto fail;
}

return 0;

fail:
while (--i >= 0)
sysdev_remove_file(sysdev, cmm_attrs[i]);
sysdev_unregister(sysdev);
class_unregister:
sysdev_class_unregister(&cmm_sysdev_class);
device_remove_file(dev, cmm_attrs[i]);
device_unregister(dev);
subsys_unregister:
bus_unregister(&cmm_subsys);
return rc;
}

/**
* cmm_unregister_sysfs - Unregister from sysfs
*
**/
static void cmm_unregister_sysfs(struct sys_device *sysdev)
static void cmm_unregister_sysfs(struct device *dev)
{
int i;

for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++)
sysdev_remove_file(sysdev, cmm_attrs[i]);
sysdev_unregister(sysdev);
sysdev_class_unregister(&cmm_sysdev_class);
device_remove_file(dev, cmm_attrs[i]);
device_unregister(dev);
bus_unregister(&cmm_subsys);
}

/**
Expand Down Expand Up @@ -657,7 +658,7 @@ static int cmm_init(void)
if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
goto out_oom_notifier;

if ((rc = cmm_sysfs_register(&cmm_sysdev)))
if ((rc = cmm_sysfs_register(&cmm_dev)))
goto out_reboot_notifier;

if (register_memory_notifier(&cmm_mem_nb) ||
Expand All @@ -678,7 +679,7 @@ static int cmm_init(void)
out_unregister_notifier:
unregister_memory_notifier(&cmm_mem_nb);
unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
cmm_unregister_sysfs(&cmm_sysdev);
cmm_unregister_sysfs(&cmm_dev);
out_reboot_notifier:
unregister_reboot_notifier(&cmm_reboot_nb);
out_oom_notifier:
Expand All @@ -701,7 +702,7 @@ static void cmm_exit(void)
unregister_memory_notifier(&cmm_mem_nb);
unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
cmm_free_pages(loaned_pages);
cmm_unregister_sysfs(&cmm_sysdev);
cmm_unregister_sysfs(&cmm_dev);
}

/**
Expand Down

0 comments on commit 8b2e7b1

Please sign in to comment.