ACK: [PATCH 2/6] lib: add small helpers top get/set /sys/power/pm_debug_messages
Alex Hung
alex.hung at canonical.com
Fri Jun 8 01:12:14 UTC 2018
On 2018-06-07 07:05 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> This is required to twiddle this control sys entry for PM debugging
> messages when going into S3 and S4.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/include/fwts.h | 1 +
> src/lib/include/fwts_pm_debug.h | 25 ++++++++++++++++++
> src/lib/src/Makefile.am | 1 +
> src/lib/src/fwts_pm_debug.c | 47 +++++++++++++++++++++++++++++++++
> 4 files changed, 74 insertions(+)
> create mode 100644 src/lib/include/fwts_pm_debug.h
> create mode 100644 src/lib/src/fwts_pm_debug.c
>
> diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h
> index 9428814b..c3b43534 100644
> --- a/src/lib/include/fwts.h
> +++ b/src/lib/include/fwts.h
> @@ -128,5 +128,6 @@
> #include "fwts_pci.h"
> #include "fwts_safe_mem.h"
> #include "fwts_devicetree.h"
> +#include "fwts_pm_debug.h"
>
> #endif
> diff --git a/src/lib/include/fwts_pm_debug.h b/src/lib/include/fwts_pm_debug.h
> new file mode 100644
> index 00000000..fb5eed13
> --- /dev/null
> +++ b/src/lib/include/fwts_pm_debug.h
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2013-2018 Canonical
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> + *
> + */
> +#ifndef __FWTS_PM_DEBUG_H__
> +#define __FWTS_PM_DEBUG_H__
> +
> +int fwts_pm_debug_get(int *value);
> +int fwts_pm_debug_set(const int value);
> +
> +#endif
> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
> index fa232451..d067fe11 100644
> --- a/src/lib/src/Makefile.am
> +++ b/src/lib/src/Makefile.am
> @@ -104,4 +104,5 @@ libfwts_la_SOURCES = \
> fwts_wakealarm.c \
> fwts_pm_method.c \
> fwts_safe_mem.c \
> + fwts_pm_debug.c \
> $(dt_sources)
> diff --git a/src/lib/src/fwts_pm_debug.c b/src/lib/src/fwts_pm_debug.c
> new file mode 100644
> index 00000000..861c6748
> --- /dev/null
> +++ b/src/lib/src/fwts_pm_debug.c
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright (C) 2018 Canonical
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> + *
> + */
> +
> +#include "fwts.h"
> +
> +static const char pm_debug[] = "/sys/power/pm_debug_messages";
> +
> +/*
> + * fwts_pm_debug_get
> + * get the current pm_debug_messages setting, value
> + * is also set to -1 if there is an error
> + */
> +int fwts_pm_debug_get(int *value)
> +{
> + int ret;
> +
> + ret = fwts_get_int(pm_debug, value);
> + if (ret != FWTS_OK)
> + *value = -1;
> +
> + return ret;
> +}
> +
> +/*
> + * fwts_pm_debug_set
> + * set the pm_debug_messages setting
> + */
> +int fwts_pm_debug_set(const int value)
> +{
> + return fwts_set_int(pm_debug, value);
> +}
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list