Skip to content

Commit

Permalink
Merge branches 'pm-sleep' and 'pm-tools'
Browse files Browse the repository at this point in the history
* pm-sleep:
  PM / sleep: Add support for read-only sysfs attributes

* pm-tools:
  cpupower: fix how "cpupower frequency-info" interprets latency
  cpupower: rework the "cpupower frequency-info" command
  cpupower: Do not analyse offlined cpus
  cpupower: Provide STATIC variable in Makefile for debug builds
  cpupower: Fix precedence issue
  • Loading branch information
rafaeljw committed Jan 12, 2016
3 parents 9326806 + a1e9ca6 + e98f033 commit 8f053a5
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 179 deletions.
17 changes: 2 additions & 15 deletions kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,7 @@ static ssize_t pm_wakeup_irq_show(struct kobject *kobj,
return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA;
}

static ssize_t pm_wakeup_irq_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t n)
{
return -EINVAL;
}
power_attr(pm_wakeup_irq);
power_attr_ro(pm_wakeup_irq);

#else /* !CONFIG_PM_SLEEP_DEBUG */
static inline void pm_print_times_init(void) {}
Expand Down Expand Up @@ -564,14 +558,7 @@ static ssize_t pm_trace_dev_match_show(struct kobject *kobj,
return show_trace_dev_match(buf, PAGE_SIZE);
}

static ssize_t
pm_trace_dev_match_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n)
{
return -EINVAL;
}

power_attr(pm_trace_dev_match);
power_attr_ro(pm_trace_dev_match);

#endif /* CONFIG_PM_TRACE */

Expand Down
9 changes: 9 additions & 0 deletions kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ static struct kobj_attribute _name##_attr = { \
.store = _name##_store, \
}

#define power_attr_ro(_name) \
static struct kobj_attribute _name##_attr = { \
.attr = { \
.name = __stringify(_name), \
.mode = S_IRUGO, \
}, \
.show = _name##_show, \
}

/* Preferred image size in bytes (default 500 MB) */
extern unsigned long image_size;
/* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */
Expand Down
19 changes: 19 additions & 0 deletions tools/power/cpupower/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ NLS ?= true
# cpufreq-bench benchmarking tool
CPUFREQ_BENCH ?= true

# Do not build libraries, but build the code in statically
# Libraries are still built, otherwise the Makefile code would
# be rather ugly.
export STATIC ?= false

# Prefix to the directories we're installing to
DESTDIR ?=

Expand Down Expand Up @@ -161,6 +166,12 @@ ifeq ($(strip $(CPUFREQ_BENCH)),true)
COMPILE_BENCH += compile-bench
endif

ifeq ($(strip $(STATIC)),true)
UTIL_OBJS += $(LIB_OBJS)
UTIL_HEADERS += $(LIB_HEADERS)
UTIL_SRC += $(LIB_SRC)
endif

CFLAGS += $(WARNINGS)

ifeq ($(strip $(V)),false)
Expand Down Expand Up @@ -209,7 +220,11 @@ $(OUTPUT)%.o: %.c

$(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)libcpupower.so.$(LIB_MAJ)
$(ECHO) " CC " $@
ifeq ($(strip $(STATIC)),true)
$(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lrt -lpci -L$(OUTPUT) -o $@
else
$(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@
endif
$(QUIET) $(STRIPCMD) $@

$(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
Expand Down Expand Up @@ -291,7 +306,11 @@ install-bench:
@#DESTDIR must be set from outside to survive
@sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) install

ifeq ($(strip $(STATIC)),true)
install: all install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH)
else
install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH)
endif

uninstall:
- rm -f $(DESTDIR)${libdir}/libcpupower.*
Expand Down
8 changes: 7 additions & 1 deletion tools/power/cpupower/bench/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ ifneq ($(O),)
endif
endif

ifeq ($(strip $(STATIC)),true)
LIBS = -L../ -L$(OUTPUT) -lm
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
$(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o
else
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower

OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
endif

CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\"

$(OUTPUT)%.o : %.c
Expand Down
Loading

0 comments on commit 8f053a5

Please sign in to comment.