Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2915700rwl; Mon, 27 Mar 2023 07:02:59 -0700 (PDT) X-Google-Smtp-Source: AKy350bl/GtIJSyiJRmEqLHQUdt/kL7+xFvDepNB1fSBRExt8EOhQpgtHFDbl1aFhb1atZhRJLDA X-Received: by 2002:a17:906:7fd1:b0:86f:64bb:47eb with SMTP id r17-20020a1709067fd100b0086f64bb47ebmr12607516ejs.3.1679925778729; Mon, 27 Mar 2023 07:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679925778; cv=none; d=google.com; s=arc-20160816; b=r9O/jpphDVlpvGpJGWPWR6W1DruA+pj3+Z83QYCQqkp25wtPjJewfotmwu8qKxp9Um VSkfdNtV49IkIjfvHioMcXLkvevEnsPYyH6GbcJ4M9iae+Jnq9/Fel0W4D3808lKuqHw sS8xYmVS/dOQQA9s4YHq3MsQ/lM6EcX6mBql9MSG6KjXJHM22RG3PFb0bsK/sp7EtCGe ODrxUd3Q6479rA867vhGkJdTKCSYbFzcRBKXfQDz96+6wRWBeyLwEIOG68LQy/OrF1cp cQqq8abUULJab/usttl7pPlP1TahywR3Ql8517fV2IERYqFaPxZHeJ0ecnvdcWQPnipD 75gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=xGJXbEhrl91uNM1/D3zlzsQqHed5bWXL+CG9EThtPTA=; b=zNvBEhfT5IvGxPJdnC/MO/TrSbY/j/c9OlWmadmV8jn/VkvOI4QqqnntFtwIu5yDID Op33oyk6zfEnIDq5DIQlO4JvtNapoZucbLeONlJ8thVGz8NrK6/U7cox95kwB7z1M34A GpDMFHgcINTDVept2/6n3I8ue1pRoGsoxwO3RG9TXlZ/YSVCyMHa5ZzG7fiuKQ0tteZj xHpfmsAHvmFjQiN7jawtd6D3vGbwH2bmft96WMjvtG5YnzLjAOoCUBg5GLBIzuHhn3k0 1Ht0+T4ZiVTFsy3vXVYVQ3a6/YiLM8UECajRvAuCjfV/mHGO+oIVlwuZHc2SEV543nhj jarg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=U8nVqssP; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=kAh+8Dej; 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=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a1709065d0b00b0093e1afb0b11si7344698ejt.852.2023.03.27.07.02.24; Mon, 27 Mar 2023 07:02:58 -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=@cerno.tech header.s=fm3 header.b=U8nVqssP; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=kAh+8Dej; 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=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbjC0N6C (ORCPT + 99 others); Mon, 27 Mar 2023 09:58:02 -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> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 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