Skip to content
Open

Fixes #581

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions module/evdi_drm_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@
#include <drm/drm_framebuffer.h>
#include <drm/drm_fb_helper.h>

/*
* drm-next (>= 7.1.0) renamed the global atomic-state object and its helpers:
* struct drm_atomic_state -> struct drm_atomic_commit
* drm_atomic_state_alloc/clear/put -> drm_atomic_commit_alloc/clear/put
* The atomic-helper vtable callbacks (.atomic_flush/.atomic_update/...) and the
* state accessors (drm_atomic_get_{new,old}_*_state) now take a
* struct drm_atomic_commit *. evdi's source still uses the historical names, so
* alias them. The old identifiers are fully gone from the tree, so these
* whole-token macros are collision-free.
*/
#if KERNEL_VERSION(7, 1, 0) <= LINUX_VERSION_CODE
#define drm_atomic_state drm_atomic_commit
#define drm_atomic_state_alloc drm_atomic_commit_alloc
#define drm_atomic_state_clear drm_atomic_commit_clear
#define drm_atomic_state_put drm_atomic_commit_put
#endif

#include "evdi_debug.h"
#include "tests/evdi_test.h"

Expand Down
4 changes: 3 additions & 1 deletion module/evdi_platform_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void evdi_platform_device_link(struct platform_device *pdev,
}
}

void evdi_platform_device_unlink_if_linked_with(struct platform_device *pdev,
bool evdi_platform_device_unlink_if_linked_with(struct platform_device *pdev,
struct device *parent)
{
struct evdi_platform_device_data *data = platform_get_drvdata(pdev);
Expand All @@ -150,5 +150,7 @@ void evdi_platform_device_unlink_if_linked_with(struct platform_device *pdev,
data->symlinked = false;
data->parent = NULL;
EVDI_INFO("Detached from parent device\n");
return true;
}
return false;
}
2 changes: 1 addition & 1 deletion module/evdi_platform_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int evdi_platform_device_remove(struct platform_device *pdev);
bool evdi_platform_device_is_free(struct platform_device *pdev);
void evdi_platform_device_link(struct platform_device *pdev,
struct device *parent);
void evdi_platform_device_unlink_if_linked_with(struct platform_device *pdev,
bool evdi_platform_device_unlink_if_linked_with(struct platform_device *pdev,
struct device *parent);

#endif
Expand Down
6 changes: 3 additions & 3 deletions module/evdi_platform_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ static int evdi_platform_drv_usb(__always_unused struct notifier_block *nb,

if (!usb_dev)
return 0;
if (action != BUS_NOTIFY_DEL_DEVICE)
if (action != USB_DEVICE_REMOVE)
return 0;

for (i = 0; i < EVDI_DEVICE_COUNT_MAX; ++i) {
pdev = g_ctx.devices[i];
if (!pdev)
continue;
evdi_platform_device_unlink_if_linked_with(pdev, &usb_dev->dev);
if (pdev->dev.parent == &usb_dev->dev) {
if (evdi_platform_device_unlink_if_linked_with(pdev, &usb_dev->dev) &&
i >= evdi_initial_device_count) {
EVDI_INFO("Parent USB removed. Removing evdi.%d\n", i);
evdi_platform_dev_destroy(pdev);
evdi_platform_drv_context_lock((&g_ctx));
Expand Down