Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261781
b: refs/heads/master
c: 2cd005c
h: refs/heads/master
i:
  261779: 5e008c2
v: v3
  • Loading branch information
Dominik Brodowski committed Jul 29, 2011
1 parent 8fb3efc commit f86d56c
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 87 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: b510b54127a4d4112a9a3f200339719bcb463c15
refs/heads/master: 2cd005cac6d586b8ca324814a9c58ed0c08ffe40
8 changes: 4 additions & 4 deletions trunk/tools/power/cpupower/utils/helpers/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ static int get_cof(int family, union msr_pstate pstate)
if (family == 0x11)
t = 0x8;

return ((100 * (fid + t)) >> did);
}
return (100 * (fid + t)) >> did;
}

/* Needs:
* cpu -> the cpu that gets evaluated
Expand All @@ -74,7 +74,7 @@ int decode_pstates(unsigned int cpu, unsigned int cpu_family,
{
int i, psmax, pscur;
union msr_pstate pstate;
unsigned long long val;
unsigned long long val;

/* Only read out frequencies from HW when CPU might be boostable
to keep the code as short and clean as possible.
Expand All @@ -95,7 +95,7 @@ int decode_pstates(unsigned int cpu, unsigned int cpu_family,

pscur += boost_states;
psmax += boost_states;
for (i=0; i<=psmax; i++) {
for (i = 0; i <= psmax; i++) {
if (i >= MAX_HW_PSTATES) {
fprintf(stderr, "HW pstates [%d] exceeding max [%d]\n",
psmax, MAX_HW_PSTATES);
Expand Down
12 changes: 7 additions & 5 deletions trunk/tools/power/cpupower/utils/helpers/bitmask.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#define bitsperlong (8 * sizeof(unsigned long))

/* howmany(a,b) : how many elements of size b needed to hold all of a */
#define howmany(x,y) (((x)+((y)-1))/(y))
#define howmany(x, y) (((x)+((y)-1))/(y))

/* How many longs in mask of n bits */
#define longsperbits(n) howmany(n, bitsperlong)

#define max(a,b) ((a) > (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

/*
* Allocate and free `struct bitmask *`
Expand Down Expand Up @@ -73,7 +73,8 @@ static void _setbit(struct bitmask *bmp, unsigned int n, unsigned int v)
if (v)
bmp->maskp[n/bitsperlong] |= 1UL << (n % bitsperlong);
else
bmp->maskp[n/bitsperlong] &= ~(1UL << (n % bitsperlong));
bmp->maskp[n/bitsperlong] &=
~(1UL << (n % bitsperlong));
}
}

Expand Down Expand Up @@ -185,7 +186,7 @@ unsigned int bitmask_next(const struct bitmask *bmp, unsigned int i)
* 0-3 0,1,2,3
* 0-7:2 0,2,4,6
* 1,3,5-7 1,3,5,6,7
* 0-3:2,8-15:4 0,2,8,12
* 0-3:2,8-15:4 0,2,8,12
*/
int bitmask_parselist(const char *buf, struct bitmask *bmp)
{
Expand Down Expand Up @@ -251,7 +252,8 @@ static inline int emit(char *buf, int buflen, int rbot, int rtop, int len)
if (rbot == rtop)
len += snprintf(buf + len, max(buflen - len, 0), "%d", rbot);
else
len += snprintf(buf + len, max(buflen - len, 0), "%d-%d", rbot, rtop);
len += snprintf(buf + len, max(buflen - len, 0), "%d-%d",
rbot, rtop);
return len;
}

Expand Down
14 changes: 6 additions & 8 deletions trunk/tools/power/cpupower/utils/helpers/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,26 @@ int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info)
continue;
value[63 - 1] = '\0';

if (!strncmp(value, "processor\t: ", 12)) {
if (!strncmp(value, "processor\t: ", 12))
sscanf(value, "processor\t: %u", &proc);
}

if (proc != cpu)
continue;

/* Get CPU vendor */
if (!strncmp(value, "vendor_id", 9))
if (!strncmp(value, "vendor_id", 9)) {
for (x = 1; x < X86_VENDOR_MAX; x++) {
if (strstr(value, cpu_vendor_table[x]))
cpu_info->vendor = x;
}
/* Get CPU family, etc. */
else if (!strncmp(value, "cpu family\t: ", 13)) {
} else if (!strncmp(value, "cpu family\t: ", 13)) {
sscanf(value, "cpu family\t: %u",
&cpu_info->family);
}
else if (!strncmp(value, "model\t\t: ", 9)) {
} else if (!strncmp(value, "model\t\t: ", 9)) {
sscanf(value, "model\t\t: %u",
&cpu_info->model);
}
else if (!strncmp(value, "stepping\t: ", 10)) {
} else if (!strncmp(value, "stepping\t: ", 10)) {
sscanf(value, "stepping\t: %u",
&cpu_info->stepping);

Expand Down
6 changes: 3 additions & 3 deletions trunk/tools/power/cpupower/utils/helpers/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef gettext_noop
#define gettext_noop(String) String
#endif
#define N_(String) gettext_noop (String)
#define N_(String) gettext_noop(String)
/* Internationalization ****************************/

extern int run_as_root;
Expand All @@ -39,11 +39,11 @@ extern int be_verbose;
#define dprint(fmt, ...) { \
if (be_verbose) { \
fprintf(stderr, "%s: " fmt, \
__FUNCTION__, ##__VA_ARGS__); \
__func__, ##__VA_ARGS__); \
} \
}
#else
static inline void dprint(const char *fmt, ...) { }
static inline void dprint(const char *fmt, ...) { }
#endif
extern int be_verbose;
/* Global verbose (-v) stuff *********************************/
Expand Down
3 changes: 2 additions & 1 deletion trunk/tools/power/cpupower/utils/helpers/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#include "helpers/helpers.h"

int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int * states)
int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active,
int *states)
{
struct cpupower_cpu_info cpu_info;
int ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/power/cpupower/utils/helpers/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct pci_dev *pci_acc_init(struct pci_access **pacc, int vendor_id,

for (i = 0; dev_ids[i] != 0; i++) {
filter_nb_link.device = dev_ids[i];
for (device=(*pacc)->devices; device; device = device->next) {
for (device = (*pacc)->devices; device; device = device->next) {
if (pci_filter_match(&filter_nb_link, device))
return device;
}
Expand Down
Loading

0 comments on commit f86d56c

Please sign in to comment.