From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AB08C76195 for ; Mon, 27 Mar 2023 13:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229525AbjC0N6B (ORCPT ); Mon, 27 Mar 2023 09:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbjC0N57 (ORCPT ); Mon, 27 Mar 2023 09:57:59 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE911711; Mon, 27 Mar 2023 06:57:58 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C499E320092C; Mon, 27 Mar 2023 09:57:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 27 Mar 2023 09:57:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1679925476; x=1680011876; bh=xGJXbEhrl91uNM1/D3zlzsQqHed5bWXL+CG 9EThtPTA=; b=U8nVqssP+oT54AqwEyOYS5gWpuGWPxYnrmh5eZ00saX4Vs7z4ST VP0hCQWthFZr0Kfz91iBon6mUqJ8bfLXVQhiRHDrlnn2L8l0ECIQlJCUjeqLO2ea XE8RRjfPjnS2HJzbb5mbMg4CNKFvfJMD+7k/Np1PFKpBAGNxNN7PsseQryKtpfAN EI3XJ3NX14fS7cxuXFOmW79xuwtlPOnLKF0q/JoRIPSsRHdiuedleXp3EIyU9jI5 Suv9WXxMTtiH2nqzisaxSJxWhghP02Qc0eEPnCC6I0I1gvFZBT2RwrYIpBqBNefG yu4m5ALvym9vjc/sLpEqeQJpA7bHdXRNpsw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1679925476; x=1680011876; bh=xGJXbEhrl91uNM1/D3zlzsQqHed5bWXL+CG 9EThtPTA=; b=kAh+8Dej35XHTK1kFnCco+p2tcyw65wsi9Yu9ahSbXsvIAAIHAW vtV70adwEs1B418lpm8/L9Y+jMTTpeimrZdnWo+YBWPT0+2RhfhuDOeOx/CUgX2m tE8act0TL4Yp88jQBfT1lG7HkpDdmzB3NY3VhTXfRDKd3ApQkSUG1kYezt9mZQ05 9B6/EtBCYjgeg3EZy4j6SapfncAwufTOneSmgN5CwenXqoKxuEUbms/LreFlaYvR 4RAJOSUS6zV28DHBXc8fr7hODI88bktVx02sPJnYu/K1XkmBiUUSwbkDWxUE15hm TUi2lBvDc9IfGkm1JS7Z24j+tVHdpQ14ZXg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehvddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggugfgjsehtqhertddttddvnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnheptefgleeggfegkeekgffgleduieduffejffegveevkeejudektdduueet feetfefgnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Mar 2023 09:57:55 -0400 (EDT) Date: Mon, 27 Mar 2023 15:57:54 +0200 From: Maxime Ripard To: David Gow Cc: Greg Kroah-Hartman , Matti Vaittinen , Brendan Higgins , Stephen Boyd , Shuah Khan , "Rafael J . Wysocki" , Andy Shevchenko , Heikki Krogerus , Jonathan Cameron , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Subject: Re: [RFC PATCH 2/2] kunit: Add APIs for managing devices Message-ID: <20230327135754.tadvfirhixbhatxy@penduick> References: <20230325043104.3761770-1-davidgow@google.com> <20230325043104.3761770-3-davidgow@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230325043104.3761770-3-davidgow@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Hi, On Sat, Mar 25, 2023 at 12:31:04PM +0800, David Gow wrote: > Tests for drivers often require a struct device to pass to other > functions. While it's possible to create these with > root_device_register(), or to use something like a platform device, this > is both a misuse of those APIs, and can be difficult to clean up after, > for example, a failed assertion. >=20 > Add two KUnit-specific functions for registering and unregistering a > struct device: > - kunit_device_register() > - kunit_device_unregister() If kunit_device_register() registers an action to clean up after the test has ran, I'm not sure why do we need kunit_device_unregister() I guess the typical test would just call kunit_device_register() and be done with it, right? Maxime