hwmon.c (0aea30a07ec6b50de0fc5f5b2ec34a68ead86b61) | hwmon.c (1ad6c3b7ef132e1d8c5d606008069724625c8daf) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * hwmon.c - part of lm_sensors, Linux kernel modules for hardware monitoring 4 * 5 * This file defines the sysfs class "hwmon", for use by sensors drivers. 6 * 7 * Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com> 8 */ --- 1043 unchanged lines hidden (view full) --- 1052 * @dev: the parent device of the device to unregister 1053 */ 1054void devm_hwmon_device_unregister(struct device *dev) 1055{ 1056 WARN_ON(devres_release(dev, devm_hwmon_release, devm_hwmon_match, dev)); 1057} 1058EXPORT_SYMBOL_GPL(devm_hwmon_device_unregister); 1059 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * hwmon.c - part of lm_sensors, Linux kernel modules for hardware monitoring 4 * 5 * This file defines the sysfs class "hwmon", for use by sensors drivers. 6 * 7 * Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com> 8 */ --- 1043 unchanged lines hidden (view full) --- 1052 * @dev: the parent device of the device to unregister 1053 */ 1054void devm_hwmon_device_unregister(struct device *dev) 1055{ 1056 WARN_ON(devres_release(dev, devm_hwmon_release, devm_hwmon_match, dev)); 1057} 1058EXPORT_SYMBOL_GPL(devm_hwmon_device_unregister); 1059 |
1060static char *__hwmon_sanitize_name(struct device *dev, const char *old_name) 1061{ 1062 char *name, *p; 1063 1064 if (dev) 1065 name = devm_kstrdup(dev, old_name, GFP_KERNEL); 1066 else 1067 name = kstrdup(old_name, GFP_KERNEL); 1068 if (!name) 1069 return ERR_PTR(-ENOMEM); 1070 1071 for (p = name; *p; p++) 1072 if (hwmon_is_bad_char(*p)) 1073 *p = '_'; 1074 1075 return name; 1076} 1077 1078/** 1079 * hwmon_sanitize_name - Replaces invalid characters in a hwmon name 1080 * @name: NUL-terminated name 1081 * 1082 * Allocates a new string where any invalid characters will be replaced 1083 * by an underscore. It is the responsibility of the caller to release 1084 * the memory. 1085 * 1086 * Returns newly allocated name, or ERR_PTR on error. 1087 */ 1088char *hwmon_sanitize_name(const char *name) 1089{ 1090 return __hwmon_sanitize_name(NULL, name); 1091} 1092EXPORT_SYMBOL_GPL(hwmon_sanitize_name); 1093 1094/** 1095 * devm_hwmon_sanitize_name - resource managed hwmon_sanitize_name() 1096 * @dev: device to allocate memory for 1097 * @name: NUL-terminated name 1098 * 1099 * Allocates a new string where any invalid characters will be replaced 1100 * by an underscore. 1101 * 1102 * Returns newly allocated name, or ERR_PTR on error. 1103 */ 1104char *devm_hwmon_sanitize_name(struct device *dev, const char *name) 1105{ 1106 if (!dev) 1107 return ERR_PTR(-EINVAL); 1108 1109 return __hwmon_sanitize_name(dev, name); 1110} 1111EXPORT_SYMBOL_GPL(devm_hwmon_sanitize_name); 1112 |
|
1060static void __init hwmon_pci_quirks(void) 1061{ 1062#if defined CONFIG_X86 && defined CONFIG_PCI 1063 struct pci_dev *sb; 1064 u16 base; 1065 u8 enable; 1066 1067 /* Open access to 0x295-0x296 on MSI MS-7031 */ --- 46 unchanged lines hidden --- | 1113static void __init hwmon_pci_quirks(void) 1114{ 1115#if defined CONFIG_X86 && defined CONFIG_PCI 1116 struct pci_dev *sb; 1117 u16 base; 1118 u8 enable; 1119 1120 /* Open access to 0x295-0x296 on MSI MS-7031 */ --- 46 unchanged lines hidden --- |