Skip to content

Commit 55ee664

Browse files
committed
Merge tag 'platform-drivers-x86-v6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: "A small set of assorted bug and build/warning fixes" * tag 'platform-drivers-x86-v6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform: mellanox: mlx-platform: Initialize shift variable to 0 platform/x86: int3472: Add GPIOs to Surface Go 3 Board data platform/x86: ISST: Fix kernel documentation warnings platform: x86: MLX_PLATFORM: select REGMAP instead of depending on it platform: mellanox: select REGMAP instead of depending on it platform/x86/intel/tpmi: Fix double free reported by Smatch platform/x86: ISST: Increase range of valid mail box commands platform/x86: dell-ddv: Fix temperature scaling platform/x86: dell-ddv: Fix cache invalidation on resume platform/x86/amd: pmc: remove CONFIG_SUSPEND checks
2 parents 7fef099 + 1a0009a commit 55ee664

File tree

9 files changed

+39
-42
lines changed

9 files changed

+39
-42
lines changed

drivers/platform/mellanox/Kconfig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ if MELLANOX_PLATFORM
1616

1717
config MLXREG_HOTPLUG
1818
tristate "Mellanox platform hotplug driver support"
19-
depends on REGMAP
2019
depends on HWMON
2120
depends on I2C
21+
select REGMAP
2222
help
2323
This driver handles hot-plug events for the power suppliers, power
2424
cables and fans on the wide range Mellanox IB and Ethernet systems.
2525

2626
config MLXREG_IO
2727
tristate "Mellanox platform register access driver support"
28-
depends on REGMAP
2928
depends on HWMON
29+
select REGMAP
3030
help
3131
This driver allows access to Mellanox programmable device register
3232
space through sysfs interface. The sets of registers for sysfs access
@@ -36,9 +36,9 @@ config MLXREG_IO
3636

3737
config MLXREG_LC
3838
tristate "Mellanox line card platform driver support"
39-
depends on REGMAP
4039
depends on HWMON
4140
depends on I2C
41+
select REGMAP
4242
help
4343
This driver provides support for the Mellanox MSN4800-XX line cards,
4444
which are the part of MSN4800 Ethernet modular switch systems
@@ -80,10 +80,9 @@ config MLXBF_PMC
8080

8181
config NVSW_SN2201
8282
tristate "Nvidia SN2201 platform driver support"
83-
depends on REGMAP
8483
depends on HWMON
8584
depends on I2C
86-
depends on REGMAP_I2C
85+
select REGMAP_I2C
8786
help
8887
This driver provides support for the Nvidia SN2201 platform.
8988
The SN2201 is a highly integrated for one rack unit system with

drivers/platform/x86/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,8 @@ config SERIAL_MULTI_INSTANTIATE
955955

956956
config MLX_PLATFORM
957957
tristate "Mellanox Technologies platform support"
958-
depends on I2C && REGMAP
958+
depends on I2C
959+
select REGMAP
959960
help
960961
This option enables system support for the Mellanox Technologies
961962
platform. The Mellanox systems provide data center networking

drivers/platform/x86/amd/pmc.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ MODULE_PARM_DESC(disable_workarounds, "Disable workarounds for platform bugs");
171171
static struct amd_pmc_dev pmc;
172172
static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret);
173173
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf);
174-
#ifdef CONFIG_SUSPEND
175174
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
176-
#endif
177175

178176
static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
179177
{
@@ -386,7 +384,6 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table
386384
return 0;
387385
}
388386

389-
#ifdef CONFIG_SUSPEND
390387
static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
391388
{
392389
struct smu_metrics table;
@@ -400,7 +397,6 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
400397
dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n",
401398
table.timein_s0i3_lastcapture);
402399
}
403-
#endif
404400

405401
static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
406402
{
@@ -673,7 +669,6 @@ static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg,
673669
return rc;
674670
}
675671

676-
#ifdef CONFIG_SUSPEND
677672
static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
678673
{
679674
switch (dev->cpu_id) {
@@ -861,9 +856,7 @@ static int __maybe_unused amd_pmc_suspend_handler(struct device *dev)
861856
return 0;
862857
}
863858

864-
static SIMPLE_DEV_PM_OPS(amd_pmc_pm, amd_pmc_suspend_handler, NULL);
865-
866-
#endif
859+
static DEFINE_SIMPLE_DEV_PM_OPS(amd_pmc_pm, amd_pmc_suspend_handler, NULL);
867860

868861
static const struct pci_device_id pmc_pci_ids[] = {
869862
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_PS) },
@@ -905,7 +898,6 @@ static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
905898
return 0;
906899
}
907900

908-
#ifdef CONFIG_SUSPEND
909901
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
910902
{
911903
int err;
@@ -926,7 +918,6 @@ static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
926918

927919
return 0;
928920
}
929-
#endif
930921

931922
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
932923
{
@@ -1017,11 +1008,11 @@ static int amd_pmc_probe(struct platform_device *pdev)
10171008
}
10181009

10191010
platform_set_drvdata(pdev, dev);
1020-
#ifdef CONFIG_SUSPEND
1021-
err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
1022-
if (err)
1023-
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
1024-
#endif
1011+
if (IS_ENABLED(CONFIG_SUSPEND)) {
1012+
err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
1013+
if (err)
1014+
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
1015+
}
10251016

10261017
amd_pmc_dbgfs_register(dev);
10271018
return 0;
@@ -1035,9 +1026,8 @@ static int amd_pmc_remove(struct platform_device *pdev)
10351026
{
10361027
struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
10371028

1038-
#ifdef CONFIG_SUSPEND
1039-
acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
1040-
#endif
1029+
if (IS_ENABLED(CONFIG_SUSPEND))
1030+
acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
10411031
amd_pmc_dbgfs_unregister(dev);
10421032
pci_dev_put(dev->rdev);
10431033
mutex_destroy(&dev->lock);
@@ -1061,9 +1051,7 @@ static struct platform_driver amd_pmc_driver = {
10611051
.name = "amd_pmc",
10621052
.acpi_match_table = amd_pmc_acpi_ids,
10631053
.dev_groups = pmc_groups,
1064-
#ifdef CONFIG_SUSPEND
1065-
.pm = &amd_pmc_pm,
1066-
#endif
1054+
.pm = pm_sleep_ptr(&amd_pmc_pm),
10671055
},
10681056
.probe = amd_pmc_probe,
10691057
.remove = amd_pmc_remove,

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/kernel.h>
1818
#include <linux/hwmon.h>
1919
#include <linux/kstrtox.h>
20-
#include <linux/math.h>
2120
#include <linux/math64.h>
2221
#include <linux/module.h>
2322
#include <linux/mutex.h>
@@ -96,6 +95,7 @@ struct combined_chip_info {
9695
};
9796

9897
struct dell_wmi_ddv_sensors {
98+
bool active;
9999
struct mutex lock; /* protect caching */
100100
unsigned long timestamp;
101101
union acpi_object *obj;
@@ -520,6 +520,9 @@ static struct hwmon_channel_info *dell_wmi_ddv_channel_create(struct device *dev
520520

521521
static void dell_wmi_ddv_hwmon_cache_invalidate(struct dell_wmi_ddv_sensors *sensors)
522522
{
523+
if (!sensors->active)
524+
return;
525+
523526
mutex_lock(&sensors->lock);
524527
kfree(sensors->obj);
525528
sensors->obj = NULL;
@@ -530,6 +533,7 @@ static void dell_wmi_ddv_hwmon_cache_destroy(void *data)
530533
{
531534
struct dell_wmi_ddv_sensors *sensors = data;
532535

536+
sensors->active = false;
533537
mutex_destroy(&sensors->lock);
534538
kfree(sensors->obj);
535539
}
@@ -549,6 +553,7 @@ static struct hwmon_channel_info *dell_wmi_ddv_channel_init(struct wmi_device *w
549553
return ERR_PTR(ret);
550554

551555
mutex_init(&sensors->lock);
556+
sensors->active = true;
552557

553558
ret = devm_add_action_or_reset(&wdev->dev, dell_wmi_ddv_hwmon_cache_destroy, sensors);
554559
if (ret < 0)
@@ -659,7 +664,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr, char
659664
if (ret < 0)
660665
return ret;
661666

662-
return sysfs_emit(buf, "%d\n", DIV_ROUND_CLOSEST(value, 10));
667+
/* Use 2731 instead of 2731.5 to avoid unnecessary rounding */
668+
return sysfs_emit(buf, "%d\n", value - 2731);
663669
}
664670

665671
static ssize_t eppid_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -852,7 +858,7 @@ static int dell_wmi_ddv_resume(struct device *dev)
852858
{
853859
struct dell_wmi_ddv_data *data = dev_get_drvdata(dev);
854860

855-
/* Force re-reading of all sensors */
861+
/* Force re-reading of all active sensors */
856862
dell_wmi_ddv_hwmon_cache_invalidate(&data->fans);
857863
dell_wmi_ddv_hwmon_cache_invalidate(&data->temps);
858864

drivers/platform/x86/intel/int3472/tps68470_board_data.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,10 @@ static const struct int3472_tps68470_board_data surface_go_tps68470_board_data =
159159
static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data = {
160160
.dev_name = "i2c-INT3472:01",
161161
.tps68470_regulator_pdata = &surface_go_tps68470_pdata,
162-
.n_gpiod_lookups = 1,
162+
.n_gpiod_lookups = 2,
163163
.tps68470_gpio_lookup_tables = {
164-
&surface_go_int347a_gpios
164+
&surface_go_int347a_gpios,
165+
&surface_go_int347e_gpios,
165166
},
166167
};
167168

drivers/platform/x86/intel/speed_select_if/isst_if_common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct isst_cmd_set_req_type {
4747

4848
static const struct isst_valid_cmd_ranges isst_valid_cmds[] = {
4949
{0xD0, 0x00, 0x03},
50-
{0x7F, 0x00, 0x0B},
50+
{0x7F, 0x00, 0x0C},
5151
{0x7F, 0x10, 0x12},
5252
{0x7F, 0x20, 0x23},
5353
{0x94, 0x03, 0x03},
@@ -112,6 +112,7 @@ static void isst_delete_hash(void)
112112
* isst_store_cmd() - Store command to a hash table
113113
* @cmd: Mailbox command.
114114
* @sub_cmd: Mailbox sub-command or MSR id.
115+
* @cpu: Target CPU for the command
115116
* @mbox_cmd_type: Mailbox or MSR command.
116117
* @param: Mailbox parameter.
117118
* @data: Mailbox request data or MSR data.
@@ -363,7 +364,7 @@ static struct pci_dev *_isst_if_get_pci_dev(int cpu, int bus_no, int dev, int fn
363364
/**
364365
* isst_if_get_pci_dev() - Get the PCI device instance for a CPU
365366
* @cpu: Logical CPU number.
366-
* @bus_number: The bus number assigned by the hardware.
367+
* @bus_no: The bus number assigned by the hardware.
367368
* @dev: The device number assigned by the hardware.
368369
* @fn: The function number assigned by the hardware.
369370
*

drivers/platform/x86/intel/speed_select_if/isst_if_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
* @offset: Offset to the first valid member in command structure.
4141
* This will be the offset of the start of the command
4242
* after command count field
43+
* @owner: Registered module owner
4344
* @cmd_callback: Callback function to handle IOCTL. The callback has the
4445
* command pointer with data for command. There is a pointer
4546
* called write_only, which when set, will not copy the

drivers/platform/x86/intel/tpmi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info,
209209
if (!name)
210210
return -EOPNOTSUPP;
211211

212-
feature_vsec_dev = kzalloc(sizeof(*feature_vsec_dev), GFP_KERNEL);
213-
if (!feature_vsec_dev)
212+
res = kcalloc(pfs->pfs_header.num_entries, sizeof(*res), GFP_KERNEL);
213+
if (!res)
214214
return -ENOMEM;
215215

216-
res = kcalloc(pfs->pfs_header.num_entries, sizeof(*res), GFP_KERNEL);
217-
if (!res) {
216+
feature_vsec_dev = kzalloc(sizeof(*feature_vsec_dev), GFP_KERNEL);
217+
if (!feature_vsec_dev) {
218218
ret = -ENOMEM;
219-
goto free_vsec;
219+
goto free_res;
220220
}
221221

222222
snprintf(feature_id_name, sizeof(feature_id_name), "tpmi-%s", name);
@@ -239,6 +239,8 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info,
239239
/*
240240
* intel_vsec_add_aux() is resource managed, no explicit
241241
* delete is required on error or on module unload.
242+
* feature_vsec_dev memory is also freed as part of device
243+
* delete.
242244
*/
243245
ret = intel_vsec_add_aux(vsec_dev->pcidev, &vsec_dev->auxdev.dev,
244246
feature_vsec_dev, feature_id_name);
@@ -249,8 +251,6 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info,
249251

250252
free_res:
251253
kfree(res);
252-
free_vsec:
253-
kfree(feature_vsec_dev);
254254

255255
return ret;
256256
}

drivers/platform/x86/mlx-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5980,7 +5980,7 @@ MODULE_DEVICE_TABLE(dmi, mlxplat_dmi_table);
59805980
static int mlxplat_mlxcpld_verify_bus_topology(int *nr)
59815981
{
59825982
struct i2c_adapter *search_adap;
5983-
int shift, i;
5983+
int i, shift = 0;
59845984

59855985
/* Scan adapters from expected id to verify it is free. */
59865986
*nr = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR;

0 commit comments

Comments
 (0)