Re: [PATCH 2/4] platform/x86/intel/vsec: Switch exported helpers from pci_dev to device

David Box
2026-01-20T23:47:46Z

On Thu, Jan 15, 2026 at 03:08:09PM +0200, Ilpo Järvinen wrote:
> On Tue, 6 Jan 2026, David E. Box wrote:
>
> > Preparatory refactor for ACPI-enumerated PMT endpoints. Several exported
> > PMT/VSEC interfaces and structs carried struct pci_dev * even though
> > callers only need a generic struct device. Move those to struct device * so
> > the same APIs work for PCI and ACPI parents.
> >
> > Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_debugfs.c | 2 +-
> > drivers/gpu/drm/xe/xe_hwmon.c | 2 +-
> > drivers/gpu/drm/xe/xe_vsec.c | 7 +-
> > drivers/gpu/drm/xe/xe_vsec.h | 2 +-
> > drivers/platform/x86/intel/pmc/core.c | 4 +-
> > .../platform/x86/intel/pmc/ssram_telemetry.c | 2 +-
> > drivers/platform/x86/intel/pmt/class.c | 8 +-
> > drivers/platform/x86/intel/pmt/class.h | 4 +-
> > drivers/platform/x86/intel/pmt/discovery.c | 4 +-
> > drivers/platform/x86/intel/pmt/telemetry.c | 13 ++--
> > drivers/platform/x86/intel/pmt/telemetry.h | 11 ++-
> > drivers/platform/x86/intel/sdsi.c | 5 +-
> > drivers/platform/x86/intel/vsec.c | 74 +++++++++++--------
> > drivers/platform/x86/intel/vsec_tpmi.c | 6 +-
> > include/linux/intel_vsec.h | 18 ++---
> > 15 files changed, 86 insertions(+), 76 deletions(-)
> >
>

...

> > @@ -630,7 +634,7 @@ static void intel_vsec_skip_missing_dependencies(struct pci_dev *pdev)
> >
> > static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> > {
> > - struct intel_vsec_platform_info *info;
> > + struct intel_vsec_platform_info info, *info_temp;
> > struct vsec_priv *priv;
> > int num_caps, ret;
> > int run_once = 0;
> > @@ -641,22 +645,25 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
> > return ret;
> >
> > pci_save_state(pdev);
> > - info = (struct intel_vsec_platform_info *)id->driver_data;
> > - if (!info)
> > + info_temp = (struct intel_vsec_platform_info *)id->driver_data;
> > + if (!info_temp)
> > return -EINVAL;
> >
> > + /* XXX: Needs better fix */
> > + info = *info_temp;
> > +
> > priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > if (!priv)
> > return -ENOMEM;
> >
> > - priv->info = info;
> > + priv->info = &info;
> > pci_set_drvdata(pdev, priv);
>
> What's going on here??? 'info' is a stack variable and you're taking
> a pointer of it into priv/drvdata??

Oy vey. This chunk shouldn't even be here. It was part of an incomplete
refactor of code from heap to stack that I ended up dropping anyway.
Sorry for the noise. Ack on everything else. Thanks Ilpo.

David