From patchwork Sat Nov 26 16:22:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 2260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4718506wrr; Sat, 26 Nov 2022 08:24:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7AtGhAck7GqJerJdi1/lKgr0WDqyfdsGXSKmYR1e8TNnVoUuaJ3Ub3F3fLurRYY5zfKixm X-Received: by 2002:a05:6402:360a:b0:469:f59f:352e with SMTP id el10-20020a056402360a00b00469f59f352emr20968768edb.241.1669479878270; Sat, 26 Nov 2022 08:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669479878; cv=none; d=google.com; s=arc-20160816; b=ZRSK7JRkM43JlC7kOFsdYP6pYMejasSaF+PLVp/2k6J0hV88jB5WRBQbGURK9m66Ho VBNzfTtJTAPSF3ghiZR1pqkyifrJ4Y9hAi2NPoXzoLe8ejjYHf2NK04X7fml0b8Xg2ks ymbqui6V7YJDRHtf0sM16WqKYpkmO/stqHFlnHnUPY+guCyfo79o1KrcC2tz02UbVKUw n+0PjfOaLIM80vCz2XdJ+ln2pNkjagtHQGYJQA1sPshiTGfFPiXzKIKQ/noV5PPxaVEu CzuSAx8L8wfa4Uo2oTh01/yIEJZYs3ypOeJsG6gep28Qxt2WV4MKedjeb8h5c/TsKLRG +Q6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=u0hxFFmy8oYwIx+3AY8R3T8lDZ42Z6Hf4DtqyJhNml8=; b=crdEJJfoTkxH77TyXK+2seNFYmCABhtHcwWYGp0YYVvPvxeeoKx4AtTHWjDezXb1+F enCfh2YvaXChhZVmcxS/bu60D0qi/UXnTJXDGmxKuSSiHdzfcE3PoQGwP916IYkNNrwT 4GroyxG/1WRwIbBTpVnLXuV0fDoV0q0vWTFzVWQ3zLsZc4FSjwTdMfTrawCwACF3VTvt VlIqUc6ENk8PWOl0dOcD2trdZMU8svLVaXj/lHcRt8DJ3RFnqvritUbkYMbqiXMdoqOk bt94woEQJHJbIL8fEjeq+ciZJsd/eOMaixyvd1O8YSPiNeo/n5DbkJ48wyyc78HW9zsj oBKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=H5WP8UEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a50a444000000b0046995c42775si5251497edb.148.2022.11.26.08.24.15; Sat, 26 Nov 2022 08:24:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=H5WP8UEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbiKZQWh (ORCPT + 99 others); Sat, 26 Nov 2022 11:22:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbiKZQWf (ORCPT ); Sat, 26 Nov 2022 11:22:35 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD2B6258; Sat, 26 Nov 2022 08:22:32 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id mv18so5970017pjb.0; Sat, 26 Nov 2022 08:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=u0hxFFmy8oYwIx+3AY8R3T8lDZ42Z6Hf4DtqyJhNml8=; b=H5WP8UEekhWEksR7km+aNgxBCjgC8nZgcDTtUpuZRC7um3IvsdvfBKNNdYwDxO52BP oSzB5kWb0+4DPRMkqqc7jIX2RXGpcERhAlMBfe6w34ccY6AgkQY0oxZhiMkKwhef3hQN DlXcHVGexEd15lJOwpfjcWdWlEFH4xCnEA0Gkz/XwVM6IDJyFFwWQeuVHvn5cps40q9D w1t44y6qa5VTb0Nf7mLdA6BNTHgOnfELVG7gBBL+Em6NXFpTdDLLcAgtfLceOPdL4s3c 9+G11YyJOzD8xMPFubse2+COdvUtp4KxDOdfHwrDpWqUqCzPLnJO4KWEjGk0UhVrTZCm dwEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=u0hxFFmy8oYwIx+3AY8R3T8lDZ42Z6Hf4DtqyJhNml8=; b=QAvn2ynTLTuclfsmYgq4bGY5R3C0cyli6O53uxvW6hda3vPfGIbjudk1WXWzMckMAM S7ubSDIDIV/DIwlK25q4XZ419zlqwvUHge3rw0NlGNnKhtNEFpbmnBRBufyqYIrvtgPr vD2l3mmy3TLINydkUs539ur2Veq+e2PFrysl8ZyD08Hpd2v/Dti0ohfwUHRXyNNxtcTS GE9Ap7KnNLVEp3GpT7i3s6xmSR20AVzBC0/aDeEFikbh81A4T0/7Aj9eahovCXPu4NY/ ob0v1O1VQm+TuMMUSM6g5Korszf/Y9wcJWCkVzazszaRiajeImwZP2ZWcbRcfSAUvEHI dtRw== X-Gm-Message-State: ANoB5plON5JtDxFCKDmLklZTYf5lJHOpLrTSqbkjz5OKmVYCl1knKamp 88Pz08Wa/JQICwBqSmaCCnNbtQ5wzvX0jw== X-Received: by 2002:a17:90a:3e4e:b0:218:7ee7:899a with SMTP id t14-20020a17090a3e4e00b002187ee7899amr41738267pjm.204.1669479751962; Sat, 26 Nov 2022 08:22:31 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id y14-20020a63e24e000000b00460ea630c1bsm4169601pgj.46.2022.11.26.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 08:22:31 -0800 (PST) Sender: Vincent Mailhol From: Vincent Mailhol To: linux-can@vger.kernel.org Cc: Marc Kleine-Budde , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , netdev@vger.kernel.org, linux-usb@vger.kernel.org, Saeed Mahameed , Andrew Lunn , Jiri Pirko , Lukas Magel , Vincent Mailhol Subject: [PATCH v4 0/6] can: etas_es58x: report firmware, bootloader and hardware version Date: Sun, 27 Nov 2022 01:22:05 +0900 Message-Id: <20221126162211.93322-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749352257093884541?= X-GMAIL-MSGID: =?utf-8?q?1750576532963121118?= The goal of this series is to report the firmware version, the bootloader version and the hardware revision of ETAS ES58x devices. These are already reported in the kernel log but this isn't best practice. Remove the kernel log and instead export all these through devlink. In addition, the firmware version is also reported through ethtool. --- * Changelog * v3 -> v4: * major rework to use devlink instead of sysfs following Andrew's comment. * split the series in 6 patches. * [PATCH 1/6] add Acked-by: Greg Kroah-Hartman v2 -> v3: * patch 2/3: do not spam the kernel log anymore with the product number. Instead parse the product information string, extract the firmware version, the bootloadar version and the hardware revision and export them through sysfs. * patch 2/3: rework the parsing in order not to need additional fields in struct es58x_parameters. * patch 3/3: only populate ethtool_drvinfo::fw_version because since commit edaf5df22cb8 ("ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits"), there is no need to populate ethtool_drvinfo::driver and ethtool_drvinfo::bus_info in the driver. v1 -> v2: * was a single patch. It is now a series of three patches. * add a first new patch to export usb_cache_string(). * add a second new patch to apply usb_cache_string() to existing code. * add missing check on product info string to prevent a buffer overflow. * add comma on the last entry of struct es58x_parameters. Vincent Mailhol (6): USB: core: export usb_cache_string() can: etas_es58x: add devlink support can: etas_es58x: export product information through devlink_ops::info_get() can: etas_es58x: remove es58x_get_product_info() can: etas_es58x: report the firmware version through ethtool Documentation: devlink: add devlink documentation for the etas_es58x driver .../networking/devlink/etas_es58x.rst | 33 +++ MAINTAINERS | 1 + drivers/net/can/usb/Kconfig | 1 + drivers/net/can/usb/etas_es58x/Makefile | 2 +- drivers/net/can/usb/etas_es58x/es58x_core.c | 85 +++---- drivers/net/can/usb/etas_es58x/es58x_core.h | 73 ++++++ .../net/can/usb/etas_es58x/es58x_devlink.c | 207 ++++++++++++++++++ drivers/usb/core/message.c | 1 + drivers/usb/core/usb.h | 1 - include/linux/usb.h | 1 + 10 files changed, 352 insertions(+), 53 deletions(-) create mode 100644 Documentation/networking/devlink/etas_es58x.rst create mode 100644 drivers/net/can/usb/etas_es58x/es58x_devlink.c