Skip to content

Commit 8f053a5

Browse files
committed
Merge branches 'pm-sleep' and 'pm-tools'
* 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
3 parents 9326806 + a1e9ca6 + e98f033 commit 8f053a5

File tree

9 files changed

+157
-179
lines changed

9 files changed

+157
-179
lines changed

kernel/power/main.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,7 @@ static ssize_t pm_wakeup_irq_show(struct kobject *kobj,
280280
return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA;
281281
}
282282

283-
static ssize_t pm_wakeup_irq_store(struct kobject *kobj,
284-
struct kobj_attribute *attr,
285-
const char *buf, size_t n)
286-
{
287-
return -EINVAL;
288-
}
289-
power_attr(pm_wakeup_irq);
283+
power_attr_ro(pm_wakeup_irq);
290284

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

567-
static ssize_t
568-
pm_trace_dev_match_store(struct kobject *kobj, struct kobj_attribute *attr,
569-
const char *buf, size_t n)
570-
{
571-
return -EINVAL;
572-
}
573-
574-
power_attr(pm_trace_dev_match);
561+
power_attr_ro(pm_trace_dev_match);
575562

576563
#endif /* CONFIG_PM_TRACE */
577564

kernel/power/power.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ static struct kobj_attribute _name##_attr = { \
7777
.store = _name##_store, \
7878
}
7979

80+
#define power_attr_ro(_name) \
81+
static struct kobj_attribute _name##_attr = { \
82+
.attr = { \
83+
.name = __stringify(_name), \
84+
.mode = S_IRUGO, \
85+
}, \
86+
.show = _name##_show, \
87+
}
88+
8089
/* Preferred image size in bytes (default 500 MB) */
8190
extern unsigned long image_size;
8291
/* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */

tools/power/cpupower/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ NLS ?= true
4747
# cpufreq-bench benchmarking tool
4848
CPUFREQ_BENCH ?= true
4949

50+
# Do not build libraries, but build the code in statically
51+
# Libraries are still built, otherwise the Makefile code would
52+
# be rather ugly.
53+
export STATIC ?= false
54+
5055
# Prefix to the directories we're installing to
5156
DESTDIR ?=
5257

@@ -161,6 +166,12 @@ ifeq ($(strip $(CPUFREQ_BENCH)),true)
161166
COMPILE_BENCH += compile-bench
162167
endif
163168

169+
ifeq ($(strip $(STATIC)),true)
170+
UTIL_OBJS += $(LIB_OBJS)
171+
UTIL_HEADERS += $(LIB_HEADERS)
172+
UTIL_SRC += $(LIB_SRC)
173+
endif
174+
164175
CFLAGS += $(WARNINGS)
165176

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

210221
$(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)libcpupower.so.$(LIB_MAJ)
211222
$(ECHO) " CC " $@
223+
ifeq ($(strip $(STATIC)),true)
224+
$(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lrt -lpci -L$(OUTPUT) -o $@
225+
else
212226
$(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@
227+
endif
213228
$(QUIET) $(STRIPCMD) $@
214229

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

309+
ifeq ($(strip $(STATIC)),true)
310+
install: all install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH)
311+
else
294312
install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH)
313+
endif
295314

296315
uninstall:
297316
- rm -f $(DESTDIR)${libdir}/libcpupower.*

tools/power/cpupower/bench/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ ifneq ($(O),)
55
endif
66
endif
77

8+
ifeq ($(strip $(STATIC)),true)
9+
LIBS = -L../ -L$(OUTPUT) -lm
10+
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
11+
$(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o
12+
else
813
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
9-
1014
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
15+
endif
16+
1117
CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\"
1218

1319
$(OUTPUT)%.o : %.c

0 commit comments

Comments
 (0)