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 9C39CC6FD1F for ; Sat, 25 Mar 2023 06:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbjCYG2S (ORCPT ); Sat, 25 Mar 2023 02:28:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjCYG2R (ORCPT ); Sat, 25 Mar 2023 02:28:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FF8112F0E; Fri, 24 Mar 2023 23:28:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9E8386092A; Sat, 25 Mar 2023 06:28:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81894C433EF; Sat, 25 Mar 2023 06:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679725695; bh=AID5p0dG053yTqXLpCwTEFwzg93U5EvidE5/+N37y6Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NHf8LbYFfIzDN0p/DPyZ9hR6ptR/XNwwsVSTTGnmLRLOltg76NQfoEg+qgPn1AO0z a75UZ3Rmv0/OCQf9oCbR9oT2AVyQ0UFWfW2MpfBtQoJoZdM+Bm4NZq3nxwTbFOfnaI DyioCmda9cDflHX0JqGRffkqRGwCGp6b2xk+aHU0= Date: Sat, 25 Mar 2023 07:28:12 +0100 From: Greg Kroah-Hartman To: David Gow Cc: Matti Vaittinen , Maxime Ripard , 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: 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 In-Reply-To: <20230325043104.3761770-3-davidgow@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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. > > Add two KUnit-specific functions for registering and unregistering a > struct device: > - kunit_device_register() > - kunit_device_unregister() > > These behave similarly to root_device_register() and > root_device_unregister() except: > - They take a struct kunit pointer with a test context. > - They do not create a root device directory in sysfs. But they show up in the root directory in sysfs, in /sys/devices/ which is not a good place to be. Why not make them part of a class, perhaps called 'kunit', so that they will be in a contained place? thanks, greg k-h