Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp513385ybh; Tue, 21 Jul 2020 00:34:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGFRlqjOqxDD3KX/NN6PDJICQcLHZnQrvH9UeQe+VmJ3tw/cORV4yR8Qdrc3GulfA4beRl X-Received: by 2002:a17:906:7c8:: with SMTP id m8mr23973947ejc.527.1595316884241; Tue, 21 Jul 2020 00:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595316884; cv=none; d=google.com; s=arc-20160816; b=iB8sfX9Eq9pCLrxMidNUcAhixJ0roQwClJnKiQkjG3jsHV1J4vAcbOKfNgkbI32gp6 ddBOETzk1283pjbF5WOjjmcyPrCMQjlJuzvx9Ohcu2nVhVl9waT9w+bxSQYAB9bLwGhK j5P0Yw2z85m1Tyeba2nOyQuyeHw7EMVbol6fv10idQ6XcqDaZCZk7PNrTLLz70b35D4l Y+fFIzCvdqb48AkWEsG1sial7P0VuUycxMmqJiEZLB+9nZI68+U0RQqCz9vKXhAKrvZn +sPZdEhhjRWnh/S5abuhgDTp1nd1r4SBjQi9UzuKLcToWi2Ebm+39iyFWk20GZ62nULk 11EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+t/pnEQ4NNsqTluf7AOakEjbmVq5C7q3xQXEC/0fJBA=; b=aHlJtbwxYIlqzGswK9rHDXlAUu1KJ9aWyQQSKd5jcDOm4gp5wVxwxo+a5UfmTE2RFF 0UD+eb6N9hxsr7vm1M7fNThF2dT0Y4r2mhU3Cco/lhgvNS+U4PcMwjZvLxYqH7Euy5iA xjnA27X5ZRhU77P4V1Akc1U2DIMXXle+eaC7oPDWtqASvbwcNPB60iD5f4Et8NhIC0lS waKcnkn7vuRSAQonWl89kargX4pUhw9c3LeXXS3FMqCHxPQHD/W9BYjzWR+N+ev3LjT1 vDJYdjMI6mxYEnDn83rrd+x4AhnfWT4wN+a6akwVcLuXm/RTURfbl5Ck3950miIVaa+C J7lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hKVAoug+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lf11si12451776ejb.475.2020.07.21.00.34.21; Tue, 21 Jul 2020 00:34:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hKVAoug+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbgGUHdR (ORCPT + 99 others); Tue, 21 Jul 2020 03:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbgGUHdQ (ORCPT ); Tue, 21 Jul 2020 03:33:16 -0400 Received: from mail-ua1-x942.google.com (mail-ua1-x942.google.com [IPv6:2607:f8b0:4864:20::942]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FD38C0619D6 for ; Tue, 21 Jul 2020 00:33:16 -0700 (PDT) Received: by mail-ua1-x942.google.com with SMTP id k7so5891580uan.13 for ; Tue, 21 Jul 2020 00:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+t/pnEQ4NNsqTluf7AOakEjbmVq5C7q3xQXEC/0fJBA=; b=hKVAoug+rm4SkarqQwzg/++fjVRG4oiIPogO8e0bICWCuEXK/kE+OzQGD7MJfE5ch/ 9s6NoIXjhs92TDnSItNmYR39osn/gMrY8f2oC4JsK/WQ3A2nFXYdLxp5iESP6VD3efKj 5h+7CrLcyKOsNrvrJf+mwowor5kfNx4dVkBTkNPU6GQx+cwhDyquhLWnS/E9c6IYFPnL /RNNJesXGMk+Sq3Sz1unfPGmKyXBd0mQhMAUEj7hyO+N2KF/81xHxrFPpld4xUjtUZel fkr1Yk3IgBofZgiW66pVvhpKHoKIVAz1vBc2eFn5kjE1TIz2ylvmLj7LnMPLty9tTu77 Wheg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+t/pnEQ4NNsqTluf7AOakEjbmVq5C7q3xQXEC/0fJBA=; b=F0RtMHBqZ2g3StqsjabFFpYVhJ7xQDxiQfhsQ8vszAt4mAjo7DrmHsrPvwL0FJn6k7 dge4V/BHWNPedW0qdI1xejF50hKbGflvcNnbdvVDAJqAsZbqk/nGv70YqZuMzO5kPK3f Sv5cphG9M8Ad7WUwBnd3j4cen2HlunSscUPBpJdntVbQ7EzwECaZeipl83JYZKiMGi19 FuBSxQ3t2tXrMy8OInrszerRBqlwxg5WE8orlpef9fmdC9T69T3PxZyvRfWF0LJGhM35 MRq6W0z+ISQHtnCY/pTZRZ7CxIgAwwry2hpVFpG+rV1SMCiM2VQKapSeMBspL1ke8C5R gD+Q== X-Gm-Message-State: AOAM530Ja670qormJZGFR0Vq+8QEOYzEE9wfsHn8a2Ysah+yK+l5Bx0l TIG3uINnEcPSBlND2UwuFKRh7e5J9Gr2r1c+Nq1N6g== X-Received: by 2002:ab0:1167:: with SMTP id g39mr18207671uac.60.1595316795342; Tue, 21 Jul 2020 00:33:15 -0700 (PDT) MIME-Version: 1.0 References: <20200707090159.1018-1-daniel.lezcano@linaro.org> In-Reply-To: <20200707090159.1018-1-daniel.lezcano@linaro.org> From: Amit Kucheria Date: Tue, 21 Jul 2020 13:03:04 +0530 Message-ID: Subject: Re: [PATCH] thermal: netlink: Fix compilation error when CONFIG_NET=n To: Daniel Lezcano Cc: Zhang Rui , LKML , Linux PM list , rdunlap@infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 7, 2020 at 2:32 PM Daniel Lezcano wrote: > > When the network is not configured, the netlink are disabled on all > the system. The thermal framework assumed the netlink are always nit: s/are/is/ in both places above > opt-in. > > Fix this by adding a Kconfig option for the netlink notification, > defaulting to yes and depending on CONFIG_NET. > > As the change implies multiple stubs and in order to not pollute the > internal thermal header, the thermal_nelink.h has been added and > included in the thermal_core.h, so this one regain some kind of > clarity. > > Reported-by: Randy Dunlap > Signed-off-by: Daniel Lezcano Reviewed-by: Amit Kucheria > --- > drivers/thermal/Kconfig | 10 ++++ > drivers/thermal/Makefile | 5 +- > drivers/thermal/thermal_core.h | 20 +------ > drivers/thermal/thermal_netlink.h | 98 +++++++++++++++++++++++++++++++ > 4 files changed, 114 insertions(+), 19 deletions(-) > create mode 100644 drivers/thermal/thermal_netlink.h > > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > index 3eb2348e5242..07983bef8d6a 100644 > --- a/drivers/thermal/Kconfig > +++ b/drivers/thermal/Kconfig > @@ -17,6 +17,16 @@ menuconfig THERMAL > > if THERMAL > > +config THERMAL_NETLINK > + bool "Thermal netlink management" > + depends on NET > + default y > + help > + The thermal framework has a netlink interface to do thermal > + zones discovery, temperature readings and events such as > + trip point crossed, cooling device update or governor > + change. It is recommended to enable the feature. > + > config THERMAL_STATISTICS > bool "Thermal state transition statistics" > help > diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile > index 1bbf0805fb04..589f6fb0d381 100644 > --- a/drivers/thermal/Makefile > +++ b/drivers/thermal/Makefile > @@ -5,7 +5,10 @@ > > obj-$(CONFIG_THERMAL) += thermal_sys.o > thermal_sys-y += thermal_core.o thermal_sysfs.o \ > - thermal_helpers.o thermal_netlink.o > + thermal_helpers.o > + > +# netlink interface to manage the thermal framework > +thermal_sys-$(CONFIG_THERMAL_NETLINK) += thermal_netlink.o > > # interface to/from other layers providing sensors > thermal_sys-$(CONFIG_THERMAL_HWMON) += thermal_hwmon.o > diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h > index b44969d50ec0..99d065e6ed08 100644 > --- a/drivers/thermal/thermal_core.h > +++ b/drivers/thermal/thermal_core.h > @@ -12,6 +12,8 @@ > #include > #include > > +#include "thermal_netlink.h" > + > /* Default Thermal Governor */ > #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) > #define DEFAULT_THERMAL_GOVERNOR "step_wise" > @@ -52,24 +54,6 @@ int for_each_thermal_governor(int (*cb)(struct thermal_governor *, void *), > > struct thermal_zone_device *thermal_zone_get_by_id(int id); > > -/* Netlink notification function */ > -int thermal_notify_tz_create(int tz_id, const char *name); > -int thermal_notify_tz_delete(int tz_id); > -int thermal_notify_tz_enable(int tz_id); > -int thermal_notify_tz_disable(int tz_id); > -int thermal_notify_tz_trip_down(int tz_id, int id); > -int thermal_notify_tz_trip_up(int tz_id, int id); > -int thermal_notify_tz_trip_delete(int tz_id, int id); > -int thermal_notify_tz_trip_add(int tz_id, int id, int type, > - int temp, int hyst); > -int thermal_notify_tz_trip_change(int tz_id, int id, int type, > - int temp, int hyst); > -int thermal_notify_cdev_state_update(int cdev_id, int state); > -int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state); > -int thermal_notify_cdev_delete(int cdev_id); > -int thermal_notify_tz_gov_change(int tz_id, const char *name); > -int thermal_genl_sampling_temp(int id, int temp); > - > struct thermal_attr { > struct device_attribute attr; > char name[THERMAL_NAME_LENGTH]; > diff --git a/drivers/thermal/thermal_netlink.h b/drivers/thermal/thermal_netlink.h > new file mode 100644 > index 000000000000..0ec28d105da5 > --- /dev/null > +++ b/drivers/thermal/thermal_netlink.h > @@ -0,0 +1,98 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) Linaro Ltd 2020 > + * Author: Daniel Lezcano > + */ > + > +/* Netlink notification function */ > +#ifdef CONFIG_THERMAL_NETLINK > +int thermal_notify_tz_create(int tz_id, const char *name); > +int thermal_notify_tz_delete(int tz_id); > +int thermal_notify_tz_enable(int tz_id); > +int thermal_notify_tz_disable(int tz_id); > +int thermal_notify_tz_trip_down(int tz_id, int id); > +int thermal_notify_tz_trip_up(int tz_id, int id); > +int thermal_notify_tz_trip_delete(int tz_id, int id); > +int thermal_notify_tz_trip_add(int tz_id, int id, int type, > + int temp, int hyst); > +int thermal_notify_tz_trip_change(int tz_id, int id, int type, > + int temp, int hyst); > +int thermal_notify_cdev_state_update(int cdev_id, int state); > +int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state); > +int thermal_notify_cdev_delete(int cdev_id); > +int thermal_notify_tz_gov_change(int tz_id, const char *name); > +int thermal_genl_sampling_temp(int id, int temp); > +#else > +static inline int thermal_notify_tz_create(int tz_id, const char *name) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_delete(int tz_id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_enable(int tz_id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_disable(int tz_id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_trip_down(int tz_id, int id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_trip_up(int tz_id, int id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_trip_delete(int tz_id, int id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type, > + int temp, int hyst) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type, > + int temp, int hyst) > +{ > + return 0; > +} > + > +static inline int thermal_notify_cdev_state_update(int cdev_id, int state) > +{ > + return 0; > +} > + > +static inline int thermal_notify_cdev_add(int cdev_id, const char *name, > + int max_state) > +{ > + return 0; > +} > + > +static inline int thermal_notify_cdev_delete(int cdev_id) > +{ > + return 0; > +} > + > +static inline int thermal_notify_tz_gov_change(int tz_id, const char *name) > +{ > + return 0; > +} > + > +static inline int thermal_genl_sampling_temp(int id, int temp) > +{ > + return 0; > +} > +#endif /* CONFIG_THERMAL_NETLINK */ > -- > 2.17.1 >