From 4f495ac8768dc770cdb1ae2753e6721524368f7c Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 28 Aug 2024 04:55:45 +0000 Subject: [PATCH] implement pci drvdata functions --- sys/dev/pci/drm/drm_drv.c | 1 + sys/dev/pci/drm/include/linux/pci.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index bdb8ed5a05f..7db7ae1065f 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1407,6 +1407,7 @@ drm_attach(struct device *parent, struct device *self, void *aux) dev->pdev->pc = pa->pa_pc; dev->pdev->tag = pa->pa_tag; dev->pdev->pci = (struct pci_softc *)parent->dv_parent; + dev->pdev->_dev = parent; #ifdef CONFIG_ACPI dev->pdev->dev.node = acpi_find_pci(pa->pa_pc, pa->pa_tag); diff --git a/sys/dev/pci/drm/include/linux/pci.h b/sys/dev/pci/drm/include/linux/pci.h index 330439856b6..1634d22226e 100644 --- a/sys/dev/pci/drm/include/linux/pci.h +++ b/sys/dev/pci/drm/include/linux/pci.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.h,v 1.17 2024/08/16 10:46:46 kettenis Exp $ */ +/* $OpenBSD: pci.h,v 1.18 2024/08/28 04:55:45 jsg Exp $ */ /* * Copyright (c) 2015 Mark Kettenis * @@ -33,6 +33,7 @@ #include #include #include +#include struct pci_dev; @@ -70,6 +71,7 @@ struct pci_dev { uint8_t ltr_path; struct pci_acpi dev; + struct device *_dev; }; #define PCI_ANY_ID (uint16_t) (~0U) @@ -457,6 +459,13 @@ pci_is_thunderbolt_attached(struct pci_dev *pdev) static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) { + dev_set_drvdata(pdev->_dev, data); +} + +static inline void * +pci_get_drvdata(struct pci_dev *pdev) +{ + return dev_get_drvdata(pdev->_dev); } static inline int -- 2.20.1