On 9 April 2018 at 11:24, Emil Velikov emil.l.velikov@gmail.com wrote:
On 9 April 2018 at 09:26, Daniel Vetter daniel@ffwll.ch wrote:
- point drm_device::dev to the parent of the virtio_device
The biggest hack imaginable, if even possible.
What would/could break if we do this? Why is this a hack?
It _feels_ very hacky to reach/store the parent of the _parent_ device given. Dummy grep for <dev> showed hundreds of entries, but many of those are unrelated. Will give it a closer look - might not be as bad, as I originally thought.
Here are the side-effects:
Semantic changes * using the wrong device for i2c - via drm_dp_add_port * passing the wrong device to framebuffer_alloc - via drm_fb_helper_alloc_fbi * using the wrong parent device to drm_gem_prime_import_dev
Visual * printing the wrong device on DRM_DEV_ERROR, dev_info, drm_printer, etc
Needs a pdev_to_virtio() since we have the struct virtio_device::struct device::struct device parent - via virtio_gpu_driver_load
One, might get away with the above, by introducing drm_device::device bus_device, or alike. That one is used solely for the unique magic :-\
It sounds tad dirty, so I'm leaning with just commenting it. Open to alternative suggestions though.
-Emil