Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp167568rwl; Fri, 24 Mar 2023 23:36:04 -0700 (PDT) X-Google-Smtp-Source: AKy350aIyj2ZhtrBZrE2BAqE4jduTnVdoxNwlPR5M/a3gRdCqZPIap6xwEC+5GkIvniJgNyZxhRR X-Received: by 2002:a17:907:174f:b0:7e0:eed0:8beb with SMTP id lf15-20020a170907174f00b007e0eed08bebmr5488400ejc.41.1679726163823; Fri, 24 Mar 2023 23:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679726163; cv=none; d=google.com; s=arc-20160816; b=ROA1us5zVnovMeYKPvBsh5ojsRPD7xOlzCoB1/xt3duoktvHM1tSceeChzjNzMywM+ PHNQqI9aUEQKvglik7FGMy9rdyxMqCXWSQZLfzIifIK+42zQewpqf6Ide0HC48ftOPvC TZWo5WrmE1+17BdNEVjQvPZDX+XYmYWgbx33/EClKvwOP9fBLnjBsVGnTh8LQccWf+8E TYG2IJFE9Cz/lknu3MKIM24LKG2bKmeuYFR/ioI0HCubSh/c2OwYsOTQCuUxISF8xZ5f 1hpk3XThQNAKerbUGbABjM3dA+Ry3ZTrmWu8E/OQUoMMasUPuXdADFSsPxTyhr26MPP/ fRXA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0qD0TFPbs0TI/Ht+pHnVXNVnlLVwTP9r8KFGvBvyt3g=; b=eVodBZsZmtYVb5D7+pyoEyohWPkx9brCLm420wD00XAQbZkBim5OsaPnaHdts2fpdB Y8U1ouypVuTnd6Et4UmLzxhkCB9O7H1QqFCuOvPim7TYtW1utJlRU5drHIgVJvAe0W+d ELEsZkXBqmRU/cDPBjhCku6ZVCtoSLalK25ByTeus5yFKfgzzkRa0dq72DhFx4N3FCTs tBq3jbujYQlleTaBlXYxvqKjZVcjxPpCEwNY0kg2XbotXNcITmKvWx7MEgJx1iLTk+7v pVaaZUC5bpbIAcnd2zkFm856FGRPONiPIMVc+R6PK9iuNSnHJWWQ1OlPl5lhi78tDCcl uqIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NHf8LbYF; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf31-20020a1709077f1f00b009334e181cf0si2838777ejc.47.2023.03.24.23.35.38; Fri, 24 Mar 2023 23:36:03 -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=@linuxfoundation.org header.s=korg header.b=NHf8LbYF; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232157AbjCYG2S (ORCPT + 99 others); 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> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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 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