Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87E962AF1D; Thu, 18 Jun 2026 01:31:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.194.254.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781746326; cv=none; b=fEoingmiYKgxQZrdn8Oq+kpImKib2ypKcw32wz8Xp9WHE7JnDTvRJnjWthKrgD+QdlRYTedL6Dk/5ckQd86QCebZxpvTuk6CGAyfIjby9vXIymvWaveNeYRO5xCRGPEt3LI8gdX7sGLYzF9f7zX1Ont8AcQiZU+YflocfhxCksU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781746326; c=relaxed/simple; bh=BN3HOsEgWlvUWdTzGM/7bMKC1H0GMmZnPty4uJ5J3zY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FDYNj0XG112E8ENeSXtH01jOvnw0zxNDE5koTQzWJpUXg+3cGBNHsWNXe0C10AJPLMMMzaHie8ZfAxaqQkysmoV4UhB9n1isoZyNqZgtpycNdDu4FuqjUofzUUe3pA+Vu+/UtIyHvh6S/U939HaNcBpehuElFp71s7P9QhaPgBk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=pZaTx82R; arc=none smtp.client-ip=18.194.254.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="pZaTx82R" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1781746310; bh=XuyqIVk4TA83mMek4q/hmkWntBwGcXqXYtOybwsn4DY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=pZaTx82Rw0cm4NWhuwz7r5DAuRtPaiPJseg+giMvGPGyqnEc5InLJimABYeyiYPRX UfKCTMlJ9nonht8AyQ4GoEQkp8rrqmr/neD+UwUhu+JHNZsKX7M0HBjBvJEkATsDiq Rx2EF2EfMkEeREj9F4oPjvi5g5VX+ZgB9jpY+2T4= X-QQ-mid: esmtpsz10t1781746301td878c4d8 X-QQ-Originating-IP: /fn3H90OKJPyg9TAzppitqhppYgXFYix1ahqvTzODAA= Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 18 Jun 2026 09:31:38 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 3030917331799414675 EX-QQ-RecipientCnt: 15 From: Haowen Tu To: rafael@kernel.org Cc: tuhaowen@uniontech.com, gregkh@linuxfoundation.org, hansg@kernel.org, kernel@uniontech.com, laurent.pinchart@ideasonboard.com, lenb@kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, mchehab@kernel.org, oneukum@suse.com, pavel@kernel.org, stern@rowland.harvard.edu Subject: [PATCH v3 0/3] PM: hibernate: skip UVC streaming restart after snapshot Date: Thu, 18 Jun 2026 09:31:30 +0800 Message-Id: <20260618013133.1047270-1-tuhaowen@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20260602032413.1540166-1-tuhaowen@uniontech.com> References: <20260602032413.1540166-1-tuhaowen@uniontech.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SEN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4Qe5s6nwL6DAkBylQ129Xw0vD0Er6kZDFCiguoeaGEuY0y +Uxr06G57sWOs75QRIvXySoNsxLmMFGWcp3EkotA== X-QQ-XMRINFO: MSVp+SPm3vtSI1QTLgDHQqIV1w2oNKDqfg== X-QQ-RECHKSPAM: 0 After a hibernation snapshot is created, devices are resumed with PMSG_THAW before the image is written and the system is powered off. USB interface driver resume callbacks do not receive the PM event, so they cannot distinguish this phase from PMSG_RESTORE. This series first makes the lifetime represented by in_suspend match the snapshot memory lifetime, then exposes that state through pm_hibernation_snapshot_done(). The helper only exposes the PM state; drivers remain responsible for deciding whether device-specific behavior is safe, including subsequent poweroff or shutdown handling. As the first user, uvcvideo skips only restarting active streaming hardware during the transient THAW phase. Its frozen state and clock are still updated, a subsequent UVC suspend can stop the stream as usual, and uvcvideo does not provide a shutdown callback that requires the streaming hardware to be restarted first. Changes in v3: - Split the in_suspend cleanup into a separate patch, as requested by Rafael. - Reword the helper description to clarify that it only exposes PM state and that callers must account for poweroff/shutdown handling. - Restrict the UVC description to skipping the streaming hardware restart and explain why it does not prevent UVC shutdown handling. - Drop extern from the new prototype to satisfy Media CI checkpatch. Changes in v2: - Rename pm_hibernation_storing_image() to pm_hibernation_snapshot_done(). - Clear in_suspend before releasing snapshot memory on failure paths and after swsusp_write() returns. - Move the UVC check after clearing the frozen state and resetting its clock. Haowen Tu (3): PM: hibernate: clear in_suspend before freeing the snapshot PM: hibernate: add pm_hibernation_snapshot_done() helper media: uvcvideo: skip streaming restart after hibernation snapshot drivers/media/usb/uvc/uvc_video.c | 8 ++++++++ include/linux/suspend.h | 2 ++ kernel/power/hibernate.c | 24 ++++++++++++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-) -- 2.20.1