Messages in this thread Patch in this message | | | Date | Fri, 9 Jun 2023 19:00:54 -0700 | From | Guenter Roeck <> | Subject | Re: [PATCH] Enable AMD3255 Proc to show negative temperature |
| |
On 6/9/23 16:11, Baskaran Kannan wrote: > From: Your Name <you@example.com> >
Patch description missing here. Also, obviously, as Randy already mentioned, "Your Name <you@example.com>" isn't acceptable.
> Signed-off-by: Baski Kannan <Baski.Kannan@amd.com> > --- > drivers/hwmon/k10temp.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c > index 489ad0b1bc74..58e4d90de5e3 100644 > --- a/drivers/hwmon/k10temp.c > +++ b/drivers/hwmon/k10temp.c > @@ -77,6 +77,11 @@ static DEFINE_MUTEX(nb_smu_ind_mutex); > #define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19) > #define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16) > > +/* AMD's Industrial processor 3255 supports temperature from -40 deg to 105 deg Celsius. > + * Do not round off to zero for negative Tctl or Tdie values > + */ > +#define AMD_I3255_STR "3255" > + > struct k10temp_data { > struct pci_dev *pdev; > void (*read_htcreg)(struct pci_dev *pdev, u32 *regval); > @@ -86,6 +91,7 @@ struct k10temp_data { > u32 show_temp; > bool is_zen; > u32 ccd_offset; > + bool disp_negative; /*Flag set for AMD i3255. Family 17h, Model 0x0-0xf */
Space after '*'
> }; > > #define TCTL_BIT 0 > @@ -204,9 +210,15 @@ static int k10temp_read_temp(struct device *dev, u32 attr, int channel, > switch (channel) { > case 0: /* Tctl */ > *val = get_raw_temp(data); > + if (*val < 0 && (data->disp_negative == false) ){ > + *val = 0; > + }
It seems like this patch doesn't replace the previous version, it is applied on top of it. Please don't do that. The previous version was not accepted. Send a new version instead.
> break; > case 1: /* Tdie */ > *val = get_raw_temp(data) - data->temp_offset; > + if (*val < 0 && (data->disp_negative == false) ){
This violates Linux kernel style (space before {). Also, () around the second expression is unnecessary, as is == false. Please use !data->disp_negative instead. Also, the {} is unnecessary.
> + *val = 0; > + } > break; > case 2 ... 13: /* Tccd{1-12} */ > amd_smn_read(amd_pci_dev_to_node_id(data->pdev), > @@ -401,6 +413,11 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id) > data->pdev = pdev; > data->show_temp |= BIT(TCTL_BIT); /* Always show Tctl */ > > + if (boot_cpu_data.x86 == 0x17 && > + strstr(boot_cpu_data.x86_model_id, AMD_I3255_STR)) {
Multi-line alignment seems wrong, and there is no need for {}. Please make sure that checkpatch --strict is clean.
> + data->disp_negative = true; > + } > + > if (boot_cpu_data.x86 == 0x15 && > ((boot_cpu_data.x86_model & 0xf0) == 0x60 || > (boot_cpu_data.x86_model & 0xf0) == 0x70)) {
| |