Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2559CC61DA4 for ; Thu, 9 Mar 2023 07:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbjCIHxt (ORCPT ); Thu, 9 Mar 2023 02:53:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230248AbjCIHxV (ORCPT ); Thu, 9 Mar 2023 02:53:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058761B57E; Wed, 8 Mar 2023 23:52:27 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 897B561A5C; Thu, 9 Mar 2023 07:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 607E7C4339B; Thu, 9 Mar 2023 07:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678348347; bh=rt/evWsxMPEyg16HAMZfcM0/9RSG53O+3iv4l9BJwEA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Aor2EstCjVBa8Ryyd/MhYkKGxGYCKPn+oobVHgtJolMvYNqcD3TCbffPVNbEQSYq1 /0AONv/1wKgrqYaFd6kr/S/rZKiB4FgIDt/hGNrC3rgJHOyBpCDm4WvhITvy/mVcVL LEwmD763aw7H2rquGKF+2kIELrKPdW4AwnolmRr0= Date: Thu, 9 Mar 2023 08:52:24 +0100 From: Greg Kroah-Hartman To: Ye Xiang Cc: Arnd Bergmann , Matthias Kaehlcke , Lee Jones , Wolfram Sang , Tyrone Ting , Mark Brown , Linus Walleij , Bartosz Golaszewski , 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 Message-ID: References: <20230309071100.2856899-1-xiang.ye@intel.com> <20230309071100.2856899-2-xiang.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230309071100.2856899-2-xiang.ye@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :( > +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. > + > + return count; > +} > + > +static ssize_t cmd_show(struct device *dev, struct device_attribute *attr, char *buf) > +{ > + return sysfs_emit(buf, "%s\n", "supported cmd: [dfu, debug]"); sysfs files do not show "help text". thanks, greg k-h