Skip to content

Commit 8287dfc

Browse files
committed
Merge tag 'hwmon-for-v6.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - xgene-hwmon: Fix a NULL vs IS_ERR_OR_NULL() check - ad7314: Return error if leading zero bits are non-zero - ntc_thermistor: Update/fix the ncpXXxh103 sensor table - pmbus: Initialise page count in pmbus_identify() - peci/dimmtemp: Do not provide fake threshold data * tag 'hwmon-for-v6.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe() hwmon: (ad7314) Validate leading zero bits and return error hwmon: (ntc_thermistor) Fix the ncpXXxh103 sensor table hwmon: (pmbus) Initialise page count in pmbus_identify() hwmon: (peci/dimmtemp) Do not provide fake thresholds data
2 parents 1222390 + 10fce7e commit 8287dfc

File tree

5 files changed

+50
-40
lines changed

5 files changed

+50
-40
lines changed

drivers/hwmon/ad7314.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
*/
2323
#define AD7314_TEMP_MASK 0x7FE0
2424
#define AD7314_TEMP_SHIFT 5
25+
#define AD7314_LEADING_ZEROS_MASK BIT(15)
2526

2627
/*
2728
* ADT7301 and ADT7302 temperature masks
2829
*/
2930
#define ADT7301_TEMP_MASK 0x3FFF
31+
#define ADT7301_LEADING_ZEROS_MASK (BIT(15) | BIT(14))
3032

3133
enum ad7314_variant {
3234
adt7301,
@@ -65,12 +67,20 @@ static ssize_t ad7314_temperature_show(struct device *dev,
6567
return ret;
6668
switch (spi_get_device_id(chip->spi_dev)->driver_data) {
6769
case ad7314:
70+
if (ret & AD7314_LEADING_ZEROS_MASK) {
71+
/* Invalid read-out, leading zero part is missing */
72+
return -EIO;
73+
}
6874
data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_SHIFT;
6975
data = sign_extend32(data, 9);
7076

7177
return sprintf(buf, "%d\n", 250 * data);
7278
case adt7301:
7379
case adt7302:
80+
if (ret & ADT7301_LEADING_ZEROS_MASK) {
81+
/* Invalid read-out, leading zero part is missing */
82+
return -EIO;
83+
}
7484
/*
7585
* Documented as a 13 bit twos complement register
7686
* with a sign bit - which is a 14 bit 2's complement

drivers/hwmon/ntc_thermistor.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -181,40 +181,40 @@ static const struct ntc_compensation ncpXXwf104[] = {
181181
};
182182

183183
static const struct ntc_compensation ncpXXxh103[] = {
184-
{ .temp_c = -40, .ohm = 247565 },
185-
{ .temp_c = -35, .ohm = 181742 },
186-
{ .temp_c = -30, .ohm = 135128 },
187-
{ .temp_c = -25, .ohm = 101678 },
188-
{ .temp_c = -20, .ohm = 77373 },
189-
{ .temp_c = -15, .ohm = 59504 },
190-
{ .temp_c = -10, .ohm = 46222 },
191-
{ .temp_c = -5, .ohm = 36244 },
192-
{ .temp_c = 0, .ohm = 28674 },
193-
{ .temp_c = 5, .ohm = 22878 },
194-
{ .temp_c = 10, .ohm = 18399 },
195-
{ .temp_c = 15, .ohm = 14910 },
196-
{ .temp_c = 20, .ohm = 12169 },
184+
{ .temp_c = -40, .ohm = 195652 },
185+
{ .temp_c = -35, .ohm = 148171 },
186+
{ .temp_c = -30, .ohm = 113347 },
187+
{ .temp_c = -25, .ohm = 87559 },
188+
{ .temp_c = -20, .ohm = 68237 },
189+
{ .temp_c = -15, .ohm = 53650 },
190+
{ .temp_c = -10, .ohm = 42506 },
191+
{ .temp_c = -5, .ohm = 33892 },
192+
{ .temp_c = 0, .ohm = 27219 },
193+
{ .temp_c = 5, .ohm = 22021 },
194+
{ .temp_c = 10, .ohm = 17926 },
195+
{ .temp_c = 15, .ohm = 14674 },
196+
{ .temp_c = 20, .ohm = 12081 },
197197
{ .temp_c = 25, .ohm = 10000 },
198-
{ .temp_c = 30, .ohm = 8271 },
199-
{ .temp_c = 35, .ohm = 6883 },
200-
{ .temp_c = 40, .ohm = 5762 },
201-
{ .temp_c = 45, .ohm = 4851 },
202-
{ .temp_c = 50, .ohm = 4105 },
203-
{ .temp_c = 55, .ohm = 3492 },
204-
{ .temp_c = 60, .ohm = 2985 },
205-
{ .temp_c = 65, .ohm = 2563 },
206-
{ .temp_c = 70, .ohm = 2211 },
207-
{ .temp_c = 75, .ohm = 1915 },
208-
{ .temp_c = 80, .ohm = 1666 },
209-
{ .temp_c = 85, .ohm = 1454 },
210-
{ .temp_c = 90, .ohm = 1275 },
211-
{ .temp_c = 95, .ohm = 1121 },
212-
{ .temp_c = 100, .ohm = 990 },
213-
{ .temp_c = 105, .ohm = 876 },
214-
{ .temp_c = 110, .ohm = 779 },
215-
{ .temp_c = 115, .ohm = 694 },
216-
{ .temp_c = 120, .ohm = 620 },
217-
{ .temp_c = 125, .ohm = 556 },
198+
{ .temp_c = 30, .ohm = 8315 },
199+
{ .temp_c = 35, .ohm = 6948 },
200+
{ .temp_c = 40, .ohm = 5834 },
201+
{ .temp_c = 45, .ohm = 4917 },
202+
{ .temp_c = 50, .ohm = 4161 },
203+
{ .temp_c = 55, .ohm = 3535 },
204+
{ .temp_c = 60, .ohm = 3014 },
205+
{ .temp_c = 65, .ohm = 2586 },
206+
{ .temp_c = 70, .ohm = 2228 },
207+
{ .temp_c = 75, .ohm = 1925 },
208+
{ .temp_c = 80, .ohm = 1669 },
209+
{ .temp_c = 85, .ohm = 1452 },
210+
{ .temp_c = 90, .ohm = 1268 },
211+
{ .temp_c = 95, .ohm = 1110 },
212+
{ .temp_c = 100, .ohm = 974 },
213+
{ .temp_c = 105, .ohm = 858 },
214+
{ .temp_c = 110, .ohm = 758 },
215+
{ .temp_c = 115, .ohm = 672 },
216+
{ .temp_c = 120, .ohm = 596 },
217+
{ .temp_c = 125, .ohm = 531 },
218218
};
219219

220220
/*

drivers/hwmon/peci/dimmtemp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ static int update_thresholds(struct peci_dimmtemp *priv, int dimm_no)
127127
return 0;
128128

129129
ret = priv->gen_info->read_thresholds(priv, dimm_order, chan_rank, &data);
130-
if (ret == -ENODATA) /* Use default or previous value */
131-
return 0;
132130
if (ret)
133131
return ret;
134132

@@ -509,11 +507,11 @@ read_thresholds_icx(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
509507

510508
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd4, &reg_val);
511509
if (ret || !(reg_val & BIT(31)))
512-
return -ENODATA; /* Use default or previous value */
510+
return -ENODATA;
513511

514512
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd0, &reg_val);
515513
if (ret)
516-
return -ENODATA; /* Use default or previous value */
514+
return -ENODATA;
517515

518516
/*
519517
* Device 26, Offset 224e0: IMC 0 channel 0 -> rank 0
@@ -546,11 +544,11 @@ read_thresholds_spr(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
546544

547545
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd4, &reg_val);
548546
if (ret || !(reg_val & BIT(31)))
549-
return -ENODATA; /* Use default or previous value */
547+
return -ENODATA;
550548

551549
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd0, &reg_val);
552550
if (ret)
553-
return -ENODATA; /* Use default or previous value */
551+
return -ENODATA;
554552

555553
/*
556554
* Device 26, Offset 219a8: IMC 0 channel 0 -> rank 0

drivers/hwmon/pmbus/pmbus.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ static int pmbus_identify(struct i2c_client *client,
103103
if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) {
104104
int page;
105105

106+
info->pages = PMBUS_PAGES;
107+
106108
for (page = 1; page < PMBUS_PAGES; page++) {
107109
if (pmbus_set_page(client, page, 0xff) < 0)
108110
break;

drivers/hwmon/xgene-hwmon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
706706
goto out;
707707
}
708708

709-
if (!ctx->pcc_comm_addr) {
709+
if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) {
710710
dev_err(&pdev->dev,
711711
"Failed to ioremap PCC comm region\n");
712712
rc = -ENOMEM;

0 commit comments

Comments
 (0)