Skip to content

Commit f96c8e5

Browse files
idlethreaddlezcano
authored andcommitted
thermal: Remove netlink support
There are no users of netlink messages for thermal inside the kernel. Remove the code and adjust the documentation. Signed-off-by: Amit Kucheria <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/8ff02cf62186c7a54fff325fad40a2e9ca3affa6.1571656014.git.amit.kucheria@linaro.org
1 parent da73f9b commit f96c8e5

File tree

3 files changed

+7
-131
lines changed

3 files changed

+7
-131
lines changed

Documentation/driver-api/thermal/sysfs-api.rst

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -725,24 +725,10 @@ method, the sys I/F structure will be built like this::
725725
|---temp1_input: 37000
726726
|---temp1_crit: 100000
727727

728-
4. Event Notification
728+
4. Export Symbol APIs
729729
=====================
730730

731-
The framework includes a simple notification mechanism, in the form of a
732-
netlink event. Netlink socket initialization is done during the _init_
733-
of the framework. Drivers which intend to use the notification mechanism
734-
just need to call thermal_generate_netlink_event() with two arguments viz
735-
(originator, event). The originator is a pointer to struct thermal_zone_device
736-
from where the event has been originated. An integer which represents the
737-
thermal zone device will be used in the message to identify the zone. The
738-
event will be one of:{THERMAL_AUX0, THERMAL_AUX1, THERMAL_CRITICAL,
739-
THERMAL_DEV_FAULT}. Notification can be sent when the current temperature
740-
crosses any of the configured thresholds.
741-
742-
5. Export Symbol APIs
743-
=====================
744-
745-
5.1. get_tz_trend
731+
4.1. get_tz_trend
746732
-----------------
747733

748734
This function returns the trend of a thermal zone, i.e the rate of change
@@ -751,14 +737,14 @@ are supposed to implement the callback. If they don't, the thermal
751737
framework calculated the trend by comparing the previous and the current
752738
temperature values.
753739

754-
5.2. get_thermal_instance
740+
4.2. get_thermal_instance
755741
-------------------------
756742

757743
This function returns the thermal_instance corresponding to a given
758744
{thermal_zone, cooling_device, trip_point} combination. Returns NULL
759745
if such an instance does not exist.
760746

761-
5.3. thermal_notify_framework
747+
4.3. thermal_notify_framework
762748
-----------------------------
763749

764750
This function handles the trip events from sensor drivers. It starts
@@ -768,14 +754,14 @@ and does actual throttling for other trip points i.e ACTIVE and PASSIVE.
768754
The throttling policy is based on the configured platform data; if no
769755
platform data is provided, this uses the step_wise throttling policy.
770756

771-
5.4. thermal_cdev_update
757+
4.4. thermal_cdev_update
772758
------------------------
773759

774760
This function serves as an arbitrator to set the state of a cooling
775761
device. It sets the cooling device to the deepest cooling state if
776762
possible.
777763

778-
6. thermal_emergency_poweroff
764+
5. thermal_emergency_poweroff
779765
=============================
780766

781767
On an event of critical trip temperature crossing. Thermal framework

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <linux/reboot.h>
2020
#include <linux/string.h>
2121
#include <linux/of.h>
22-
#include <net/netlink.h>
23-
#include <net/genetlink.h>
2422
#include <linux/suspend.h>
2523

2624
#define CREATE_TRACE_POINTS
@@ -1464,97 +1462,6 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name)
14641462
}
14651463
EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name);
14661464

1467-
#ifdef CONFIG_NET
1468-
static const struct genl_multicast_group thermal_event_mcgrps[] = {
1469-
{ .name = THERMAL_GENL_MCAST_GROUP_NAME, },
1470-
};
1471-
1472-
static struct genl_family thermal_event_genl_family __ro_after_init = {
1473-
.module = THIS_MODULE,
1474-
.name = THERMAL_GENL_FAMILY_NAME,
1475-
.version = THERMAL_GENL_VERSION,
1476-
.maxattr = THERMAL_GENL_ATTR_MAX,
1477-
.mcgrps = thermal_event_mcgrps,
1478-
.n_mcgrps = ARRAY_SIZE(thermal_event_mcgrps),
1479-
};
1480-
1481-
int thermal_generate_netlink_event(struct thermal_zone_device *tz,
1482-
enum events event)
1483-
{
1484-
struct sk_buff *skb;
1485-
struct nlattr *attr;
1486-
struct thermal_genl_event *thermal_event;
1487-
void *msg_header;
1488-
int size;
1489-
int result;
1490-
static unsigned int thermal_event_seqnum;
1491-
1492-
if (!tz)
1493-
return -EINVAL;
1494-
1495-
/* allocate memory */
1496-
size = nla_total_size(sizeof(struct thermal_genl_event)) +
1497-
nla_total_size(0);
1498-
1499-
skb = genlmsg_new(size, GFP_ATOMIC);
1500-
if (!skb)
1501-
return -ENOMEM;
1502-
1503-
/* add the genetlink message header */
1504-
msg_header = genlmsg_put(skb, 0, thermal_event_seqnum++,
1505-
&thermal_event_genl_family, 0,
1506-
THERMAL_GENL_CMD_EVENT);
1507-
if (!msg_header) {
1508-
nlmsg_free(skb);
1509-
return -ENOMEM;
1510-
}
1511-
1512-
/* fill the data */
1513-
attr = nla_reserve(skb, THERMAL_GENL_ATTR_EVENT,
1514-
sizeof(struct thermal_genl_event));
1515-
1516-
if (!attr) {
1517-
nlmsg_free(skb);
1518-
return -EINVAL;
1519-
}
1520-
1521-
thermal_event = nla_data(attr);
1522-
if (!thermal_event) {
1523-
nlmsg_free(skb);
1524-
return -EINVAL;
1525-
}
1526-
1527-
memset(thermal_event, 0, sizeof(struct thermal_genl_event));
1528-
1529-
thermal_event->orig = tz->id;
1530-
thermal_event->event = event;
1531-
1532-
/* send multicast genetlink message */
1533-
genlmsg_end(skb, msg_header);
1534-
1535-
result = genlmsg_multicast(&thermal_event_genl_family, skb, 0,
1536-
0, GFP_ATOMIC);
1537-
if (result)
1538-
dev_err(&tz->device, "Failed to send netlink event:%d", result);
1539-
1540-
return result;
1541-
}
1542-
EXPORT_SYMBOL_GPL(thermal_generate_netlink_event);
1543-
1544-
static int __init genetlink_init(void)
1545-
{
1546-
return genl_register_family(&thermal_event_genl_family);
1547-
}
1548-
1549-
static void genetlink_exit(void)
1550-
{
1551-
genl_unregister_family(&thermal_event_genl_family);
1552-
}
1553-
#else /* !CONFIG_NET */
1554-
static inline int genetlink_init(void) { return 0; }
1555-
static inline void genetlink_exit(void) {}
1556-
#endif /* !CONFIG_NET */
1557-
15581465
static int thermal_pm_notify(struct notifier_block *nb,
15591466
unsigned long mode, void *_unused)
15601467
{
@@ -1607,13 +1514,9 @@ static int __init thermal_init(void)
16071514
if (result)
16081515
goto unregister_governors;
16091516

1610-
result = genetlink_init();
1611-
if (result)
1612-
goto unregister_class;
1613-
16141517
result = of_parse_thermal_zones();
16151518
if (result)
1616-
goto exit_netlink;
1519+
goto unregister_class;
16171520

16181521
result = register_pm_notifier(&thermal_pm_nb);
16191522
if (result)
@@ -1622,8 +1525,6 @@ static int __init thermal_init(void)
16221525

16231526
return 0;
16241527

1625-
exit_netlink:
1626-
genetlink_exit();
16271528
unregister_class:
16281529
class_unregister(&thermal_class);
16291530
unregister_governors:

include/linux/thermal.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -544,15 +544,4 @@ static inline void thermal_notify_framework(struct thermal_zone_device *tz,
544544
{ }
545545
#endif /* CONFIG_THERMAL */
546546

547-
#if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL)
548-
extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
549-
enum events event);
550-
#else
551-
static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
552-
enum events event)
553-
{
554-
return 0;
555-
}
556-
#endif
557-
558547
#endif /* __THERMAL_H__ */

0 commit comments

Comments
 (0)