Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2065605rdf; Mon, 6 Nov 2023 03:59:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbJm6Yac24a6+amqi81pcDqBZNxrQlMETsvDjsAtqk26HBWZEElXyIDd3kRjhocjENsqVD X-Received: by 2002:a05:6870:3326:b0:19f:aee0:e169 with SMTP id x38-20020a056870332600b0019faee0e169mr39322800oae.30.1699271958900; Mon, 06 Nov 2023 03:59:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699271958; cv=none; d=google.com; s=arc-20160816; b=OMd3cP978i8H5bBZWKgIxdWEkxzELoKCOvOopBGbSkJCa75v86JZ2JbCeKgnd9tB6w RSXwD0yoXuBMUDo1wtxfC9ovhMt4a/1TtxFkiGbMr48RRIF9SWzsXkJDlhCb062gqfH6 UXLaeekJog49HkWndq+77lHm1usdkdCLieJiINrFcPsaV4t9B/aANQewltvBIFha0YBC yIFQxmluABFNHzxgvuqCpAe8k8vxxQHJ4Ek3rKWkcfLT13jKYl0/pCZkg8twZM6RAwzz aG8luLK6n32nLGY9K3JZlVh8XuZwswlq8KN2CWU12rE6my0ghDff7J3/mjXrSsKVFCWq Hvkg== 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=p1HCVCDfnorR/CadgpOFZHmSzSR4izez9nowt39DPYc=; fh=i3nksK0CuRnhYhsJFfMCFrH9bJCXMIdEW910IkLebn0=; b=fu/43oY4wr9ddc3BqM/s1HVNWcQ8BXGudGrEt1M54bxcpCjZqJfoE8zCKABFgLLczi vHvCS5BrVdz1OZefxM9hcSqK1AFZDFQx7JrO1iGY50w7giwQwX1AZ2Qyfa69h4rqa4nq l5Twf1jXP3ISwQHIYozj9VI8beW4mI38h7cfOc97hmCZg8IHyO7di9JkPvMtzpNmpPKw lZcgVSuYyg/INlxgysV4nderHxF15x3osdHrwhxtdbmdoQaw2a3wsFL2lWknNLAdkV09 U8tV/lWwKZ3+WtCuPvC70PNwd1P1MCtR4oOE+DDfHsmJiaMAEwngyvfxudNGGHaDHBRM oP2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FlmsGjPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g11-20020a65580b000000b005b8edb11af3si7969535pgr.19.2023.11.06.03.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 03:59:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FlmsGjPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6B32A806822D; Mon, 6 Nov 2023 03:59:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231530AbjKFL7H (ORCPT + 99 others); Mon, 6 Nov 2023 06:59:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231421AbjKFL7G (ORCPT ); Mon, 6 Nov 2023 06:59:06 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0752CFA; Mon, 6 Nov 2023 03:59:04 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C839C433C7; Mon, 6 Nov 2023 11:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699271943; bh=0/iPB7BGJOOJheSQGLmXtcW0iKZV6qsZ+l3XvUdsfXo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FlmsGjPON5hG1J3Oy5ruB9nhNCtxbie/6vZipquhRO95/NGJzGLcgdvIDvfSkaWOW N87TIaNrW1H22B+ngSZhdz4hrIYWRfq0Fn007YEyAa3y0TVLukix/kbH5YFqRdZGNB gKhYCz+KCd1OT57XsgTuvhYfG8oyS7EmHT0yEM+BwshCqnHw5+G10YPzdVFoAnEauS aQhXsae4FL7MGT95WgC1uXI8xt6w1XpUO/eyWepbtIF8uKZOM8M6I6NNgn2KC4n0x2 bfOI9hF6FN8W+cJDtlnI96QKDy3KNj+Pm0FaId0NB/SLqHvJH4DP22tGHk6jVHVTVr 67SaE07Zlsb4w== Date: Mon, 6 Nov 2023 11:59:00 +0000 From: Mark Brown To: Zhang Xiaoxu Cc: zhangxiaoxu5@huawei.com, weiyongjun1@huawei.com, rostedt@goodmis.org, mingo@redhat.com, frowand.list@gmail.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 -next 1/5] spi: mockup: Add SPI controller testing driver Message-ID: References: <20231104064650.972687-1-zhangxiaoxu@huaweicloud.com> <20231104064650.972687-2-zhangxiaoxu@huaweicloud.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uGI4JZ0hFxEj7pPT" Content-Disposition: inline In-Reply-To: <20231104064650.972687-2-zhangxiaoxu@huaweicloud.com> X-Cookie: Save energy: Drive a smaller shell. X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 06 Nov 2023 03:59:16 -0800 (PST) --uGI4JZ0hFxEj7pPT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 04, 2023 at 02:46:46PM +0800, Zhang Xiaoxu wrote: > This is accomplished by executing the following command: >=20 > $ echo adcxx1s 0 > /sys/class/spi_master/spi0/new_device That's not a valid sysfs format, sysfs requires one value per file. configfs might be a better fit? > +config SPI_MOCKUP > + tristate "SPI controller Testing Driver" > + depends on OF Why would this depend on DT? Given that any test SPI controller is a virtual device it should never appear in DT and we probably shouldn't require providing DT for the created devices even if we implement support for that, only some devices might care. ` > +++ b/drivers/spi/spi-mockup.c > @@ -0,0 +1,211 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * SPI controller Testing Driver > + * > + * Copyright(c) 2022 Huawei Technologies Co., Ltd. > + */ Please keep the entire comment a C++ one so things look more intentional. > +#define MOCKUP_CHIPSELECT_MAX 8 Why would we have a hard coded limit here? > + blank =3D strchr(buf, ' '); > + if (!blank) { > + dev_err(dev, "%s: Extra parameters\n", "new_device"); > + return -EINVAL; > + } There is no point in using %s to render a constant string. > +static const struct of_device_id spi_mockup_match[] =3D { > + { .compatible =3D "spi-mockup", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, spi_mockup_match); If we were going to instantiate this via DT we'd need a binding, but as I indicated above since this is purely virtual and not even something like virtual hardware provided by a VMM but rather just something kernel internal we should probably not be using DT at all. Providing a device facing DT interface might be useful, but that's a second stage thing. --uGI4JZ0hFxEj7pPT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVI1QEACgkQJNaLcl1U h9BcjQf+OFqcQORTZmVFQ4Z8rKLWLd8BPf4N5fLNu8+OH3m2IcHHZPMwwSRjzz6b 93S13ZQYssTnOVk8cuCDsPVUVkHpjEElm/uTCkw8GLfaRX/dabrjA7ztGS06/0Ez QsNHNDJ9LIL+qxnZrPmj8Wbp5j8hRIfnHF2uzWHII71kpn8wMguyvqSZ6x1PtbXG g6gJGCT3XYDsilQ9wyJphSo3hlPwpjzrexa5nswYzu2T27O6QjDiBp1qc/FqhNbV Lg0EjOYJvcjJGZ/GodvKmNnTiT84kvfUAo/xU34s1LLsTKboQ/IAAFYaAyYRz6Wu ntj8Xbwan2uotuQFjUkrEny59cP0wA== =I7Zx -----END PGP SIGNATURE----- --uGI4JZ0hFxEj7pPT--