mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-25 01:20:05 +01:00
Merge branch 'work' into 'master'
xfree86: Fix xf86Entities's xf86_platform_device pointing when udl screen unpluging. See merge request xorg/xserver!971
This commit is contained in:
commit
6836198fdd
1 changed files with 22 additions and 2 deletions
|
|
@ -81,12 +81,32 @@ xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
|
||||||
int
|
int
|
||||||
xf86_remove_platform_device(int dev_index)
|
xf86_remove_platform_device(int dev_index)
|
||||||
{
|
{
|
||||||
int j;
|
int i, j, tmp_index;
|
||||||
|
|
||||||
config_odev_free_attributes(xf86_platform_devices[dev_index].attribs);
|
config_odev_free_attributes(xf86_platform_devices[dev_index].attribs);
|
||||||
|
|
||||||
for (j = dev_index; j < xf86_num_platform_devices - 1; j++)
|
/* Remove redundant members from the xf86_platform_devices[],
|
||||||
|
* and adjust the xf86Entities[i]->bus.id.plat pointer. */
|
||||||
|
if( dev_index != xf86_num_platform_devices -1 ) {
|
||||||
|
for(i=0; i<xf86NumEntities; i++) {
|
||||||
|
if( xf86Entities[i]->bus.id.plat == &xf86_platform_devices[dev_index] ) {
|
||||||
|
tmp_index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = dev_index; j < xf86_num_platform_devices - 1; j++) {
|
||||||
memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device));
|
memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device));
|
||||||
|
|
||||||
|
for(i=0; i<xf86NumEntities; i++) {
|
||||||
|
if( xf86Entities[i]->bus.id.plat == &xf86_platform_devices[j + 1] ) {
|
||||||
|
xf86Entities[i]->bus.id.plat = &xf86_platform_devices[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xf86Entities[tmp_index]->bus.id.plat = &xf86_platform_devices[xf86_num_platform_devices -1];
|
||||||
|
|
||||||
xf86_num_platform_devices--;
|
xf86_num_platform_devices--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue