Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
sysfs.c File Reference
#include <linux/kernel.h>
#include <linux/cpuidle.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/cpu.h>
#include <linux/capability.h>
#include "cpuidle.h"

Go to the source code of this file.

Data Structures

struct  cpuidle_attr
 
struct  cpuidle_state_attr
 

Macros

#define define_one_ro(_name, show)   static struct cpuidle_attr attr_##_name = __ATTR(_name, 0444, show, NULL)
 
#define define_one_rw(_name, show, store)   static struct cpuidle_attr attr_##_name = __ATTR(_name, 0644, show, store)
 
#define kobj_to_cpuidledev(k)   container_of(k, struct cpuidle_device, kobj)
 
#define attr_to_cpuidleattr(a)   container_of(a, struct cpuidle_attr, attr)
 
#define define_one_state_ro(_name, show)   static struct cpuidle_state_attr attr_##_name = __ATTR(_name, 0444, show, NULL)
 
#define define_one_state_rw(_name, show, store)   static struct cpuidle_state_attr attr_##_name = __ATTR(_name, 0644, show, store)
 
#define define_show_state_function(_name)
 
#define define_store_state_ull_function(_name)
 
#define define_show_state_ull_function(_name)
 
#define define_show_state_str_function(_name)
 
#define kobj_to_state_obj(k)   container_of(k, struct cpuidle_state_kobj, kobj)
 
#define kobj_to_state(k)   (kobj_to_state_obj(k)->state)
 
#define kobj_to_state_usage(k)   (kobj_to_state_obj(k)->state_usage)
 
#define attr_to_stateattr(a)   container_of(a, struct cpuidle_state_attr, attr)
 

Functions

 __setup ("cpuidle_sysfs_switch", cpuidle_sysfs_setup)
 
int cpuidle_add_interface (struct device *dev)
 
void cpuidle_remove_interface (struct device *dev)
 
 define_show_state_function (exit_latency)
 
int cpuidle_add_state_sysfs (struct cpuidle_device *device)
 
void cpuidle_remove_state_sysfs (struct cpuidle_device *device)
 
int cpuidle_add_sysfs (struct device *cpu_dev)
 
void cpuidle_remove_sysfs (struct device *cpu_dev)
 

Macro Definition Documentation

#define attr_to_cpuidleattr (   a)    container_of(a, struct cpuidle_attr, attr)

Definition at line 169 of file sysfs.c.

#define attr_to_stateattr (   a)    container_of(a, struct cpuidle_state_attr, attr)

Definition at line 303 of file sysfs.c.

#define define_one_ro (   _name,
  show 
)    static struct cpuidle_attr attr_##_name = __ATTR(_name, 0444, show, NULL)

Definition at line 163 of file sysfs.c.

#define define_one_rw (   _name,
  show,
  store 
)    static struct cpuidle_attr attr_##_name = __ATTR(_name, 0644, show, store)

Definition at line 165 of file sysfs.c.

#define define_one_state_ro (   _name,
  show 
)    static struct cpuidle_state_attr attr_##_name = __ATTR(_name, 0444, show, NULL)

Definition at line 224 of file sysfs.c.

#define define_one_state_rw (   _name,
  show,
  store 
)    static struct cpuidle_state_attr attr_##_name = __ATTR(_name, 0644, show, store)

Definition at line 227 of file sysfs.c.

#define define_show_state_function (   _name)
Value:
static ssize_t show_state_##_name(struct cpuidle_state *state, \
struct cpuidle_state_usage *state_usage, char *buf) \
{ \
return sprintf(buf, "%u\n", state->_name);\
}

Definition at line 230 of file sysfs.c.

#define define_show_state_str_function (   _name)
Value:
static ssize_t show_state_##_name(struct cpuidle_state *state, \
struct cpuidle_state_usage *state_usage, char *buf) \
{ \
if (state->_name[0] == '\0')\
return sprintf(buf, "<null>\n");\
return sprintf(buf, "%s\n", state->_name);\
}

Definition at line 263 of file sysfs.c.

#define define_show_state_ull_function (   _name)
Value:
static ssize_t show_state_##_name(struct cpuidle_state *state, \
struct cpuidle_state_usage *state_usage, char *buf) \
{ \
return sprintf(buf, "%llu\n", state_usage->_name);\
}

Definition at line 256 of file sysfs.c.

#define define_store_state_ull_function (   _name)
Value:
static ssize_t store_state_##_name(struct cpuidle_state *state, \
struct cpuidle_state_usage *state_usage, \
const char *buf, size_t size) \
{ \
unsigned long long value; \
int err; \
return -EPERM; \
err = kstrtoull(buf, 0, &value); \
if (err) \
return err; \
if (value) \
state_usage->_name = 1; \
else \
state_usage->_name = 0; \
return size; \
}

Definition at line 237 of file sysfs.c.

#define kobj_to_cpuidledev (   k)    container_of(k, struct cpuidle_device, kobj)

Definition at line 168 of file sysfs.c.

#define kobj_to_state (   k)    (kobj_to_state_obj(k)->state)

Definition at line 301 of file sysfs.c.

#define kobj_to_state_obj (   k)    container_of(k, struct cpuidle_state_kobj, kobj)

Definition at line 300 of file sysfs.c.

#define kobj_to_state_usage (   k)    (kobj_to_state_obj(k)->state_usage)

Definition at line 302 of file sysfs.c.

Function Documentation

__setup ( "cpuidle_sysfs_switch"  ,
cpuidle_sysfs_setup   
)
int cpuidle_add_interface ( struct device dev)

cpuidle_add_interface - add CPU global sysfs attributes

Definition at line 141 of file sysfs.c.

int cpuidle_add_state_sysfs ( struct cpuidle_device device)

cpuidle_add_driver_sysfs - adds driver-specific sysfs attributes : the target device

Definition at line 362 of file sysfs.c.

int cpuidle_add_sysfs ( struct device cpu_dev)

cpuidle_add_sysfs - creates a sysfs instance for the target device : the target device

Definition at line 411 of file sysfs.c.

void cpuidle_remove_interface ( struct device dev)

cpuidle_remove_interface - remove CPU global sysfs attributes

Definition at line 152 of file sysfs.c.

void cpuidle_remove_state_sysfs ( struct cpuidle_device device)

cpuidle_remove_driver_sysfs - removes driver-specific sysfs attributes : the target device

Definition at line 399 of file sysfs.c.

void cpuidle_remove_sysfs ( struct device cpu_dev)

cpuidle_remove_sysfs - deletes a sysfs instance on the target device : the target device

Definition at line 429 of file sysfs.c.

define_show_state_function ( exit_latency  )

Definition at line 272 of file sysfs.c.