LCOV - code coverage report
Current view: top level - drivers/thermal - user_space.c (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 14 0.0 %
Date: 2022-04-01 14:17:54 Functions: 0 1 0.0 %
Branches: 0 2 0.0 %

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: GPL-2.0-only
       2                 :            : /*
       3                 :            :  *  user_space.c - A simple user space Thermal events notifier
       4                 :            :  *
       5                 :            :  *  Copyright (C) 2012 Intel Corp
       6                 :            :  *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
       7                 :            :  *
       8                 :            :  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       9                 :            :  *
      10                 :            :  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      11                 :            :  */
      12                 :            : 
      13                 :            : #include <linux/thermal.h>
      14                 :            : #include <linux/slab.h>
      15                 :            : 
      16                 :            : #include "thermal_core.h"
      17                 :            : 
      18                 :            : /**
      19                 :            :  * notify_user_space - Notifies user space about thermal events
      20                 :            :  * @tz: thermal_zone_device
      21                 :            :  * @trip: trip point index
      22                 :            :  *
      23                 :            :  * This function notifies the user space through UEvents.
      24                 :            :  */
      25                 :          0 : static int notify_user_space(struct thermal_zone_device *tz, int trip)
      26                 :            : {
      27                 :          0 :         char *thermal_prop[5];
      28                 :          0 :         int i;
      29                 :            : 
      30                 :          0 :         mutex_lock(&tz->lock);
      31                 :          0 :         thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", tz->type);
      32                 :          0 :         thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", tz->temperature);
      33                 :          0 :         thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=%d", trip);
      34                 :          0 :         thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", tz->notify_event);
      35                 :          0 :         thermal_prop[4] = NULL;
      36                 :          0 :         kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, thermal_prop);
      37         [ #  # ]:          0 :         for (i = 0; i < 4; ++i)
      38                 :          0 :                 kfree(thermal_prop[i]);
      39                 :          0 :         mutex_unlock(&tz->lock);
      40                 :          0 :         return 0;
      41                 :            : }
      42                 :            : 
      43                 :            : static struct thermal_governor thermal_gov_user_space = {
      44                 :            :         .name           = "user_space",
      45                 :            :         .throttle       = notify_user_space,
      46                 :            : };
      47                 :            : THERMAL_GOVERNOR_DECLARE(thermal_gov_user_space);

Generated by: LCOV version 1.14