lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZAn/L8Dg/Ehx9bMo@ye-NUC7i7DNHE>
Date:   Thu, 9 Mar 2023 23:45:51 +0800
From:   "Ye, Xiang" <xiang.ye@...el.com>
To:     Andi Shyti <andi.shyti@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:     Arnd Bergmann <arnd@...db.de>,
        Matthias Kaehlcke <mka@...omium.org>,
        "Lee Jones" <lee@...nel.org>, Wolfram Sang <wsa@...nel.org>,
        Tyrone Ting <kfting@...oton.com>,
        Mark Brown <broonie@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        <linux-usb@...r.kernel.org>, <linux-i2c@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <linux-spi@...r.kernel.org>,
        <linux-gpio@...r.kernel.org>, <srinivas.pandruvada@...el.com>,
        <heikki.krogerus@...ux.intel.com>,
        <andriy.shevchenko@...ux.intel.com>,
        <sakari.ailus@...ux.intel.com>, <zhifeng.wang@...el.com>,
        <wentong.wu@...el.com>, <lixu.zhang@...el.com>
Subject: Re: [PATCH v4 1/5] mfd: Add support for Intel LJCA device

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ