xf86-video-nvidia-legacy: allow build with kernel 5.18

This commit is contained in:
Rudi Heitbaum 2022-04-25 02:15:52 +00:00
parent 31ba5c2738
commit c6ebc9899b
2 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,64 @@
diff -Nur a/kernel/nv-vm.c b/kernel/nv-vm.c
--- a/kernel/nv-vm.c 2019-12-11 22:04:24.000000000 +0000
+++ b/kernel/nv-vm.c 2022-04-25 01:28:55.889120175 +0000
@@ -169,12 +169,12 @@
static inline int nv_map_sg(struct pci_dev *dev, struct scatterlist *sg)
{
- return pci_map_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
+ return dma_map_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
}
static inline void nv_unmap_sg(struct pci_dev *dev, struct scatterlist *sg)
{
- pci_unmap_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
+ dma_unmap_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
}
#define NV_MAP_SG_MAX_RETRIES 16
--- a/kernel/nv-dma.c 2019-12-11 22:04:24.000000000 +0000
+++ b/kernel/nv-dma.c 2022-04-25 01:52:11.243235749 +0000
@@ -136,10 +136,10 @@
return status;
}
- dma_map->sg_map_count = pci_map_sg(dma_map->dev,
+ dma_map->sg_map_count = dma_map_sg(&dma_map->dev->dev,
NV_DMA_MAP_SCATTERLIST(dma_map),
NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
- PCI_DMA_BIDIRECTIONAL);
+ DMA_BIDIRECTIONAL);
if (dma_map->sg_map_count == 0)
{
nv_printf(NV_DBG_ERRORS,
@@ -211,8 +211,8 @@
if (dma_map->sg_map_count != 0)
{
- pci_unmap_sg(dma_map->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
- NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), PCI_DMA_BIDIRECTIONAL);
+ dma_unmap_sg(&dma_map->dev->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), DMA_BIDIRECTIONAL);
}
*priv = dma_map->user_pages;
--- a/kernel/nv-drm.c 2022-04-25 01:59:40.255544206 +0000
+++ b/kernel/nv-drm.c 2022-04-25 02:08:28.231217905 +0000
@@ -459,7 +459,7 @@
}
static int nv_drm_gem_vmap(struct drm_gem_object *gem,
- struct dma_buf_map *map)
+ struct iosys_map *map)
{
map->vaddr = nv_gem_prime_vmap(gem);
if (map->vaddr == NULL) {
@@ -470,7 +470,7 @@
}
static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
- struct dma_buf_map *map)
+ struct iosys_map *map)
{
nv_gem_prime_vunmap(gem, map->vaddr);
map->vaddr = NULL;

View File

@ -0,0 +1,56 @@
From ac2a3feefad549814f5e7cca30be07a255c8494a Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Date: Tue, 5 Apr 2022 19:49:26 +0200
Subject: Revert ACPI: bus: Eliminate acpi_bus_get_device()
Revert d017a3167bcb76caedf2b444645bf4db75f775a5
Replace the last instance of acpi_bus_get_device(), added recently
by commit 87e59b36e5e2 ("spi: Support selection of the index of the
ACPI Spi Resource before alloc"), with acpi_fetch_acpi_dev() and
finally drop acpi_bus_get_device() that has no more users.
---
drivers/acpi/scan.c | 13 +++++++++++++
include/acpi/acpi_bus.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 9efbfe087de76..762b61f67e6c6 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -588,6 +588,19 @@ static struct acpi_device *handle_to_device(acpi_handle handle,
return adev;
}
+int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
+{
+ if (!device)
+ return -EINVAL;
+
+ *device = handle_to_device(handle, NULL);
+ if (!*device)
+ return -ENODEV;
+
+ return 0;
+}
+EXPORT_SYMBOL(acpi_bus_get_device);
+
/**
* acpi_fetch_acpi_dev - Retrieve ACPI device object.
* @handle: ACPI handle associated with the requested ACPI device object.
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 3f7f01f038690..c4b78c21d7930 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -509,6 +509,7 @@ extern int unregister_acpi_notifier(struct notifier_block *);
* External Functions
*/
+int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
struct acpi_device *acpi_fetch_acpi_dev(acpi_handle handle);
acpi_status acpi_bus_get_status_handle(acpi_handle handle,
unsigned long long *sta);
--
cgit 1.2.3-1.el7