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 22541C6FD1C for ; Thu, 23 Mar 2023 10:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbjCWKMZ (ORCPT ); Thu, 23 Mar 2023 06:12:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbjCWKMW (ORCPT ); Thu, 23 Mar 2023 06:12:22 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FCDB12BC4; Thu, 23 Mar 2023 03:12:22 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 1A02932001C6; Thu, 23 Mar 2023 06:12:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 23 Mar 2023 06:12:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc: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=1679566338; x=1679652738; bh=cZ xHKXBZ21bZ6K9A2HYjfRbp4aeJPjlsC5O/xK/dOIE=; b=P/ahRNyon56M8IZuK1 ywYfTgXwzwN+dPwd8hhNDADBtCjZdyQhRFlXHY10himQfH+gUi1Z9mePUo56K/7p gMQ2e9kqE9mTi59ucP12oxgpFPun4WsDBnuYq7+rngBmpUC6hhsX1Ttc35/T4JQ3 pgU9iQ/CHz9b6WdDY5ocFUazQXkMlBoa3DUSaqsvG2n9PdtCFSy2NxuRd6JPWzav 1Nw3jyuysE5ayy6KH/020i/SJP5Vy9ObKD+SutpmOPaS6tnJKxJ4m+MviYUGOqTy ElOIltjCcQfR4Y0Z7E93pWgX2vnfC2EUx9qwAqURSg450qcW5z8lpUvMDREUvVJs MLng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1679566338; x=1679652738; bh=cZxHKXBZ21bZ6 K9A2HYjfRbp4aeJPjlsC5O/xK/dOIE=; b=KfcP3+xUf+8DB0z3agWxrRSu95Wmv TrxhgBRBsA+AeDCv9SuhqXdu9dWU+vANITnezTsq2nGvEY8AIZEpvkWjwEV0iWSV Bqo0Lks+fj9cyXRthBSvIDayKbm0SvYs/r+bJd2TBcOn7HYOQuMShYWiG2N/2KaJ G27cdjAc1sqRiGlfRxnFhqNYLdKxXWpeIxwHNZSzRme05QuKxFbA5OwiACHwStUt 7zEpA0ojGHrHstbzW6Ida0i+zVpll4ShGevbNuyW2hMDj4W9faVQ1j6UVIzUvHkz yAOHdQ//Eh/4P7c0V7gsr827pNvdMevMFinVm5QBAhRahALsdT/NK05oA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeggedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeetfefffefgkedtfefgledugfdtjeefjedvtddtkeetieffjedvgfehheff hfevudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Mar 2023 06:12:17 -0400 (EDT) Date: Thu, 23 Mar 2023 11:12:16 +0100 From: Maxime Ripard To: Greg Kroah-Hartman Cc: Matti Vaittinen , Matti Vaittinen , "Rafael J. Wysocki" , Brendan Higgins , David Gow , Andy Shevchenko , Heikki Krogerus , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, Stephen Boyd , Jonathan Cameron , linux-iio@vger.kernel.org Subject: Re: [PATCH v5 1/8] drivers: kunit: Generic helpers for test device creation Message-ID: <20230323101216.w56kz3rudlj23vab@houat> References: <25f9758f-0010-0181-742a-b18a344110cf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="o473qzwbd5lb4d5q" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --o473qzwbd5lb4d5q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 22, 2023 at 07:57:10PM +0100, Greg Kroah-Hartman wrote: > > > > +/** > > > > + * test_kunit_helper_alloc_device - Allocate a mock device for a K= Unit test > > > > + * @test: The test context object > > > > + * > > > > + * This allocates a fake struct &device to create a mock for a KUn= it > > > > + * test. The device will also be bound to a fake driver. It will t= hus be > > > > + * able to leverage the usual infrastructure and most notably the > > > > + * device-managed resources just like a "real" device. > > >=20 > > > What specific "usual infrastructure" are you wanting to access here? > > >=20 > > > And again, if you want a fake device, make a virtual one, by just > > > calling device_create(). > > >=20 > > > Or are you wanting to do "more" with that device pointer than > > > device_create() can give you? > >=20 > > Personally, I was (am) only interested in devm_ unwinding. I guess the > > device_create(), device_add(), device_remove()... (didn't study this > > sequence in details so sorry if there is errors) could've been sufficie= nt > > for me. I haven't looked how much of the code that there is for 'platfo= rm > > devices' should be duplicated to support that sequence for testability > > purposes. >=20 > Any device can access devm_ code, there's no need for it to be a > platform device at all. Sure but the resources are only released if the device is part of a bus, so it can't be a root_device (or bare device) either Maxime --o473qzwbd5lb4d5q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZBwmAAAKCRDj7w1vZxhR xcNBAQDSXxwFY9SnlOiifKsShUzZ9vn3t2jQGwBUwDob7I57jAD/c0M4qZV5QxOp 2nfAsQutY88p59v6z9OzS6W/PqsxaQo= =NWug -----END PGP SIGNATURE----- --o473qzwbd5lb4d5q--