Skip to contentSkip to conversation

hwmon: peci: change label strings to reflect natural numbers

PATCH Applied Jae Hyun Yoo 2 participants 7 messages Feb 11, 2020 – Feb 26, 2020 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: peci: change label strings to reflect natural numbers

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

---
 drivers/hwmon/peci-cputemp.c  | 2 +-
 drivers/hwmon/peci-dimmtemp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c
 mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c
drivers/hwmon/peci-cputemp.c +1 -1
old mode 100644
new mode 100755
index 78e442f433a7..b9fe91281d58
@@ -363,7 +363,7 @@ static int create_core_temp_label(struct peci_cputemp *priv, int idx)
 	if (!priv->coretemp_label[idx])
 		return -ENOMEM;
 
-	sprintf(priv->coretemp_label[idx], "Core %d", idx);
+	sprintf(priv->coretemp_label[idx], "Core %d", idx + 1);
 
 	return 0;
 }
drivers/hwmon/peci-dimmtemp.c +1 -1
old mode 100644
new mode 100755
index 8ceab08d06e1..45eabd2ec5c8
@@ -260,7 +260,7 @@ static int create_dimm_temp_label(struct peci_dimmtemp *priv, int chan)
 	rank = chan / priv->gen_info->dimm_idx_max;
 	idx = chan % priv->gen_info->dimm_idx_max;
 
-	sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx);
+	sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx + 1);
 
 	return 0;
 }
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 6 lines · Jae Hyun Yoo

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

Applied to dev-5.4

Quoted 40 lines
---
 drivers/hwmon/peci-cputemp.c  | 2 +-
 drivers/hwmon/peci-dimmtemp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c
 mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c
drivers/hwmon/peci-cputemp.c +1 -1
old mode 100644
new mode 100755
index 78e442f433a7..b9fe91281d58
@@ -363,7 +363,7 @@ static int create_core_temp_label(struct peci_cputemp *priv, int idx)
        if (!priv->coretemp_label[idx])
                return -ENOMEM;
 
-       sprintf(priv->coretemp_label[idx], "Core %d", idx);
+       sprintf(priv->coretemp_label[idx], "Core %d", idx + 1);
 
        return 0;
 }
drivers/hwmon/peci-dimmtemp.c +1 -2
old mode 100644
new mode 100755
index 8ceab08d06e1..45eabd2ec5c8
@@ -260,7 +260,7 @@ static int create_dimm_temp_label(struct peci_dimmtemp *priv, int chan)
        rank = chan / priv->gen_info->dimm_idx_max;
        idx = chan % priv->gen_info->dimm_idx_max;
 
-       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx);
+       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx + 1);
 
        return 0;
 }
--

2.17.1

#2 lore raw
In reply to Jae Hyun Yoo
Quoted 5 lines · Jae Hyun Yoo

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

Quoted 7 lines
---
 drivers/hwmon/peci-cputemp.c  | 2 +-
 drivers/hwmon/peci-dimmtemp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c
 mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c

I don't think this was intended.

I fixed it up for you, but please try to figure out what went wrong so it doesn't happen in the future.

Quoted 34 lines
drivers/hwmon/peci-cputemp.c +1 -1
old mode 100644
new mode 100755
index 78e442f433a7..b9fe91281d58
@@ -363,7 +363,7 @@ static int create_core_temp_label(struct peci_cputemp *priv, int idx)
        if (!priv->coretemp_label[idx])
                return -ENOMEM;
 
-       sprintf(priv->coretemp_label[idx], "Core %d", idx);
+       sprintf(priv->coretemp_label[idx], "Core %d", idx + 1);
 
        return 0;
 }
drivers/hwmon/peci-dimmtemp.c +1 -2
old mode 100644
new mode 100755
index 8ceab08d06e1..45eabd2ec5c8
@@ -260,7 +260,7 @@ static int create_dimm_temp_label(struct peci_dimmtemp *priv, int chan)
        rank = chan / priv->gen_info->dimm_idx_max;
        idx = chan % priv->gen_info->dimm_idx_max;
 
-       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx);
+       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx + 1);
 
        return 0;
 }
--

2.17.1

#3 lore raw

Hi Joel,

Quoted 14 lines · Joel Stanley
Quoted 5 lines · Jae Hyun Yoo

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

Quoted 7 lines
---
  drivers/hwmon/peci-cputemp.c  | 2 +-
  drivers/hwmon/peci-dimmtemp.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c

Quoted 4 lines

I don't think this was intended.

I fixed it up for you, but please try to figure out what went wrong so it doesn't happen in the future.

It happened while upstreaming it. I changed the static label string table as a dynamic table to address review comments, and I missed this mismatch. My bad. It'll be fixed in the next upstreaming spin.

Thanks,

Jae

Quoted 34 lines
Quoted 34 lines
drivers/hwmon/peci-cputemp.c +1 -1
old mode 100644
new mode 100755
index 78e442f433a7..b9fe91281d58
@@ -363,7 +363,7 @@ static int create_core_temp_label(struct peci_cputemp *priv, int idx)
         if (!priv->coretemp_label[idx])
                 return -ENOMEM;
 
-       sprintf(priv->coretemp_label[idx], "Core %d", idx);
+       sprintf(priv->coretemp_label[idx], "Core %d", idx + 1);
 
         return 0;
  }
drivers/hwmon/peci-dimmtemp.c +1 -2
old mode 100644
new mode 100755
index 8ceab08d06e1..45eabd2ec5c8
@@ -260,7 +260,7 @@ static int create_dimm_temp_label(struct peci_dimmtemp *priv, int chan)
         rank = chan / priv->gen_info->dimm_idx_max;
         idx = chan % priv->gen_info->dimm_idx_max;
 
-       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx);
+       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, idx + 1);
 
         return 0;
  }
--

2.17.1

#4 lore raw
Quoted 18 lines · Jae Hyun Yoo

Hi Joel,

Quoted 14 lines · Joel Stanley
Quoted 12 lines · Jae Hyun Yoo

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

---
  drivers/hwmon/peci-cputemp.c  | 2 +-
  drivers/hwmon/peci-dimmtemp.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c

Quoted 8 lines
Quoted 4 lines

I don't think this was intended.

I fixed it up for you, but please try to figure out what went wrong so it doesn't happen in the future.

It happened while upstreaming it. I changed the static label string table as a dynamic table to address review comments, and I missed this mismatch. My bad. It'll be fixed in the next upstreaming spin.

I was just referring to the files becoming executable :)

I am surprised by the code that makes string allocation dynamic. As you know the number of strings (one per sensor), and you're allocating a fixed size for each string, I would suggest you're better off allocating all of the strings at once.

Regardless, I suggest you change the calls to snprintf, as if a machine has more than 999 DIMMs it will overflow the string :)

Cheers,

Joel

#5 lore raw
Quoted 21 lines · Joel Stanley
Quoted 20 lines · Jae Hyun Yoo

Hi Joel,

Quoted 16 lines · Joel Stanley
Quoted 5 lines · Jae Hyun Yoo

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

Quoted 7 lines
---
   drivers/hwmon/peci-cputemp.c  | 2 +-
   drivers/hwmon/peci-dimmtemp.c | 2 +-
   2 files changed, 2 insertions(+), 2 deletions(-)

mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c

I don't think this was intended.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I fixed it up for you, but please try to figure out what went wrong so it doesn't happen in the future.

It happened while upstreaming it. I changed the static label string table as a dynamic table to address review comments, and I missed this mismatch. My bad. It'll be fixed in the next upstreaming spin.

I was just referring to the files becoming executable :)

Yeah, I was aware that just after sending my previous email.

Quoted 7 lines

I am surprised by the code that makes string allocation dynamic. As you know the number of strings (one per sensor), and you're allocating a fixed size for each string, I would suggest you're better off allocating all of the strings at once.

Regardless, I suggest you change the calls to snprintf, as if a machine has more than 999 DIMMs it will overflow the string :)

The machine wouldn't come in the near future but I agree with you. Let me replace the sprintf with snprintf. Will submit a new patch.

Thanks! :)

Jae

Quoted 4 lines

Cheers,

Joel

#6 lore raw
In reply to Jae Hyun Yoo
Quoted 17 lines · Jae Hyun Yoo

Hi Joel,

Quoted 14 lines · Joel Stanley
Quoted 12 lines · Jae Hyun Yoo

This commit changes label strings to reflect user friendly natural numbers like 'Core 1' instead of 'Core 0' and 'DIMM A1' instead of 'DIMM A0'.

---
  drivers/hwmon/peci-cputemp.c  | 2 +-
  drivers/hwmon/peci-dimmtemp.c | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)

  mode change 100644 => 100755 drivers/hwmon/peci-cputemp.c mode change 100644 => 100755 drivers/hwmon/peci-dimmtemp.c

Quoted 8 lines
Quoted 4 lines

I don't think this was intended.

I fixed it up for you, but please try to figure out what went wrong so it doesn't happen in the future.

It happened while upstreaming it. I changed the static label string table as a dynamic table to address review comments, and I missed this mismatch. My bad. It'll be fixed in the next upstreaming spin.

Oh, you pointed out the file mode '755'. Sorry, I changed my samba configuration so it'll not be happened again.

Thanks :)

Jae

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
drivers/hwmon/peci-cputemp.c +1 -1
old mode 100644
new mode 100755
index 78e442f433a7..b9fe91281d58
@@ -363,7 +363,7 @@ static int create_core_temp_label(struct 
 peci_cputemp *priv, int idx)
          if (!priv->coretemp_label[idx])
                  return -ENOMEM;
 
-       sprintf(priv->coretemp_label[idx], "Core %d", idx);
+       sprintf(priv->coretemp_label[idx], "Core %d", idx + 1);
 
          return 0;

  }

drivers/hwmon/peci-dimmtemp.c +1 -1
old mode 100644
new mode 100755
index 8ceab08d06e1..45eabd2ec5c8
@@ -260,7 +260,7 @@ static int create_dimm_temp_label(struct 
 peci_dimmtemp *priv, int chan)
          rank = chan / priv->gen_info->dimm_idx_max;
          idx = chan % priv->gen_info->dimm_idx_max;
 
-       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, 
 idx);
+       sprintf(priv->dimmtemp_label[chan], "DIMM %c%d", 'A' + rank, 
 idx + 1);

         return 0;
  }

Signature · 1 line
2.17.1