Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <amit.kucheria@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/8ff02cf62186c7a54fff325fad40a2e9ca3affa6.1571656014.git.amit.kucheria@linaro.org

authored by

Amit Kucheria and committed by
Daniel Lezcano
f96c8e50 da73f9b8

+7 -131
+6 -20
Documentation/driver-api/thermal/sysfs-api.rst
··· 725 725 |---temp1_input: 37000 726 726 |---temp1_crit: 100000 727 727 728 - 4. Event Notification 728 + 4. Export Symbol APIs 729 729 ===================== 730 730 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 746 732 ----------------- 747 733 748 734 This function returns the trend of a thermal zone, i.e the rate of change ··· 737 751 framework calculated the trend by comparing the previous and the current 738 752 temperature values. 739 753 740 - 5.2. get_thermal_instance 754 + 4.2. get_thermal_instance 741 755 ------------------------- 742 756 743 757 This function returns the thermal_instance corresponding to a given 744 758 {thermal_zone, cooling_device, trip_point} combination. Returns NULL 745 759 if such an instance does not exist. 746 760 747 - 5.3. thermal_notify_framework 761 + 4.3. thermal_notify_framework 748 762 ----------------------------- 749 763 750 764 This function handles the trip events from sensor drivers. It starts ··· 754 768 The throttling policy is based on the configured platform data; if no 755 769 platform data is provided, this uses the step_wise throttling policy. 756 770 757 - 5.4. thermal_cdev_update 771 + 4.4. thermal_cdev_update 758 772 ------------------------ 759 773 760 774 This function serves as an arbitrator to set the state of a cooling 761 775 device. It sets the cooling device to the deepest cooling state if 762 776 possible. 763 777 764 - 6. thermal_emergency_poweroff 778 + 5. thermal_emergency_poweroff 765 779 ============================= 766 780 767 781 On an event of critical trip temperature crossing. Thermal framework
+1 -100
drivers/thermal/thermal_core.c
··· 19 19 #include <linux/reboot.h> 20 20 #include <linux/string.h> 21 21 #include <linux/of.h> 22 - #include <net/netlink.h> 23 - #include <net/genetlink.h> 24 22 #include <linux/suspend.h> 25 23 26 24 #define CREATE_TRACE_POINTS ··· 1462 1464 } 1463 1465 EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name); 1464 1466 1465 - #ifdef CONFIG_NET 1466 - static const struct genl_multicast_group thermal_event_mcgrps[] = { 1467 - { .name = THERMAL_GENL_MCAST_GROUP_NAME, }, 1468 - }; 1469 - 1470 - static struct genl_family thermal_event_genl_family __ro_after_init = { 1471 - .module = THIS_MODULE, 1472 - .name = THERMAL_GENL_FAMILY_NAME, 1473 - .version = THERMAL_GENL_VERSION, 1474 - .maxattr = THERMAL_GENL_ATTR_MAX, 1475 - .mcgrps = thermal_event_mcgrps, 1476 - .n_mcgrps = ARRAY_SIZE(thermal_event_mcgrps), 1477 - }; 1478 - 1479 - int thermal_generate_netlink_event(struct thermal_zone_device *tz, 1480 - enum events event) 1481 - { 1482 - struct sk_buff *skb; 1483 - struct nlattr *attr; 1484 - struct thermal_genl_event *thermal_event; 1485 - void *msg_header; 1486 - int size; 1487 - int result; 1488 - static unsigned int thermal_event_seqnum; 1489 - 1490 - if (!tz) 1491 - return -EINVAL; 1492 - 1493 - /* allocate memory */ 1494 - size = nla_total_size(sizeof(struct thermal_genl_event)) + 1495 - nla_total_size(0); 1496 - 1497 - skb = genlmsg_new(size, GFP_ATOMIC); 1498 - if (!skb) 1499 - return -ENOMEM; 1500 - 1501 - /* add the genetlink message header */ 1502 - msg_header = genlmsg_put(skb, 0, thermal_event_seqnum++, 1503 - &thermal_event_genl_family, 0, 1504 - THERMAL_GENL_CMD_EVENT); 1505 - if (!msg_header) { 1506 - nlmsg_free(skb); 1507 - return -ENOMEM; 1508 - } 1509 - 1510 - /* fill the data */ 1511 - attr = nla_reserve(skb, THERMAL_GENL_ATTR_EVENT, 1512 - sizeof(struct thermal_genl_event)); 1513 - 1514 - if (!attr) { 1515 - nlmsg_free(skb); 1516 - return -EINVAL; 1517 - } 1518 - 1519 - thermal_event = nla_data(attr); 1520 - if (!thermal_event) { 1521 - nlmsg_free(skb); 1522 - return -EINVAL; 1523 - } 1524 - 1525 - memset(thermal_event, 0, sizeof(struct thermal_genl_event)); 1526 - 1527 - thermal_event->orig = tz->id; 1528 - thermal_event->event = event; 1529 - 1530 - /* send multicast genetlink message */ 1531 - genlmsg_end(skb, msg_header); 1532 - 1533 - result = genlmsg_multicast(&thermal_event_genl_family, skb, 0, 1534 - 0, GFP_ATOMIC); 1535 - if (result) 1536 - dev_err(&tz->device, "Failed to send netlink event:%d", result); 1537 - 1538 - return result; 1539 - } 1540 - EXPORT_SYMBOL_GPL(thermal_generate_netlink_event); 1541 - 1542 - static int __init genetlink_init(void) 1543 - { 1544 - return genl_register_family(&thermal_event_genl_family); 1545 - } 1546 - 1547 - static void genetlink_exit(void) 1548 - { 1549 - genl_unregister_family(&thermal_event_genl_family); 1550 - } 1551 - #else /* !CONFIG_NET */ 1552 - static inline int genetlink_init(void) { return 0; } 1553 - static inline void genetlink_exit(void) {} 1554 - #endif /* !CONFIG_NET */ 1555 - 1556 1467 static int thermal_pm_notify(struct notifier_block *nb, 1557 1468 unsigned long mode, void *_unused) 1558 1469 { ··· 1514 1607 if (result) 1515 1608 goto unregister_governors; 1516 1609 1517 - result = genetlink_init(); 1518 - if (result) 1519 - goto unregister_class; 1520 - 1521 1610 result = of_parse_thermal_zones(); 1522 1611 if (result) 1523 - goto exit_netlink; 1612 + goto unregister_class; 1524 1613 1525 1614 result = register_pm_notifier(&thermal_pm_nb); 1526 1615 if (result) ··· 1525 1622 1526 1623 return 0; 1527 1624 1528 - exit_netlink: 1529 - genetlink_exit(); 1530 1625 unregister_class: 1531 1626 class_unregister(&thermal_class); 1532 1627 unregister_governors:
-11
include/linux/thermal.h
··· 544 544 { } 545 545 #endif /* CONFIG_THERMAL */ 546 546 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 - 558 547 #endif /* __THERMAL_H__ */