Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4014179rwb; Tue, 6 Sep 2022 00:46:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pC8ACBjVWLs72MWHiv4UmJb/V1PYkCrnIXjbd693qkjFlWsyUaJMgx6UtWi+aE89k3fYA X-Received: by 2002:aa7:da86:0:b0:44e:91c8:eb4f with SMTP id q6-20020aa7da86000000b0044e91c8eb4fmr6370128eds.252.1662450362429; Tue, 06 Sep 2022 00:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662450362; cv=none; d=google.com; s=arc-20160816; b=dV4OKc+SqJHYJYYZOlXe4yx/rw152Ekf4Erk6a9kzA1wOD7PRz1WOKsLfPcvgaYuXq kIOU2/LM75RzGJc+XLN0+0EfDG0wYKcMAz3o714dlDjsy26frPeJoGSF66oI+BvN6Wen 1Ab2wO897zKBPeeqP5hDdIwL7Rrn5VUNo2CasNfHEv41kPTGrj/y6lD4kvqOS6RIEfsO PlUlpbPsc9HhLC8Yo2j6hCyIcSvP8qDjCSMcoRpGVA9/3bMDRJG/LDsKvQmq3GP+m3Z0 onOFc8MfH8u67NOx0rx5A7KSHHkUexy3CK4SkyL9sDRIZsp7JnDUtqwjbrOwU8wMw3AE ZnIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=/LFTqDuydXWR/bPD9hQViahx4U6njcXCTOhibvk3UoQ=; b=nhNK1KK6Oe2UQrKyTz7X5UoK9Vdu/AO2KuNonLhSYesVVYwEEIBMbmffpPjzxEjHzi ZHuxh7MSPQsfCrXO5MPHJXCJk1qZft+AhdXXDZOYhe4YanhYaPWfBxlKHJ3qO4WMZ25w OyU4BNSkJJnNxR1kvZPxpCSCyBrJOEOLTJx8BbffncxPA3hn7WKJ0qoUNEEAKsXrFYIi dQCyQsePkXRAeNCKiFiasr1D9mJbkmNMXHfb+MkIKC1yytuOeUciz1QgDXqYWX67WzRV fTlnE0lLzLJozE0Yne2WQj+7hnzds4NeysOgP+VilyjvhyzAYO5VZm1UqTEtgfIqOhAX qI7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=T8AyymTI; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=o+Trv7a0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id va8-20020a17090711c800b007318692f59csi7795746ejb.935.2022.09.06.00.45.35; Tue, 06 Sep 2022 00:46:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=T8AyymTI; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=o+Trv7a0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238999AbiIFHkf (ORCPT + 99 others); Tue, 6 Sep 2022 03:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233731AbiIFHj6 (ORCPT ); Tue, 6 Sep 2022 03:39:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D44C55F99 for ; Tue, 6 Sep 2022 00:39:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7693B1F96B; Tue, 6 Sep 2022 07:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662449996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/LFTqDuydXWR/bPD9hQViahx4U6njcXCTOhibvk3UoQ=; b=T8AyymTIZr/Ebvrc7Qa13DSJSLxyQwNfgwjeOVa/rAUYoQAN0SAl8n6Euyzk4mGnWwBS5D qf3NecGK8Qj18E6v/1VCujvQkq1QZqWs2D/T2lI2H4rpa31xdjVmP3qx2jdDp8LVFArmXf ZXL1aDFyhIu+LLmDOLMMsyCaS3nukwI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662449996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/LFTqDuydXWR/bPD9hQViahx4U6njcXCTOhibvk3UoQ=; b=o+Trv7a0cP5gDj65ak9jkFbUtmg8KW7jeP5lwna70WKobrIZ7Hhee/kIJ5J2+nHBmBMT/U RbtD/4yJA6JlDSDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3EA3B13A7A; Tue, 6 Sep 2022 07:39:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8FYyCUz5FmPeOgAAMHmgww (envelope-from ); Tue, 06 Sep 2022 07:39:56 +0000 From: Takashi Iwai To: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/11] drm/udl: Sync pending URBs at the end of suspend Date: Tue, 6 Sep 2022 09:39:51 +0200 Message-Id: <20220906073951.2085-12-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220906073951.2085-1-tiwai@suse.de> References: <20220906073951.2085-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's better to perform the sync at the very last of the suspend instead of the pipe-disable function, so that we can catch all pending URBs (if any). While we're at it, drop the error code from udl_sync_pending_urb() since we basically ignore it; instead, give a clear error message indicating a problem. Signed-off-by: Takashi Iwai --- drivers/gpu/drm/udl/udl_drv.c | 8 +++++++- drivers/gpu/drm/udl/udl_drv.h | 2 +- drivers/gpu/drm/udl/udl_main.c | 6 ++---- drivers/gpu/drm/udl/udl_modeset.c | 2 -- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 0ba88e5472a9..91effdcefb6d 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c @@ -21,8 +21,14 @@ static int udl_usb_suspend(struct usb_interface *interface, pm_message_t message) { struct drm_device *dev = usb_get_intfdata(interface); + int ret; - return drm_mode_config_helper_suspend(dev); + ret = drm_mode_config_helper_suspend(dev); + if (ret) + return ret; + + udl_sync_pending_urbs(dev); + return 0; } static int udl_usb_resume(struct usb_interface *interface) diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index d943684b5bbb..b4cc7cc568c7 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h @@ -77,7 +77,7 @@ struct drm_connector *udl_connector_init(struct drm_device *dev); struct urb *udl_get_urb(struct drm_device *dev); int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len); -int udl_sync_pending_urbs(struct drm_device *dev); +void udl_sync_pending_urbs(struct drm_device *dev); void udl_urb_completion(struct urb *urb); int udl_init(struct udl_device *udl); diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 808a5ab5e14e..442080fa1061 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -290,10 +290,9 @@ int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len) } /* wait until all pending URBs have been processed */ -int udl_sync_pending_urbs(struct drm_device *dev) +void udl_sync_pending_urbs(struct drm_device *dev) { struct udl_device *udl = to_udl(dev); - int ret = 0; spin_lock_irq(&udl->urbs.lock); /* 2 seconds as a sane timeout */ @@ -301,9 +300,8 @@ int udl_sync_pending_urbs(struct drm_device *dev) udl->urbs.available == udl->urbs.count, udl->urbs.lock, msecs_to_jiffies(2000))) - ret = -ETIMEDOUT; + drm_err(dev, "Timeout for syncing pending URBs\n"); spin_unlock_irq(&udl->urbs.lock); - return ret; } int udl_init(struct udl_device *udl) diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c index 9896c16c74f5..c506fff8f0c4 100644 --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -383,8 +383,6 @@ udl_simple_display_pipe_disable(struct drm_simple_display_pipe *pipe) buf = udl_dummy_render(buf); udl_submit_urb(dev, urb, buf - (char *)urb->transfer_buffer); - - udl_sync_pending_urbs(dev); } static void -- 2.35.3