From: Mark Brown <broonie@kernel.org>
To: Zhang Xiaoxu <zhangxiaoxu@huaweicloud.com>
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
Date: Mon, 6 Nov 2023 11:59:00 +0000 [thread overview]
Message-ID: <ZUjVBKuviXwM0aiR@finisterre.sirena.org.uk> (raw)
In-Reply-To: <20231104064650.972687-2-zhangxiaoxu@huaweicloud.com>
[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]
On Sat, Nov 04, 2023 at 02:46:46PM +0800, Zhang Xiaoxu wrote:
> This is accomplished by executing the following command:
>
> $ 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 = 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[] = {
> + { .compatible = "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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-11-06 11:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-04 6:46 [PATCH -next 0/5] spi: Introduce BPF based SPI mockup controller Zhang Xiaoxu
2023-11-04 6:46 ` [PATCH v3 -next 1/5] spi: mockup: Add SPI controller testing driver Zhang Xiaoxu
2023-11-06 11:59 ` Mark Brown [this message]
2023-11-18 11:07 ` huaweicloud
2023-11-04 6:46 ` [PATCH v3 -next 2/5] spi: mockup: Add writeable tracepoint for spi transfer Zhang Xiaoxu
2023-11-04 9:58 ` kernel test robot
2023-11-04 11:10 ` kernel test robot
2023-11-04 6:46 ` [PATCH v3 -next 3/5] spi: mockup: Add support register the device through configfs Zhang Xiaoxu
2023-11-04 6:46 ` [PATCH v3 -next 4/5] spi: mockup: Add speed and flags attribute support Zhang Xiaoxu
2023-11-04 11:10 ` kernel test robot
2023-11-04 6:46 ` [PATCH v3 -next 5/5] spi: mockup: Add documentation Zhang Xiaoxu
2023-11-06 13:09 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZUjVBKuviXwM0aiR@finisterre.sirena.org.uk \
--to=broonie@kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=weiyongjun1@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
--cc=zhangxiaoxu@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®