lkml.org 
[lkml]   [2022]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 1/4] tools/lib/thermal: Add a thermal library
From
Date
On Mon, 2022-02-14 at 22:04 +0100, Daniel Lezcano wrote:
> The thermal framework implements a netlink notification mechanism to
> be used by the userspace to have a thermal configuration discovery,
> trip point changes or violation, cooling device changes
> notifications,
> etc...
>
> This library provides a level of abstraction for the thermal netlink
> notification allowing the userspace to connect to the notification
> mechanism more easily. The library is callback oriented.
>
Some minor comments.
May be better use some defines instead of returning "-1" for error
conditions.
>

[...]

> +struct thermal_zone *thermal_zone_find_by_name(struct thermal_zone
> *tz,
> +                                              const char *name)
> +{
> +       int i;
> +
> +       if (!name)
> +               return NULL;
> +       
> +       for (i = 0; tz[i].id != -1; i++) {
> +               if (!strcmp(tz[i].name, name))
strncmp

> +                       return &tz[i];
> +       }
> +
> +       return NULL;
> +}
> +
>

[...]

> diff --git a/tools/lib/thermal/thermal_nl.h
> b/tools/lib/thermal/thermal_nl.h
> new file mode 100644
> index 000000000000..54dbbad58349
> --- /dev/null
> +++ b/tools/lib/thermal/thermal_nl.h
> @@ -0,0 +1,43 @@
> +/* SPDX-License-Identifier: LGPL-2.1+ */
> +/* Copyright (C) 2022, Linaro Ltd - Daniel Lezcano
> <daniel.lezcano@linaro.org> */
> +#ifndef __THERMAL_H
> +#define __THERMAL_H
__THERMAL_NL_H


>
[...]

> +/*
> + * Low level netlink
> + */
> +extern int nl_subscribe_thermal(struct nl_sock *nl_sock, struct
> nl_cb *nl_cb,
> +                               const char *group);
> +
To complete API, don't we need nl_unsubscribe which calls
nl_socket_drop_memberships()?


Thanks,
Srinivas

\
 
 \ /
  Last update: 2022-02-16 17:42    [W:0.157 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site