Skip to content

Commit 4bdec23

Browse files
committed
Merge tag 'hwmon-for-v6.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - it87: Fix voltage scaling for chips with 10.9mV ADCs - xgene: Fix ioremap and memremap leak - peci/cputemp: Fix miscalculated DTS temperature for SKX - hwmon core: fix potential sensor registration failure with thermal subsystem if of_node is missing * tag 'hwmon-for-v6.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCs hwmon: (xgene) Fix ioremap and memremap leak hwmon: fix potential sensor registration fail if of_node is missing hwmon: (peci/cputemp) Fix miscalculated DTS for SKX
2 parents 65aca32 + 968b66f commit 4bdec23

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

drivers/hwmon/hwmon.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
757757
struct hwmon_device *hwdev;
758758
const char *label;
759759
struct device *hdev;
760+
struct device *tdev = dev;
760761
int i, err, id;
761762

762763
/* Complain about invalid characters in hwmon name attribute */
@@ -826,7 +827,9 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
826827
hwdev->name = name;
827828
hdev->class = &hwmon_class;
828829
hdev->parent = dev;
829-
hdev->of_node = dev ? dev->of_node : NULL;
830+
while (tdev && !tdev->of_node)
831+
tdev = tdev->parent;
832+
hdev->of_node = tdev ? tdev->of_node : NULL;
830833
hwdev->chip = chip;
831834
dev_set_drvdata(hdev, drvdata);
832835
dev_set_name(hdev, HWMON_ID_FORMAT, id);
@@ -838,7 +841,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
838841

839842
INIT_LIST_HEAD(&hwdev->tzdata);
840843

841-
if (dev && dev->of_node && chip && chip->ops->read &&
844+
if (hdev->of_node && chip && chip->ops->read &&
842845
chip->info[0]->type == hwmon_chip &&
843846
(chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) {
844847
err = hwmon_thermal_register_sensors(hdev);

drivers/hwmon/it87.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ static const struct it87_devices it87_devices[] = {
515515
#define has_six_temp(data) ((data)->features & FEAT_SIX_TEMP)
516516
#define has_vin3_5v(data) ((data)->features & FEAT_VIN3_5V)
517517
#define has_conf_noexit(data) ((data)->features & FEAT_CONF_NOEXIT)
518+
#define has_scaling(data) ((data)->features & (FEAT_12MV_ADC | \
519+
FEAT_10_9MV_ADC))
518520

519521
struct it87_sio_data {
520522
int sioaddr;
@@ -3134,7 +3136,7 @@ static int it87_probe(struct platform_device *pdev)
31343136
"Detected broken BIOS defaults, disabling PWM interface\n");
31353137

31363138
/* Starting with IT8721F, we handle scaling of internal voltages */
3137-
if (has_12mv_adc(data)) {
3139+
if (has_scaling(data)) {
31383140
if (sio_data->internal & BIT(0))
31393141
data->in_scaled |= BIT(3); /* in3 is AVCC */
31403142
if (sio_data->internal & BIT(1))

drivers/hwmon/peci/cputemp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@ static const struct cpu_info cpu_hsx = {
537537
.thermal_margin_to_millidegree = &dts_eight_dot_eight_to_millidegree,
538538
};
539539

540+
static const struct cpu_info cpu_skx = {
541+
.reg = &resolved_cores_reg_hsx,
542+
.min_peci_revision = 0x33,
543+
.thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree,
544+
};
545+
540546
static const struct cpu_info cpu_icx = {
541547
.reg = &resolved_cores_reg_icx,
542548
.min_peci_revision = 0x40,
@@ -558,7 +564,7 @@ static const struct auxiliary_device_id peci_cputemp_ids[] = {
558564
},
559565
{
560566
.name = "peci_cpu.cputemp.skx",
561-
.driver_data = (kernel_ulong_t)&cpu_hsx,
567+
.driver_data = (kernel_ulong_t)&cpu_skx,
562568
},
563569
{
564570
.name = "peci_cpu.cputemp.icx",

drivers/hwmon/xgene-hwmon.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,14 +698,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
698698
ctx->comm_base_addr = pcc_chan->shmem_base_addr;
699699
if (ctx->comm_base_addr) {
700700
if (version == XGENE_HWMON_V2)
701-
ctx->pcc_comm_addr = (void __force *)ioremap(
702-
ctx->comm_base_addr,
703-
pcc_chan->shmem_size);
701+
ctx->pcc_comm_addr = (void __force *)devm_ioremap(&pdev->dev,
702+
ctx->comm_base_addr,
703+
pcc_chan->shmem_size);
704704
else
705-
ctx->pcc_comm_addr = memremap(
706-
ctx->comm_base_addr,
707-
pcc_chan->shmem_size,
708-
MEMREMAP_WB);
705+
ctx->pcc_comm_addr = devm_memremap(&pdev->dev,
706+
ctx->comm_base_addr,
707+
pcc_chan->shmem_size,
708+
MEMREMAP_WB);
709709
} else {
710710
dev_err(&pdev->dev, "Failed to get PCC comm region\n");
711711
rc = -ENODEV;

0 commit comments

Comments
 (0)