Re: [PATCH 2/2] thermal: intel: int340x: Allow temperature override
From: srinivas pandruvada
Date: Fri Jun 06 2025 - 17:19:10 EST
On Fri, 2025-06-06 at 07:22 +0000, Zhang, Rui wrote:
> On Thu, 2025-06-05 at 10:20 -0700, srinivas pandruvada wrote:
> > > >
> > > > int proc_thermal_ptc_add(struct pci_dev *pdev, struct
> > > > proc_thermal_device *proc_priv)
> > > > {
> > > > @@ -230,10 +289,13 @@ int proc_thermal_ptc_add(struct pci_dev
> > > > *pdev,
> > > > struct proc_thermal_device *proc_
> > > >
> > > > for (i = 0; i < PTC_MAX_INSTANCES; i++) {
> > > > ptc_instance[i].offset =
> > > > ptc_offsets[i];
> > > > + ptc_instance[i].pdev = pdev;
> > > > ptc_create_groups(pdev, i,
> > > > &ptc_instance[i]);
> > > > }
> > > > }
> > > >
> > > > + ptc_create_debugfs();
> > > > +
> > >
> > > should we create the debugfs only when PROC_THERMAL_FEATURE_PTC
> > > is
> > > set?
> >
> > This function is only called when
> > if (feature_mask & PROC_THERMAL_FEATURE_PTC) {
> > }
> >
> >
> right, then the
> if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_PTC)
> check in proc_thermal_ptc_add() is redundant.
Yes.
>
>
> BTW, in proc_thermal_mmio_add() and proc_thermal_mmio_remove(), we
>
> 1. call the rapl/ptc/rfim/wt_req/wt_hint .add() functions with the
> feature mask check in proc_thermal_mmio_add()
>
> 2. call the .remove() functions without the feature mask check in
> failure
> cases in proc_thermal_mmio_add().
The current functions in the upstream code are for:
proc_thermal_rfim_remove(pdev);
This is already protected inside as it has to check each feature.
proc_thermal_rapl_remove();
This is by virtue of rapl_mmio_priv.control_type is NULL on error, so
the above function will return.
proc_thermal_ptc_remove() is also protected by the flag. But you are
right for the debugfs part added with this patch, which should be
inside the flag check.
>
> 3. call the .remove() functions with feature mask check in
> proc_thermal_mmio_remove()
>
> This is inconsistent. If you agree, I'd like to propose a cleanup
> patch
> to make them work in a unified way.
You can make a cleanup patch to be consistent.
Thanks,
Srinivas
>
> thanks,
> rui