From patchwork Sun Nov 13 04:01: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: 1561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1535043wru; Sat, 12 Nov 2022 20:05:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5cZcmvW+y8xsxxd8arvft622VLSwMfmh2UBooHAktz0DN2kgq6PdLhrkehBPGW6PwQuDv+ X-Received: by 2002:a17:907:78d6:b0:78d:9d6b:85a1 with SMTP id kv22-20020a17090778d600b0078d9d6b85a1mr6768851ejc.718.1668312317494; Sat, 12 Nov 2022 20:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668312317; cv=none; d=google.com; s=arc-20160816; b=bn26glo0yWA+4eoY5UlAgQ67P2hzm4XFocQGk/1iAHq7GE7JH6kLVsz3WQDtqpmEsZ jZm/DzCI8CNsnz4YOPUX7JOzE8s8Ac8JSu3WPXFIVQoZ/AvlBaiO+WgLalb9TnjyzZ34 UKXqE0/eWfSz9cU6PbHx3g6a0+UrMdt57OcOEKUi88Ez6jLsoE311xnBg4Q8k/X4AzLN ltpZ4J0FF2l3GnI7vP6I1Iojjozv5JqWxiqv8/g4MTzP75ZbIdcDPf2IC8mhMBUmDJJJ H8OPklGDLkg5AcvHZMs9W0ffPIlaeDUnz1/9wY37EI23IJP3oQuTMq4WlMoptguCX/Pv gE9g== 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=aNSRPUO1v1OYkd49ueorKmsNQJVAAcCUYPFtGJiFcIg=; b=sIa3/h8Rx4LzPk9D/+mNcNW4lREGTfrdQLFrqP6lE54TFTuCCVMU0+XAq74tivhO7t tn4SERM/7UbIYu7145EzpAE70qfLeBSMfZYiziqiDKYLhyMRFI3OyDOOdyM3crKJtzyZ /bxOTnI3YSHz5w3qEhaeApNWuytyi76MGCPoYMbAFjw+Hjj78bw3kckwY4m9GPYj62/9 wNJblnzLPzaL1T4nkMS4FepYydmzJi+scUsHyNy1Ga6ghF5zJlDUhD6QrqqDkp0BqaqD tdgNhD7nt0yaP5WHft4rbL9XYwvVPvTSq2H8nGcE9cj4jccw9m6ARg6HVl+7Ozfloc9N OVUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JTpfsZ0j; 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 n7-20020aa7d047000000b00461a9775fa9si4787623edo.222.2022.11.12.20.04.54; Sat, 12 Nov 2022 20:05:17 -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=JTpfsZ0j; 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 S235142AbiKMECl (ORCPT + 99 others); Sat, 12 Nov 2022 23:02:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbiKMECi (ORCPT ); Sat, 12 Nov 2022 23:02:38 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41DA6DFA0; Sat, 12 Nov 2022 20:02:34 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id gw22so7648377pjb.3; Sat, 12 Nov 2022 20:02:34 -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=aNSRPUO1v1OYkd49ueorKmsNQJVAAcCUYPFtGJiFcIg=; b=JTpfsZ0jn/PD0C35/LkjaBbGMoaWE3MXg98oU61ZKtOaUvnmhYkOcm5uuUuPVAbe8E qZ3zTlbJ13UwN8KEWcCPRoZcXKk6sdX8bO/RfYmuIxYhjHRtN2iqPJBQm3hTQqHX+FLP yImkWB9lVND4OXHkMIBVT/LJYThmLf+N8ArHGhQVCWT9zyiC4OkHt1GXck1VC1HPZG8u 0qswhUyM22N0gBV3iOK0gWHJsrGVfYiUxN9UG0mXH7jIbzf88pN8RTrt+lDh8mo8pHc4 aPYjbK5m3z/VzznjLB3Iu7qhnWhAjHbu/27kROjxik5HdXRbDjb7iX6uA8IULDQZKbYg ThAQ== 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=aNSRPUO1v1OYkd49ueorKmsNQJVAAcCUYPFtGJiFcIg=; b=o7IHAy7jSdwnxGquoP3xH2RRvAwyU8M6t0v5PVBKLruQ9D0ynkGu6rpUYJbCCxrf9n J3QC91w552QszqSfuVggg7ufoL7MicZXa6pcTnb0yrpXR/blQkgClDP/VcpJw0+2gx65 OF5vohuzqsgo6kJ/d/FLJKgKk2GvWUIsEUxc90lAYOuiKNt6nbY7+kgfolZ22pM1SXPD sY7dSiLEH81aNOPcJbll7N+mJNikZLY30ksplJ7XZ1PzJhkPu8V8xNnL2ABgf2KrnRRt wW5H5woqUSEW9v7Afn1wUqODf7Z7JkRRi8tw8d+gnTuDO0LSoHcm3dBHaaDhmrmfYo+2 dA4g== X-Gm-Message-State: ANoB5pnJn3YgCSZk/7jlvlYG8c81jowBZqWRlzY03BDFhXuk5qvvUVtb E2BUoMufSMz+OtXNefnTv/w= X-Received: by 2002:a17:902:e3d4:b0:188:53b9:f003 with SMTP id r20-20020a170902e3d400b0018853b9f003mr8500917ple.170.1668312153584; Sat, 12 Nov 2022 20:02:33 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id n63-20020a17090a5ac500b00200461cfa99sm7122686pji.11.2022.11.12.20.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 20:02:33 -0800 (PST) Sender: Vincent Mailhol From: Vincent Mailhol To: Marc Kleine-Budde , linux-can@vger.kernel.org Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, Vincent Mailhol Subject: [PATCH v3 0/3] can: etas_es58x: report firmware, bootloader and hardware version Date: Sun, 13 Nov 2022 13:01:05 +0900 Message-Id: <20221113040108.68249-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.5 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?1749352257093884541?= 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 practise. Remove the kernel log and instead export all these in sysfs. In addition, the firmware version is also reported through ethtool. * Changelog * 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 (3): USB: core: export usb_cache_string() can: etas_es58x: export firmware, bootloader and hardware versions in sysfs can: etas_es58x: report firmware-version through ethtool drivers/net/can/usb/etas_es58x/Makefile | 2 +- drivers/net/can/usb/etas_es58x/es58x_core.c | 70 ++---- drivers/net/can/usb/etas_es58x/es58x_core.h | 51 ++++ drivers/net/can/usb/etas_es58x/es58x_sysfs.c | 231 +++++++++++++++++++ drivers/usb/core/message.c | 1 + drivers/usb/core/usb.h | 1 - include/linux/usb.h | 1 + 7 files changed, 309 insertions(+), 48 deletions(-) create mode 100644 drivers/net/can/usb/etas_es58x/es58x_sysfs.c