Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3788842rwb; Tue, 16 Aug 2022 08:47:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ApVAADoJxrdR8vlibByRBc80/6a3G5BEkyj7CMIPSsn823quIYTjJarbV8JZIvzxFynnK X-Received: by 2002:a63:e901:0:b0:422:4d27:5814 with SMTP id i1-20020a63e901000000b004224d275814mr17237935pgh.317.1660664847205; Tue, 16 Aug 2022 08:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660664847; cv=none; d=google.com; s=arc-20160816; b=lWdEv57IKpVz1edvZTHtccV2NzJy7t8UHHSxM+01atVtjn8Q19MiV4wnaXh5Vf5EUx mjYtXRIa/ZTboCm3xAfJEwN3+0D7nj+NMDD7ETwnJHic+xfnLKA16/4b377SUDPtY4p/ P03JEhZTHwiGuCUVXRfb7JsiJFhMQ5TwTkSKv0wYNJmpnSQo5bi37SPEY6o0FPtShKDP DQh6iqcvaz18K6p53q34j34ktJwIZKA/Jza2o83MChSzb7YS23srw0WMVaKeb5vhl6Gr g3Q43bw4fceQb+x+Kouz1dySS3mMuSUd8gyGWbblkTM8AZ44g+dmnJiVVR+1sotOErp+ /P/g== 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=pHL34d884vEyAX73WPysjsG0C4Eu/0Wh82cK/d9bHgs=; b=uBN8fy/CzruQPdTUMYoLcfrKYx0jqPslq0zSs/SAKoJYAjCHXdn625XfRiyk2bU5Ut m71ydF04u38wJUZagPf2E/BrfPx2rTxkgBYjJNqLcQ0CKkas4l03Dx1kt0uYoE9lQCoi pof51lcnxoOrikhhPBKxtMUpY02ahn10EGU3qwD94cGXx0pzsQ3TEY3hjj58F+3O8nPJ Igc+HXDEoX3/RUbgB2XbK9KXtcPUrEDFr09Q7i4XfuEyDGlBHTKCKuLG9WcbMne7+56E pIp8hsHdPUStGrc8law+n2t23cj8HKs3ma7PmvffYFfAbOXId71jgw/umUwcokjr77zg 8rGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LpvOMMdF; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=8tuNAyBS; 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 i130-20020a639d88000000b0041cef4fc749si14442478pgd.176.2022.08.16.08.47.15; Tue, 16 Aug 2022 08:47:27 -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=LpvOMMdF; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=8tuNAyBS; 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 S236169AbiHPPjJ (ORCPT + 99 others); Tue, 16 Aug 2022 11:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236142AbiHPPiG (ORCPT ); Tue, 16 Aug 2022 11:38:06 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A2DC85F97 for ; Tue, 16 Aug 2022 08:37:05 -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-out1.suse.de (Postfix) with ESMTPS id EEEF334896; Tue, 16 Aug 2022 15:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660664223; 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=pHL34d884vEyAX73WPysjsG0C4Eu/0Wh82cK/d9bHgs=; b=LpvOMMdFeC27DfdeWCKELrZn1K42rC2N4C+VuTs9FRM3phQASUxvLIkKarLf6FrdHwSAxw pZWYI0r8AzyuNyUq8o6ZaBKrmBsLT1UlN4hD5Df2wUz5Co/KVDq/RAoOF5NUQ5g7hIb7Vo Z49QLU/ryCAh8UEDxg/zDwAgtJtIP88= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660664223; 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=pHL34d884vEyAX73WPysjsG0C4Eu/0Wh82cK/d9bHgs=; b=8tuNAyBSWlX2/W9ZcItds2vi7blLcybomfvi3tUIw2JegsW3vTyUi3+wTPeMoCcmdw0NIU cg+h9kn4gfDuALCQ== 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 D01EB13B1A; Tue, 16 Aug 2022 15:37:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SH1JMp+5+2LKJAAAMHmgww (envelope-from ); Tue, 16 Aug 2022 15:37:03 +0000 From: Takashi Iwai To: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/12] drm/udl: Sync pending URBs at the end of suspend Date: Tue, 16 Aug 2022 17:36:55 +0200 Message-Id: <20220816153655.27526-13-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220816153655.27526-1-tiwai@suse.de> References: <20220816153655.27526-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 c1f4b6199949..df92f6518e1c 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -294,10 +294,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 */ @@ -305,9 +304,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 bca31c890108..9d72288d9967 100644 --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -391,8 +391,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