Re: [dpdk-dev] [PATCH 21.08] power: refactor pstate sysfs handling

2021-04-06 Thread Burakov, Anatoly
On 02-Apr-21 6:45 PM, Stephen Hemminger wrote: On Thu, 1 Apr 2021 15:05:17 + Anatoly Burakov wrote: +#define FOPEN_OR_ERR_GOTO(f, label) do { \ + if ((f) == NULL) { \ + RTE_LOG(ERR, POWER, "File not opened\n"); \ + goto label; \

Re: [dpdk-dev] [PATCH 21.08] power: refactor pstate sysfs handling

2021-04-06 Thread Burakov, Anatoly
On 02-Apr-21 6:46 PM, Stephen Hemminger wrote: On Thu, 1 Apr 2021 15:05:17 + Anatoly Burakov wrote: + /* fgets puts null terminator in, but do this just in case */ + buf[BUFSIZ - 1] = '\0'; + + /* strip off any terminating newlines */ + if (strlen(buf)) +

Re: [dpdk-dev] [PATCH 21.08] power: refactor pstate sysfs handling

2021-04-02 Thread Stephen Hemminger
On Thu, 1 Apr 2021 15:05:17 + Anatoly Burakov wrote: > + /* fgets puts null terminator in, but do this just in case */ > + buf[BUFSIZ - 1] = '\0'; > + > + /* strip off any terminating newlines */ > + if (strlen(buf)) > + strtok(buf, "\n"); Why not the simpler/sho

Re: [dpdk-dev] [PATCH 21.08] power: refactor pstate sysfs handling

2021-04-02 Thread Stephen Hemminger
On Thu, 1 Apr 2021 15:05:17 + Anatoly Burakov wrote: > > +#define FOPEN_OR_ERR_GOTO(f, label) do { \ > + if ((f) == NULL) { \ > + RTE_LOG(ERR, POWER, "File not opened\n"); \ > + goto label; \ > + } \ > +} while (0) > + I am n

[dpdk-dev] [PATCH 21.08] power: refactor pstate sysfs handling

2021-04-01 Thread Anatoly Burakov
Currently, pstate sysfs handling code is a bit of an unmaintainable mess, which has contributed to various errors leading to bugs. Refactor the code in a way that makes it more maintainable and less error prone. Signed-off-by: Anatoly Burakov --- lib/librte_power/meson.build| 7 +