Skip to content

Commit 964ebc0

Browse files
committed
Merge tag 'platform-drivers-x86-v6.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform drivers fixes from Ilpo Järvinen: - power supply code: - Add get/set property direct to allow avoiding taking psy->extensions_sem twice from power supply extensions - alienware-wmi-wmax: - Add AWCC support for Alienware Area-51m and m15 R5 - Fix `dmi_system_id` array termination - arm64: huawei-gaokun-ec: fix OF node leak - dell-ddv: Fix taking psy->extensions_sem twice - dell-lis3lv02d: Add Precision 3551 accelerometer support - firmware_attributes_class: Fix initialization order - ideapad-laptop: Retain FnLock and kbd backlight across boots - lenovo-wmi-hotkey: Avoid triggering error -5 due to missing mute LED - mellanox: mlxbf-pmc: Validate event names and bool input * tag 'platform-drivers-x86-v6.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: MAINTAINERS: Update entries for IFS and SBL drivers platform/x86: dell-lis3lv02d: Add Precision 3551 platform/x86: alieneware-wmi-wmax: Add AWCC support to more laptops platform/x86: Fix initialization order for firmware_attributes_class platform: arm64: huawei-gaokun-ec: fix OF node leak lenovo-wmi-hotkey: Avoid triggering error -5 due to missing mute LED platform/x86: ideapad-laptop: Fix kbd backlight not remembered among boots platform/x86: ideapad-laptop: Fix FnLock not remembered among boots platform/mellanox: mlxbf-pmc: Use kstrtobool() to check 0/1 input platform/mellanox: mlxbf-pmc: Validate event/enable input platform/mellanox: mlxbf-pmc: Remove newline char from event name input platform/x86: dell-ddv: Fix taking the psy->extensions_sem lock twice power: supply: test-power: Test access to extended power supply power: supply: core: Add power_supply_get/set_property_direct() platform/x86: alienware-wmi-wmax: Fix `dmi_system_id` array
2 parents 89be9a8 + e2967b5 commit 964ebc0

File tree

12 files changed

+153
-39
lines changed

12 files changed

+153
-39
lines changed

MAINTAINERS

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12188,9 +12188,8 @@ F: drivers/dma/idxd/*
1218812188
F: include/uapi/linux/idxd.h
1218912189

1219012190
INTEL IN FIELD SCAN (IFS) DEVICE
12191-
M: Jithu Joseph <jithu.joseph@intel.com>
12191+
M: Tony Luck <tony.luck@intel.com>
1219212192
R: Ashok Raj <[email protected]>
12193-
R: Tony Luck <[email protected]>
1219412193
S: Maintained
1219512194
F: drivers/platform/x86/intel/ifs
1219612195
F: include/trace/events/intel_ifs.h
@@ -12530,8 +12529,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git
1253012529
F: drivers/net/wireless/intel/iwlwifi/
1253112530

1253212531
INTEL WMI SLIM BOOTLOADER (SBL) FIRMWARE UPDATE DRIVER
12533-
M: Jithu Joseph <[email protected]>
12534-
S: Maintained
12532+
S: Orphan
1253512533
W: https://slimbootloader.github.io/security/firmware-update.html
1253612534
F: drivers/platform/x86/intel/wmi/sbl-fw-update.c
1253712535

drivers/platform/arm64/huawei-gaokun-ec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ static void gaokun_aux_release(struct device *dev)
662662
{
663663
struct auxiliary_device *adev = to_auxiliary_dev(dev);
664664

665+
of_node_put(dev->of_node);
665666
kfree(adev);
666667
}
667668

@@ -693,6 +694,7 @@ static int gaokun_aux_init(struct device *parent, const char *name,
693694

694695
ret = auxiliary_device_init(adev);
695696
if (ret) {
697+
of_node_put(adev->dev.of_node);
696698
kfree(adev);
697699
return ret;
698700
}

drivers/platform/mellanox/mlxbf-pmc.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/hwmon.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/string.h>
18+
#include <linux/string_helpers.h>
1819
#include <uapi/linux/psci.h>
1920

2021
#define MLXBF_PMC_WRITE_REG_32 0x82000009
@@ -1222,7 +1223,7 @@ static int mlxbf_pmc_get_event_num(const char *blk, const char *evt)
12221223
return -ENODEV;
12231224
}
12241225

1225-
/* Get the event number given the name */
1226+
/* Get the event name given the number */
12261227
static char *mlxbf_pmc_get_event_name(const char *blk, u32 evt)
12271228
{
12281229
const struct mlxbf_pmc_events *events;
@@ -1784,21 +1785,31 @@ static ssize_t mlxbf_pmc_event_store(struct device *dev,
17841785
attr, struct mlxbf_pmc_attribute, dev_attr);
17851786
unsigned int blk_num, cnt_num;
17861787
bool is_l3 = false;
1788+
char *evt_name;
17871789
int evt_num;
17881790
int err;
17891791

17901792
blk_num = attr_event->nr;
17911793
cnt_num = attr_event->index;
17921794

17931795
if (isalpha(buf[0])) {
1796+
/* Remove the trailing newline character if present */
1797+
evt_name = kstrdup_and_replace(buf, '\n', '\0', GFP_KERNEL);
1798+
if (!evt_name)
1799+
return -ENOMEM;
1800+
17941801
evt_num = mlxbf_pmc_get_event_num(pmc->block_name[blk_num],
1795-
buf);
1802+
evt_name);
1803+
kfree(evt_name);
17961804
if (evt_num < 0)
17971805
return -EINVAL;
17981806
} else {
17991807
err = kstrtouint(buf, 0, &evt_num);
18001808
if (err < 0)
18011809
return err;
1810+
1811+
if (!mlxbf_pmc_get_event_name(pmc->block_name[blk_num], evt_num))
1812+
return -EINVAL;
18021813
}
18031814

18041815
if (strstr(pmc->block_name[blk_num], "l3cache"))
@@ -1879,13 +1890,14 @@ static ssize_t mlxbf_pmc_enable_store(struct device *dev,
18791890
{
18801891
struct mlxbf_pmc_attribute *attr_enable = container_of(
18811892
attr, struct mlxbf_pmc_attribute, dev_attr);
1882-
unsigned int en, blk_num;
1893+
unsigned int blk_num;
18831894
u32 word;
18841895
int err;
1896+
bool en;
18851897

18861898
blk_num = attr_enable->nr;
18871899

1888-
err = kstrtouint(buf, 0, &en);
1900+
err = kstrtobool(buf, &en);
18891901
if (err < 0)
18901902
return err;
18911903

@@ -1905,14 +1917,11 @@ static ssize_t mlxbf_pmc_enable_store(struct device *dev,
19051917
MLXBF_PMC_CRSPACE_PERFMON_CTL(pmc->block[blk_num].counters),
19061918
MLXBF_PMC_WRITE_REG_32, word);
19071919
} else {
1908-
if (en && en != 1)
1909-
return -EINVAL;
1910-
19111920
err = mlxbf_pmc_config_l3_counters(blk_num, false, !!en);
19121921
if (err)
19131922
return err;
19141923

1915-
if (en == 1) {
1924+
if (en) {
19161925
err = mlxbf_pmc_config_l3_counters(blk_num, true, false);
19171926
if (err)
19181927
return err;

drivers/platform/x86/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ obj-$(CONFIG_X86_PLATFORM_DRIVERS_HP) += hp/
5858
# Hewlett Packard Enterprise
5959
obj-$(CONFIG_UV_SYSFS) += uv_sysfs.o
6060

61+
obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o
62+
6163
# IBM Thinkpad and Lenovo
6264
obj-$(CONFIG_IBM_RTL) += ibm_rtl.o
6365
obj-$(CONFIG_IDEAPAD_LAPTOP) += ideapad-laptop.o
@@ -128,7 +130,6 @@ obj-$(CONFIG_SYSTEM76_ACPI) += system76_acpi.o
128130
obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o
129131

130132
# Platform drivers
131-
obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o
132133
obj-$(CONFIG_SERIAL_MULTI_INSTANTIATE) += serial-multi-instantiate.o
133134
obj-$(CONFIG_TOUCHSCREEN_DMI) += touchscreen_dmi.o
134135
obj-$(CONFIG_WIRELESS_HOTKEY) += wireless-hotkey.o

drivers/platform/x86/dell/alienware-wmi-wmax.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ static struct awcc_quirks generic_quirks = {
8989
static struct awcc_quirks empty_quirks;
9090

9191
static const struct dmi_system_id awcc_dmi_table[] __initconst = {
92+
{
93+
.ident = "Alienware Area-51m",
94+
.matches = {
95+
DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
96+
DMI_MATCH(DMI_PRODUCT_NAME, "Alienware Area-51m"),
97+
},
98+
.driver_data = &generic_quirks,
99+
},
92100
{
93101
.ident = "Alienware Area-51m R2",
94102
.matches = {
@@ -97,6 +105,14 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = {
97105
},
98106
.driver_data = &generic_quirks,
99107
},
108+
{
109+
.ident = "Alienware m15 R5",
110+
.matches = {
111+
DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
112+
DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m15 R5"),
113+
},
114+
.driver_data = &generic_quirks,
115+
},
100116
{
101117
.ident = "Alienware m15 R7",
102118
.matches = {
@@ -233,6 +249,7 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = {
233249
},
234250
.driver_data = &g_series_quirks,
235251
},
252+
{}
236253
};
237254

238255
enum AWCC_GET_FAN_SENSORS_OPERATIONS {

drivers/platform/x86/dell/dell-lis3lv02d.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static const struct dmi_system_id lis3lv02d_devices[] __initconst = {
4949
DELL_LIS3LV02D_DMI_ENTRY("Latitude E6330", 0x29),
5050
DELL_LIS3LV02D_DMI_ENTRY("Latitude E6430", 0x29),
5151
DELL_LIS3LV02D_DMI_ENTRY("Precision 3540", 0x29),
52+
DELL_LIS3LV02D_DMI_ENTRY("Precision 3551", 0x29),
5253
DELL_LIS3LV02D_DMI_ENTRY("Precision M6800", 0x29),
5354
DELL_LIS3LV02D_DMI_ENTRY("Vostro V131", 0x1d),
5455
DELL_LIS3LV02D_DMI_ENTRY("Vostro 5568", 0x29),

drivers/platform/x86/dell/dell-wmi-ddv.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,13 @@ static int dell_wmi_ddv_battery_translate(struct dell_wmi_ddv_data *data,
689689

690690
dev_dbg(&data->wdev->dev, "Translation cache miss\n");
691691

692-
/* Perform a translation between a ACPI battery and a battery index */
693-
694-
ret = power_supply_get_property(battery, POWER_SUPPLY_PROP_SERIAL_NUMBER, &val);
692+
/*
693+
* Perform a translation between a ACPI battery and a battery index.
694+
* We have to use power_supply_get_property_direct() here because this
695+
* function will also get called from the callbacks of the power supply
696+
* extension.
697+
*/
698+
ret = power_supply_get_property_direct(battery, POWER_SUPPLY_PROP_SERIAL_NUMBER, &val);
695699
if (ret < 0)
696700
return ret;
697701

drivers/platform/x86/ideapad-laptop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv)
16691669
priv->kbd_bl.led.name = "platform::" LED_FUNCTION_KBD_BACKLIGHT;
16701670
priv->kbd_bl.led.brightness_get = ideapad_kbd_bl_led_cdev_brightness_get;
16711671
priv->kbd_bl.led.brightness_set_blocking = ideapad_kbd_bl_led_cdev_brightness_set;
1672-
priv->kbd_bl.led.flags = LED_BRIGHT_HW_CHANGED;
1672+
priv->kbd_bl.led.flags = LED_BRIGHT_HW_CHANGED | LED_RETAIN_AT_SHUTDOWN;
16731673

16741674
err = led_classdev_register(&priv->platform_device->dev, &priv->kbd_bl.led);
16751675
if (err)
@@ -1728,7 +1728,7 @@ static int ideapad_fn_lock_led_init(struct ideapad_private *priv)
17281728
priv->fn_lock.led.name = "platform::" LED_FUNCTION_FNLOCK;
17291729
priv->fn_lock.led.brightness_get = ideapad_fn_lock_led_cdev_get;
17301730
priv->fn_lock.led.brightness_set_blocking = ideapad_fn_lock_led_cdev_set;
1731-
priv->fn_lock.led.flags = LED_BRIGHT_HW_CHANGED;
1731+
priv->fn_lock.led.flags = LED_BRIGHT_HW_CHANGED | LED_RETAIN_AT_SHUTDOWN;
17321732

17331733
err = led_classdev_register(&priv->platform_device->dev, &priv->fn_lock.led);
17341734
if (err)

drivers/platform/x86/lenovo-wmi-hotkey-utilities.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,35 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_led_type led_type, struct
122122
return -EIO;
123123

124124
union acpi_object *obj __free(kfree) = output.pointer;
125-
if (obj && obj->type == ACPI_TYPE_INTEGER)
126-
led_version = obj->integer.value;
127-
else
125+
if (!obj || obj->type != ACPI_TYPE_INTEGER)
128126
return -EIO;
129127

130-
wpriv->cdev[led_type].max_brightness = LED_ON;
131-
wpriv->cdev[led_type].flags = LED_CORE_SUSPENDRESUME;
128+
led_version = obj->integer.value;
129+
130+
/*
131+
* Output parameters define: 0 means mute LED is not supported, Non-zero means
132+
* mute LED can be supported.
133+
*/
134+
if (led_version == 0)
135+
return 0;
136+
132137

133138
switch (led_type) {
134139
case MIC_MUTE:
135-
if (led_version != WMI_LUD_SUPPORT_MICMUTE_LED_VER)
136-
return -EIO;
140+
if (led_version != WMI_LUD_SUPPORT_MICMUTE_LED_VER) {
141+
pr_warn("The MIC_MUTE LED of this device isn't supported.\n");
142+
return 0;
143+
}
137144

138145
wpriv->cdev[led_type].name = "platform::micmute";
139146
wpriv->cdev[led_type].brightness_set_blocking = &lsh_wmi_micmute_led_set;
140147
wpriv->cdev[led_type].default_trigger = "audio-micmute";
141148
break;
142149
case AUDIO_MUTE:
143-
if (led_version != WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER)
144-
return -EIO;
150+
if (led_version != WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER) {
151+
pr_warn("The AUDIO_MUTE LED of this device isn't supported.\n");
152+
return 0;
153+
}
145154

146155
wpriv->cdev[led_type].name = "platform::mute";
147156
wpriv->cdev[led_type].brightness_set_blocking = &lsh_wmi_audiomute_led_set;
@@ -152,6 +161,9 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_led_type led_type, struct
152161
return -EINVAL;
153162
}
154163

164+
wpriv->cdev[led_type].max_brightness = LED_ON;
165+
wpriv->cdev[led_type].flags = LED_CORE_SUSPENDRESUME;
166+
155167
err = devm_led_classdev_register(dev, &wpriv->cdev[led_type]);
156168
if (err < 0) {
157169
dev_err(dev, "Could not register mute LED %d : %d\n", led_type, err);

drivers/power/supply/power_supply_core.c

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,8 @@ bool power_supply_has_property(struct power_supply *psy,
12351235
return false;
12361236
}
12371237

1238-
int power_supply_get_property(struct power_supply *psy,
1239-
enum power_supply_property psp,
1240-
union power_supply_propval *val)
1238+
static int __power_supply_get_property(struct power_supply *psy, enum power_supply_property psp,
1239+
union power_supply_propval *val, bool use_extensions)
12411240
{
12421241
struct power_supply_ext_registration *reg;
12431242

@@ -1247,10 +1246,14 @@ int power_supply_get_property(struct power_supply *psy,
12471246
return -ENODEV;
12481247
}
12491248

1250-
scoped_guard(rwsem_read, &psy->extensions_sem) {
1251-
power_supply_for_each_extension(reg, psy) {
1252-
if (power_supply_ext_has_property(reg->ext, psp))
1249+
if (use_extensions) {
1250+
scoped_guard(rwsem_read, &psy->extensions_sem) {
1251+
power_supply_for_each_extension(reg, psy) {
1252+
if (!power_supply_ext_has_property(reg->ext, psp))
1253+
continue;
1254+
12531255
return reg->ext->get_property(psy, reg->ext, reg->data, psp, val);
1256+
}
12541257
}
12551258
}
12561259

@@ -1261,20 +1264,49 @@ int power_supply_get_property(struct power_supply *psy,
12611264
else
12621265
return -EINVAL;
12631266
}
1267+
1268+
int power_supply_get_property(struct power_supply *psy, enum power_supply_property psp,
1269+
union power_supply_propval *val)
1270+
{
1271+
return __power_supply_get_property(psy, psp, val, true);
1272+
}
12641273
EXPORT_SYMBOL_GPL(power_supply_get_property);
12651274

1266-
int power_supply_set_property(struct power_supply *psy,
1267-
enum power_supply_property psp,
1268-
const union power_supply_propval *val)
1275+
/**
1276+
* power_supply_get_property_direct - Read a power supply property without checking for extensions
1277+
* @psy: The power supply
1278+
* @psp: The power supply property to read
1279+
* @val: The resulting value of the power supply property
1280+
*
1281+
* Read a power supply property without taking into account any power supply extensions registered
1282+
* on the given power supply. This is mostly useful for power supply extensions that want to access
1283+
* their own power supply as using power_supply_get_property() directly will result in a potential
1284+
* deadlock.
1285+
*
1286+
* Return: 0 on success or negative error code on failure.
1287+
*/
1288+
int power_supply_get_property_direct(struct power_supply *psy, enum power_supply_property psp,
1289+
union power_supply_propval *val)
1290+
{
1291+
return __power_supply_get_property(psy, psp, val, false);
1292+
}
1293+
EXPORT_SYMBOL_GPL(power_supply_get_property_direct);
1294+
1295+
1296+
static int __power_supply_set_property(struct power_supply *psy, enum power_supply_property psp,
1297+
const union power_supply_propval *val, bool use_extensions)
12691298
{
12701299
struct power_supply_ext_registration *reg;
12711300

12721301
if (atomic_read(&psy->use_cnt) <= 0)
12731302
return -ENODEV;
12741303

1275-
scoped_guard(rwsem_read, &psy->extensions_sem) {
1276-
power_supply_for_each_extension(reg, psy) {
1277-
if (power_supply_ext_has_property(reg->ext, psp)) {
1304+
if (use_extensions) {
1305+
scoped_guard(rwsem_read, &psy->extensions_sem) {
1306+
power_supply_for_each_extension(reg, psy) {
1307+
if (!power_supply_ext_has_property(reg->ext, psp))
1308+
continue;
1309+
12781310
if (reg->ext->set_property)
12791311
return reg->ext->set_property(psy, reg->ext, reg->data,
12801312
psp, val);
@@ -1289,8 +1321,34 @@ int power_supply_set_property(struct power_supply *psy,
12891321

12901322
return psy->desc->set_property(psy, psp, val);
12911323
}
1324+
1325+
int power_supply_set_property(struct power_supply *psy, enum power_supply_property psp,
1326+
const union power_supply_propval *val)
1327+
{
1328+
return __power_supply_set_property(psy, psp, val, true);
1329+
}
12921330
EXPORT_SYMBOL_GPL(power_supply_set_property);
12931331

1332+
/**
1333+
* power_supply_set_property_direct - Write a power supply property without checking for extensions
1334+
* @psy: The power supply
1335+
* @psp: The power supply property to write
1336+
* @val: The value to write to the power supply property
1337+
*
1338+
* Write a power supply property without taking into account any power supply extensions registered
1339+
* on the given power supply. This is mostly useful for power supply extensions that want to access
1340+
* their own power supply as using power_supply_set_property() directly will result in a potential
1341+
* deadlock.
1342+
*
1343+
* Return: 0 on success or negative error code on failure.
1344+
*/
1345+
int power_supply_set_property_direct(struct power_supply *psy, enum power_supply_property psp,
1346+
const union power_supply_propval *val)
1347+
{
1348+
return __power_supply_set_property(psy, psp, val, false);
1349+
}
1350+
EXPORT_SYMBOL_GPL(power_supply_set_property_direct);
1351+
12941352
int power_supply_property_is_writeable(struct power_supply *psy,
12951353
enum power_supply_property psp)
12961354
{

0 commit comments

Comments
 (0)