Message ID | 20250307083702.142675-1-tzimmermann@suse.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm/appletbdrm: Fix ref-counting on dmadev | expand |
Hi Thomas > On 7 Mar 2025, at 2:06 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > Remove the put_device() call on dmadev. The driver sets the field > without getting a reference, so it shouldn't put a reference either. > The dmadev field points to the regular USB device for which DRM > maintains a reference internally. Hence dmadev will not become dangling > during the DRM device's lifetime. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > Fixes: 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs") > Cc: Aditya Garg <gargaditya08@live.com> > Cc: Aun-Ali Zaidi <admin@kodeit.net> > Cc: dri-devel@lists.freedesktop.org > --- > drivers/gpu/drm/tiny/appletbdrm.c | 1 - > 1 file changed, 1 deletion(-) > Aren’t we doing the same over here: https://lore.kernel.org/dri-devel/20250307080836.42848-3-tzimmermann@suse.de/T/#u
Hi Am 07.03.25 um 10:16 schrieb Aditya Garg: > Hi Thomas > >> On 7 Mar 2025, at 2:06 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote: >> >> Remove the put_device() call on dmadev. The driver sets the field >> without getting a reference, so it shouldn't put a reference either. >> The dmadev field points to the regular USB device for which DRM >> maintains a reference internally. Hence dmadev will not become dangling >> during the DRM device's lifetime. >> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> >> Fixes: 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs") >> Cc: Aditya Garg <gargaditya08@live.com> >> Cc: Aun-Ali Zaidi <admin@kodeit.net> >> Cc: dri-devel@lists.freedesktop.org >> --- >> drivers/gpu/drm/tiny/appletbdrm.c | 1 - >> 1 file changed, 1 deletion(-) >> > Aren’t we doing the same over here: > > https://lore.kernel.org/dri-devel/20250307080836.42848-3-tzimmermann@suse.de/T/#u Yeah. That series is a full rework of the dma_dev handling for all drivers. That won't make it into v6.15. The patch here is a quick fix that we can land immediately. Best regards Thomas >
> On 7 Mar 2025, at 2:48 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > Hi > > Am 07.03.25 um 10:16 schrieb Aditya Garg: >> Hi Thomas >> >>> On 7 Mar 2025, at 2:06 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote: >>> >>> Remove the put_device() call on dmadev. The driver sets the field >>> without getting a reference, so it shouldn't put a reference either. >>> The dmadev field points to the regular USB device for which DRM >>> maintains a reference internally. Hence dmadev will not become dangling >>> during the DRM device's lifetime. >>> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> >>> Fixes: 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs") >>> Cc: Aditya Garg <gargaditya08@live.com> >>> Cc: Aun-Ali Zaidi <admin@kodeit.net> >>> Cc: dri-devel@lists.freedesktop.org >>> --- >>> drivers/gpu/drm/tiny/appletbdrm.c | 1 - >>> 1 file changed, 1 deletion(-) >>> >> Aren’t we doing the same over here: >> >> https://lore.kernel.org/dri-devel/20250307080836.42848-3-tzimmermann@suse.de/T/#u > > Yeah. That series is a full rework of the dma_dev handling for all drivers. That won't make it into v6.15. The patch here is a quick fix that we can land immediately. I see. Acked-by: Aditya Garg <gargaditya08@live.com> > > Best regards > Thomas > >> > > -- > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Frankenstrasse 146, 90461 Nuernberg, Germany > GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman > HRB 36809 (AG Nuernberg) >
diff --git a/drivers/gpu/drm/tiny/appletbdrm.c b/drivers/gpu/drm/tiny/appletbdrm.c index 394c8f9bd41a..4370ba22dd88 100644 --- a/drivers/gpu/drm/tiny/appletbdrm.c +++ b/drivers/gpu/drm/tiny/appletbdrm.c @@ -805,7 +805,6 @@ static void appletbdrm_disconnect(struct usb_interface *intf) struct appletbdrm_device *adev = usb_get_intfdata(intf); struct drm_device *drm = &adev->drm; - put_device(adev->dmadev); drm_dev_unplug(drm); drm_atomic_helper_shutdown(drm); }
Remove the put_device() call on dmadev. The driver sets the field without getting a reference, so it shouldn't put a reference either. The dmadev field points to the regular USB device for which DRM maintains a reference internally. Hence dmadev will not become dangling during the DRM device's lifetime. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs") Cc: Aditya Garg <gargaditya08@live.com> Cc: Aun-Ali Zaidi <admin@kodeit.net> Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/tiny/appletbdrm.c | 1 - 1 file changed, 1 deletion(-)