From: "Ye, Xiang" <xiang.ye@intel.com>
To: Andi Shyti <andi.shyti@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Matthias Kaehlcke <mka@chromium.org>,
"Lee Jones" <lee@kernel.org>, Wolfram Sang <wsa@kernel.org>,
Tyrone Ting <kfting@nuvoton.com>, Mark Brown <broonie@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>, <linux-usb@vger.kernel.org>,
<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-spi@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
<srinivas.pandruvada@intel.com>,
<heikki.krogerus@linux.intel.com>,
<andriy.shevchenko@linux.intel.com>,
<sakari.ailus@linux.intel.com>, <zhifeng.wang@intel.com>,
<wentong.wu@intel.com>, <lixu.zhang@intel.com>
Subject: Re: [PATCH v4 1/5] mfd: Add support for Intel LJCA device
Date: Thu, 9 Mar 2023 23:45:51 +0800 [thread overview]
Message-ID: <ZAn/L8Dg/Ehx9bMo@ye-NUC7i7DNHE> (raw)
In-Reply-To: <ZAmvocpy68qurCvt@intel.intel>
On Thu, Mar 09, 2023 at 11:06:25AM +0100, Andi Shyti wrote:
> On Thu, Mar 09, 2023 at 10:41:05AM +0100, Greg Kroah-Hartman wrote:
> > On Thu, Mar 09, 2023 at 05:31:44PM +0800, Ye, Xiang wrote:
> > > On Thu, Mar 09, 2023 at 08:52:24AM +0100, Greg Kroah-Hartman wrote:
> > > > On Thu, Mar 09, 2023 at 03:10:56PM +0800, Ye Xiang wrote:
> > > > > +static int ljca_mng_get_version(struct ljca_stub *stub, char *buf)
> > > > > +{
> > > > > + struct fw_version version = {};
> > > > > + unsigned int len = sizeof(version);
> > > > > + int ret;
> > > > > +
> > > > > + ret = ljca_stub_write(stub, LJCA_MNG_GET_VERSION, NULL, 0, &version, &len, true,
> > > > > + LJCA_USB_WRITE_ACK_TIMEOUT_MS);
> > > > > + if (ret)
> > > > > + return ret;
> > > > > +
> > > > > + if (len != sizeof(version)) {
> > > > > + dev_err(&stub->intf->dev, "get version failed, len:%d\n", len);
> > > > > + return -EINVAL;
> > > > > + }
> > > > > +
> > > > > + return sysfs_emit(buf, "%d.%d.%d.%d\n", version.major, version.minor,
> > > > > + le16_to_cpu(version.patch), le16_to_cpu(version.build));
> > > > > +}
> > > >
> > > > You have sysfs files, yet no Documentation/ABI/ entries? That's not
> > > > allowed, you know this :(
> > > The Documentation/ABI/ entries is added for the sysfs on patch 5 of this series.
> > > https://patchwork.kernel.org/project/linux-usb/patch/20230309071100.2856899-6-xiang.ye@intel.com/
> >
> > Ah, missed that, sorry.
> >
> > > >
> > > > > +static ssize_t cmd_store(struct device *dev, struct device_attribute *attr, const char *buf,
> > > > > + size_t count)
> > > > > +{
> > > > > + struct usb_interface *intf = to_usb_interface(dev);
> > > > > + struct ljca_dev *ljca_dev = usb_get_intfdata(intf);
> > > > > + struct ljca_stub *mng_stub = ljca_stub_find(ljca_dev, LJCA_MNG_STUB);
> > > > > + struct ljca_stub *diag_stub = ljca_stub_find(ljca_dev, LJCA_DIAG_STUB);
> > > > > +
> > > > > + if (sysfs_streq(buf, "dfu"))
> > > > > + ljca_mng_set_dfu_mode(mng_stub);
> > > > > + else if (sysfs_streq(buf, "debug"))
> > > > > + ljca_diag_set_trace_level(diag_stub, 3);
> > > >
> > > > Sorry, but no, you can't do this in a sysfs file.
> > > Do you mean that we can't use sysfs to send "debug" command to device?
> >
> > That is correct, use the kernel-wide debugging facilities that we have
> > for this NEVER create your own custom interface just for one tiny
> > driver, that is not allowed.
> >
> > > Could you provide some detail or hints?
> >
> > dev_dbg().
But, this command is sent to SET LJCA Firmware logging level.
>
> I'm not sure this is the same thing, though, as it's not a drvier
> to user debug message.
>
> Ye, can you please explain better what this command does? You are
> sending a LJCA_DIAG_SET_TRACE_LEVEL command to the device with a
> parameter "3" which has a meaining only for you :)
Sure, the LJCA_DIAG_SET_TRACE_LEVEL command is used to set LJCA FW
logging level. 3 means debug level for FW. It is used for LJCA FW
debugging: when FW got some issue, we can send debug level to FW
to make FW print degging log for analysis.
>
> What is ugly here is the parsing of "dfu" and "debug", I would
> just make different boolean files, something like:
>
> echo 1 > ljca_dfu
> echo 0 > ljca_dfu
>
> and
>
> echo N > ljca_trace_level
>
> with a proper documentation of the trace levels.
>
> The show counterparast can provide a feedback on how the
> interfaces are set rather than providing some help message, which
> is not what sysfs files are meant for.
>
> Would this work?
Thanks. It should works, and I will try it.
--
Thanks
Ye Xiang
next prev parent reply other threads:[~2023-03-09 15:46 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 7:10 [PATCH v4 0/5] Add Intel LJCA device driver Ye Xiang
2023-03-09 7:10 ` [PATCH v4 1/5] mfd: Add support for Intel LJCA device Ye Xiang
2023-03-09 7:49 ` Greg Kroah-Hartman
2023-03-09 9:10 ` Ye, Xiang
2023-03-09 9:26 ` Greg Kroah-Hartman
2023-03-09 10:16 ` Ye, Xiang
2023-03-09 7:52 ` Greg Kroah-Hartman
2023-03-09 9:31 ` Ye, Xiang
2023-03-09 9:41 ` Greg Kroah-Hartman
2023-03-09 10:06 ` Andi Shyti
2023-03-09 15:45 ` Ye, Xiang [this message]
2023-03-09 15:58 ` Greg Kroah-Hartman
2023-03-09 17:42 ` Ye, Xiang
2023-03-09 7:56 ` Arnd Bergmann
2023-03-09 10:00 ` Ye, Xiang
2023-03-09 11:03 ` Mark Brown
2023-03-09 11:30 ` Arnd Bergmann
2023-03-09 12:53 ` Oliver Neukum
2023-03-10 4:14 ` Ye, Xiang
2023-03-13 13:27 ` Oliver Neukum
2023-03-14 7:15 ` Ye, Xiang
2023-03-09 7:10 ` [PATCH v4 2/5] gpio: Add support for Intel LJCA USB GPIO driver Ye Xiang
2023-03-09 13:40 ` Oliver Neukum
2023-03-09 13:52 ` Andy Shevchenko
2023-03-09 14:06 ` Greg Kroah-Hartman
2023-03-09 14:18 ` Linus Walleij
2023-03-09 14:36 ` Greg Kroah-Hartman
2023-03-09 14:48 ` Arnd Bergmann
2023-03-09 17:37 ` Oliver Neukum
2023-03-09 17:30 ` Oliver Neukum
2023-03-10 5:01 ` Ye, Xiang
2023-03-10 7:11 ` Greg Kroah-Hartman
2023-03-10 7:39 ` Ye, Xiang
2023-03-10 7:53 ` Greg Kroah-Hartman
2023-03-10 8:59 ` Ye, Xiang
2023-03-11 12:13 ` Krzysztof Kozlowski
2023-03-12 15:40 ` Ye, Xiang
2023-03-09 7:10 ` [PATCH v4 3/5] i2c: Add support for Intel LJCA USB I2C driver Ye Xiang
2023-03-09 7:10 ` [PATCH v4 4/5] spi: Add support for Intel LJCA USB SPI driver Ye Xiang
2023-03-09 7:11 ` [PATCH v4 5/5] Documentation: Add ABI doc for attributes of LJCA device Ye Xiang
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=ZAn/L8Dg/Ehx9bMo@ye-NUC7i7DNHE \
--to=xiang.ye@intel.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=kfting@nuvoton.com \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lixu.zhang@intel.com \
--cc=mka@chromium.org \
--cc=sakari.ailus@linux.intel.com \
--cc=srinivas.pandruvada@intel.com \
--cc=wentong.wu@intel.com \
--cc=wsa@kernel.org \
--cc=zhifeng.wang@intel.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