Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/appletbdrm: Set struct drm_device.dma_dev

Set the dma_dev field provided by the DRM device. Required for PRIME
dma-buf import. Remove the driver's implementation.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Aditya Garg <gargaditya08@live.com>
Reviewed-by: Aditya Garg <gargaditya08@live.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250307080836.42848-3-tzimmermann@suse.de

+10 -17
+10 -17
drivers/gpu/drm/tiny/appletbdrm.c
··· 45 45 #define APPLETBDRM_BULK_MSG_TIMEOUT 1000 46 46 47 47 #define drm_to_adev(_drm) container_of(_drm, struct appletbdrm_device, drm) 48 - #define adev_to_udev(adev) interface_to_usbdev(to_usb_interface(adev->dmadev)) 48 + #define adev_to_udev(adev) interface_to_usbdev(to_usb_interface((adev)->drm.dev)) 49 49 50 50 struct appletbdrm_msg_request_header { 51 51 __le16 unk_00; ··· 123 123 } __packed; 124 124 125 125 struct appletbdrm_device { 126 - struct device *dmadev; 127 - 128 126 unsigned int in_ep; 129 127 unsigned int out_ep; 130 128 ··· 610 612 .destroy = drm_encoder_cleanup, 611 613 }; 612 614 613 - static struct drm_gem_object *appletbdrm_driver_gem_prime_import(struct drm_device *dev, 614 - struct dma_buf *dma_buf) 615 - { 616 - struct appletbdrm_device *adev = drm_to_adev(dev); 617 - 618 - if (!adev->dmadev) 619 - return ERR_PTR(-ENODEV); 620 - 621 - return drm_gem_prime_import_dev(dev, dma_buf, adev->dmadev); 622 - } 623 - 624 615 DEFINE_DRM_GEM_FOPS(appletbdrm_drm_fops); 625 616 626 617 static const struct drm_driver appletbdrm_drm_driver = { 627 618 DRM_GEM_SHMEM_DRIVER_OPS, 628 - .gem_prime_import = appletbdrm_driver_gem_prime_import, 629 619 .name = "appletbdrm", 630 620 .desc = "Apple Touch Bar DRM Driver", 631 621 .major = 1, ··· 733 747 struct device *dev = &intf->dev; 734 748 struct appletbdrm_device *adev; 735 749 struct drm_device *drm = NULL; 750 + struct device *dma_dev; 736 751 int ret; 737 752 738 753 ret = usb_find_common_endpoints(intf->cur_altsetting, &bulk_in, &bulk_out, NULL, NULL); ··· 748 761 749 762 adev->in_ep = bulk_in->bEndpointAddress; 750 763 adev->out_ep = bulk_out->bEndpointAddress; 751 - adev->dmadev = dev; 752 764 753 765 drm = &adev->drm; 754 766 755 767 usb_set_intfdata(intf, adev); 768 + 769 + dma_dev = usb_intf_get_dma_device(intf); 770 + if (dma_dev) { 771 + drm_dev_set_dma_dev(drm, dma_dev); 772 + put_device(dma_dev); 773 + } else { 774 + drm_warn(drm, "buffer sharing not supported"); /* not an error */ 775 + } 756 776 757 777 ret = appletbdrm_get_information(adev); 758 778 if (ret) { ··· 799 805 struct appletbdrm_device *adev = usb_get_intfdata(intf); 800 806 struct drm_device *drm = &adev->drm; 801 807 802 - put_device(adev->dmadev); 803 808 drm_dev_unplug(drm); 804 809 drm_atomic_helper_shutdown(drm); 805 810 }