nvgpu: Fix devnode function pointers for Linux v6.2

Upstream Linux kernel commit ff62b8e6588f ("driver core: make struct
class.devnode() take a const *") updated the 'devnode' function pointer
under the class structure to take a const device struct. This breaks
building the NVGPU driver with Linux v6.2. Make the necessary changes to
the NVGPU driver to fix the build breakage.

Bug 3936429
Bug 3844023

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: Ia39d7fded8df0e4eb30ebd58b2261e48e1963549
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2841032
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-01-10 14:17:10 +00:00
committed by mobile promotions
parent c1a1a14086
commit 315813beac

View File

@@ -222,7 +222,11 @@ static char *nvgpu_devnode(const char *cdev_name)
return kasprintf(GFP_KERNEL, "nvhost-%s-gpu", cdev_name);
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *nvgpu_pci_devnode(struct device *dev, umode_t *mode)
#else
static char *nvgpu_pci_devnode(const struct device *dev, umode_t *mode)
#endif
{
/* Special case to maintain legacy names */
if (strcmp(dev_name(dev), "channel") == 0) {
@@ -234,18 +238,30 @@ static char *nvgpu_pci_devnode(struct device *dev, umode_t *mode)
dev_name(dev->parent), dev_name(dev));
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *nvgpu_devnode_v2(struct device *dev, umode_t *mode)
#else
static char *nvgpu_devnode_v2(const struct device *dev, umode_t *mode)
#endif
{
return kasprintf(GFP_KERNEL, "nvgpu/igpu0/%s", dev_name(dev));
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *nvgpu_pci_devnode_v2(struct device *dev, umode_t *mode)
#else
static char *nvgpu_pci_devnode_v2(const struct device *dev, umode_t *mode)
#endif
{
return kasprintf(GFP_KERNEL, "nvgpu/dgpu-%s/%s", dev_name(dev->parent),
dev_name(dev));
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *nvgpu_mig_fgpu_devnode(struct device *dev, umode_t *mode)
#else
static char *nvgpu_mig_fgpu_devnode(const struct device *dev, umode_t *mode)
#endif
{
struct nvgpu_cdev_class_priv_data *priv_data;