Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7380386rwl; Thu, 23 Mar 2023 03:38:46 -0700 (PDT) X-Google-Smtp-Source: AK7set9QZFArobr+3XODOzWVZHx4avGLVTCLp+f0lvDol4ML8oIAZKvsDRG4VaNUDLJ7N7JdsRzT X-Received: by 2002:aa7:de82:0:b0:4fa:e187:64d1 with SMTP id j2-20020aa7de82000000b004fae18764d1mr8376888edv.38.1679567926117; Thu, 23 Mar 2023 03:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679567926; cv=none; d=google.com; s=arc-20160816; b=bfqnC9AfNPv8jqlc+mQ/76MHxTlR9d8aOafqLQCxB7ESaTLAmDkEDoOzIfTgsJtb7P TD15XOlDMDd9WBmTL0F3mjIKAmIhW62xrhwSw3NlDSsvijIaBVIVVR2aF2kHBVD5Bl8Q /W72jWKQE4Jl7EguWibuF8s5ZmrjNRlkFUsNeBDYK8uJFjZlUroWd+nfyJg5fmsQfjWB bISoO0uY9Liw261rjBloyh9lWeBz0CutIeZfCt+bwp+/gKM0LBKs66KkpKcj35B5ksiy F3Ym1RR5bN0PC3dl8N1uaHTSfVk0gM3UkYw6fN7WVLWG4UFTQNVbYuMduskXLS8o+70t fzrw== 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=fV5kXs91nN/UoC9l5KtcxCrV3IbkiRTzeh69GP7N2mo=; b=MB1sIgOvDHWJk3YxB0lh69k4DpB5Kb9qZpCoJuV/PAcO/q1CCse8LrV4a2hQV+2qJ7 LnAc2h4+F+po+bH1+jT/atpZg43dw+LOELYJJXZBf6RtGhOgUUwNbrYDpGKxFJgIfg+v vNyFG7fGICfRPy8dIWnAb8wY9sAHrYdNx5EoGpnFHEc5lE0OrDYO6JIm1d4HzSuYauIV 2bGWFtp0vCTOFht2q6chW8WLMbBh8oKsmrDCejhsS5YEhb8SToQ2dq0QG9yu+qWQaOpa 7+eVaPQzHrIGcIYBWefpcSLUHGoZLvS3GT/AK3jjjSHBOZS07ckyhPHPjEDB/SAE+tDZ d4+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0A/+uutT"; 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 pk6-20020a170906d7a600b009318617354bsi16493071ejb.648.2023.03.23.03.38.22; Thu, 23 Mar 2023 03:38:46 -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="0A/+uutT"; 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 S231387AbjCWKad (ORCPT + 99 others); Thu, 23 Mar 2023 06:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231402AbjCWK3a (ORCPT ); Thu, 23 Mar 2023 06:29:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF2FD37B61; Thu, 23 Mar 2023 03:27: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 ams.source.kernel.org (Postfix) with ESMTPS id 92EB3B82061; Thu, 23 Mar 2023 10:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD0D3C433D2; Thu, 23 Mar 2023 10:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679567232; bh=c/vQUcp/ujxifAraGE6RpYgcNOCvYwMVfshFRlfNTfs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0A/+uutTDkMSDW98f5fsDSzNol/TcTNI/MNcxcDs7yUY8CiQr6sfALtNZM7y1lNqD kMbNTiSIt+VJdpKNb6CutRbMv3xGJRs6NUi9ERrO4qUQ8c3ZCbC9btna/G4pwAE2As EYJkwniG61ulHDqrjvkRuL62fhpbW9LVaCkuRy3U= Date: Thu, 23 Mar 2023 11:27:09 +0100 From: Greg Kroah-Hartman To: Matti Vaittinen Cc: "Vaittinen, Matti" , "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 , Maxime Ripard , Jonathan Cameron , "linux-iio@vger.kernel.org" Subject: Re: [PATCH v5 1/8] drivers: kunit: Generic helpers for test device creation Message-ID: References: <25f9758f-0010-0181-742a-b18a344110cf@gmail.com> <12ea1d68-2a3c-0aa7-976c-7bd3eef35239@fi.rohmeurope.com> <91c8dc84-8eae-15d9-3d55-976c2c806421@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91c8dc84-8eae-15d9-3d55-976c2c806421@gmail.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 Thu, Mar 23, 2023 at 12:01:15PM +0200, Matti Vaittinen wrote: > On 3/23/23 10:58, Greg Kroah-Hartman wrote: > > On Thu, Mar 23, 2023 at 07:17:40AM +0000, Vaittinen, Matti wrote: > > > On 3/22/23 20:57, Greg Kroah-Hartman wrote: > > > > On Wed, Mar 22, 2023 at 03:48:00PM +0200, Matti Vaittinen wrote: > > > > > Hi Greg, > > > > > > > > > > Thanks for looking at this. > > > > > > > > > > On 3/22/23 14:07, Greg Kroah-Hartman wrote: > > > > > > On Wed, Mar 22, 2023 at 11:05:55AM +0200, Matti Vaittinen wrote: > > > > > > The biggest thing for me is that I don't like the idea of creating own 'test > > > > > device' in while we already have some in DRM (or > > > > > others). Thus, I do see value in adding generic helpers for supporting > > > > > running KUnit tests on devm_* APIs. Hence it'd be good to have _some_ > > > > > support for it. > > > > > > > > I agree, let's use a virtual device and a virtual bus (you can use the > > > > auxbus code for this as that's all there for this type of thing) > > > > > > Hm. The auxiliary_devices require parent. What would be the best way to > > > deal with that in KUnit tests? > > > > If you use NULL as the parent, it goes into the root. > > As far as I read this is not the case with auxiliary devices. Judging the > docs they were intended to be representing some part of a (parent) device. I > see the auxiliary_device_init() has explicit check for parent being > populated: > > int auxiliary_device_init(struct auxiliary_device *auxdev) > { > struct device *dev = &auxdev->dev; > > if (!dev->parent) { > pr_err("auxiliary_device has a NULL dev->parent\n"); > return -EINVAL; > } Yes as it wants to "split" a device up into smaller devices. So make a real device that it can hang off of. > As I wrote in another mail, I thought of using a root_device for this IIO > test as was suggested by David. To tell the truth, implementing a kunit bus > device is starting to feel a bit overwhelming... I started just adding a > driver for a light sensor, ended up adding a helper for IIO gain-time-scale > conversions and I am slightly reluctant to going the extra-extra mile of > adding some UT infrastructure in the context of this driver work... I think it is worth it as the driver core has no tests. So it obviously must be correct, right? :) thanks, greg k-h