Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6793564rdb; Fri, 15 Dec 2023 08:27:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFc2v/jbqegjO06MSGtFSSFmJcos77K7AReyKloAGNa3lD3WCzJ1aNPfxRysBbPdoYSbLC X-Received: by 2002:a17:90a:730c:b0:28a:cbce:71ab with SMTP id m12-20020a17090a730c00b0028acbce71abmr3305820pjk.13.1702657632039; Fri, 15 Dec 2023 08:27:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702657632; cv=none; d=google.com; s=arc-20160816; b=iBNyBIt6lnUkqgWj8wZjFsXY0E09xi7a0+ujgn+XqJnxt8NtPI7MkWvnSHtquEmjfj XG8xJSGy6H9kGGuMJQlCk9EhNTMnOi1DLs0rTZ7f9YR9AP3JAX5trzH5Hh61tp66EccH J1F2vx1TgDveP+uOlHGFY7TlX5bs9LjVAVWGNNl7HtKQplgS/VKAzOMqHWEoijvz0ecu Br1nDq7SiaYs/Vm3ReXK5zX98Lm6zhyLMW07+Ps3427I3uBNzUNBHxeuHNlg6UI9WVO8 LtSrr8KvvzSc5u7jZ/ZQAJMVicAbqD88AGgoVFTYAWhfIm7JFUje+o6gFWnAUCuMwpm5 9+Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JhrGeo8aZchh5HkvNJfqZdke9msTdnLlWbn+40JchPQ=; fh=bqho5+DluhI0sqBIaNt9ylVScwZOmbMAY6m92rchEkk=; b=EfjEma3l4DflDLVy2HX8qykTya5tOP8Y2a0tNzJ7X7Ca1VT6y/prrfPwel8Ele7eax eyNabCauOBwNosTJjStbM6EJ/7ZvIRmdWpeUoKvdmzfUla+IgRE9PS/ipwdR6OKDV0BN 6bmWKNd9ZoyjU3Zix0UmdF+q7OHnuLzWKnoLnpsumCEye48TRLFu5Rc0pAfO9frwhYyk M/aw+nryPPnfXMsMHW5QqtvtP4M5QD7dDnQDlWP0QJXQ0gYzC/agmbNnT+CFvC4FCXLJ BMKUeiNMa5a8qne/7/oo13jj+ci9qMCSSHxDlpoNFcF6G6Gz7xi3NjpwASVakFu65TvS Teqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ecKLawn; spf=pass (google.com: domain of linux-kernel+bounces-1288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l11-20020a17090b078b00b0028862eb4331si13238300pjz.97.2023.12.15.08.27.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 08:27:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ecKLawn; spf=pass (google.com: domain of linux-kernel+bounces-1288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8965A284362 for ; Fri, 15 Dec 2023 16:24:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 749A23C486; Fri, 15 Dec 2023 16:24:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1ecKLawn" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8C0C53BB2E; Fri, 15 Dec 2023 16:24:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA47C433C8; Fri, 15 Dec 2023 16:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702657465; bh=3ivctDNpxY6QN16Fx9iYaWrSP3bP36OnVGA1x0bMy7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1ecKLawnXRWIdI/i7mKpw840sXuWr4k8MRWaZ3qDBAoNDxF8hp4n/Y/EQqig5ct6M q3OSxVI3cODnARqGoa06xs6iFe//H657653/uumd4qLZ+YQFrZOffqDlsFmJBcUHQx U5FChq/bAohwoFx5J3qjTOrzqkAYQaSITTgejdcw= Date: Fri, 15 Dec 2023 17:24:22 +0100 From: Greg Kroah-Hartman To: davidgow@google.com Cc: Rae Moar , Brendan Higgins , Matti Vaittinen , Stephen Boyd , Shuah Khan , Jonathan Corbet , Kees Cook , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Maxime Ripard , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-sound@vger.kernel.org Subject: Re: [PATCH v4 1/5] kunit: Add APIs for managing devices Message-ID: <2023121512-handcuff-unstable-63ed@gregkh> References: <20231215-kunit_bus-v4-0-4f5160e2f95e@google.com> <20231215-kunit_bus-v4-1-4f5160e2f95e@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231215-kunit_bus-v4-1-4f5160e2f95e@google.com> On Fri, Dec 15, 2023 at 03:39:08PM +0800, davidgow@google.com 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 some KUnit-specific functions for registering and unregistering a > struct device: > - kunit_device_register() > - kunit_device_register_with_driver() > - kunit_device_unregister() > > These helpers allocate a on a 'kunit' bus which will either probe the > driver passed in (kunit_device_register_with_driver), or will create a > stub driver (kunit_device_register) which is cleaned up on test shutdown. > > Devices are automatically unregistered on test shutdown, but can be > manually unregistered earlier with kunit_device_unregister() in order > to, for example, test device release code. > > Reviewed-by: Matti Vaittinen > Reviewed-by: Maxime Ripard > Signed-off-by: David Gow Nice work! Reviewed-by: Greg Kroah-Hartman