From patchwork Wed Nov 30 17:46:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1064143wrr; Wed, 30 Nov 2022 09:48:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf4oIh5ESYmggYaIPAOeZbWXbzI1foMscjaB82eUOM/IXbBooxZ6QCuAttr18iQ0WvS3kAdg X-Received: by 2002:a17:906:8616:b0:7ac:db70:3ab5 with SMTP id o22-20020a170906861600b007acdb703ab5mr52812564ejx.160.1669830486380; Wed, 30 Nov 2022 09:48:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669830486; cv=none; d=google.com; s=arc-20160816; b=L+v6jDcdSl/VqNXb4rGkrauHvcIG3jyoj641VJ+pj+77NqFn/jHCdv1bl8jcMyQAED L8YPv3+CHHxPiYZ9uE27dUDZXBBCmkkk1FUjz6y6ff9lIQdO1idNyVDb0fsYUT0kLnx/ uQPil0H0A2qMwtrgdhkbFFC0RFQbTnK+oOnrAmC+D1xVvY/pAFlS1gGgpo1BPQOT7vWG uS9za5C/d9IKNQr8m4MBAVAxfwvFrj9q8q/R0aIzZ/Dj1+SqtAOW4yoYRnpBhvrPKlfl ghQwZwuOF6HuQIobBBH94528NIOnf1yjt8vRcI4nr/THkP533exAvfwgF0MdJt7jToOB 1aSg== 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=3MR3h+En6xAnYa/nGayyjwsy00Mwh4XUedfM8z4JVpY=; b=nYYou/vJWR/2xEDoo5Il0U2xzlQHXLK6Z94v+R+uoH+ulWD7GZCcuJ5jotLKvIG+tu X9HTFJw+PQLX5J8/nctxUXdY12wNXuhRulAevX9EKLRGrWf3yCqDdvMbgTlM9dT2Er/o HLoKPyRfmepmrWL6MnfIpb/231jpVCnrEShkw+NhfTwlbzTHus+cS35eqDzsBSEmqvlM EjoEdpcZV2cWZgcki1msIHqezfabu/n62xNVsBZnkjVxvHf6MUA3T745fb8U11fscCFo l2PHVHZUCc7EqALbWf2UPb2EyHS/Alap5L6uJCrr6c7MfC2PZzk81JHQbx8qcdPKDo4v e9FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jxMSYixh; 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 wu14-20020a170906eece00b007be3aa82544si1918827ejb.937.2022.11.30.09.47.43; Wed, 30 Nov 2022 09:48:06 -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=jxMSYixh; 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 S229910AbiK3RrV (ORCPT + 99 others); Wed, 30 Nov 2022 12:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiK3RrQ (ORCPT ); Wed, 30 Nov 2022 12:47:16 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BBD5217D; Wed, 30 Nov 2022 09:47:15 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id b13-20020a17090a5a0d00b0021906102d05so2970165pjd.5; Wed, 30 Nov 2022 09:47:15 -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=3MR3h+En6xAnYa/nGayyjwsy00Mwh4XUedfM8z4JVpY=; b=jxMSYixhM7Ngh5a62kfk/HGeGLa1WwkfLaNM4Bpm3xLEpuBQz0s1SKEmd3zgYrxyxc a5AQ0xotP+kkQoB2ExHx3E3j1cN6mS2v4vvOKqQS2EWE+wJQYw/uLEDkp66Wbyv3m7tn IHuSVL+hJXcOmqbWlHUEqRbv5k6BKzMAjnS6UY0T2Zj2/MHX9m/OMxfJJj+2K33AWx2V ZQ7Bu4/BtEWMAKNyAKnfifIps9NX+mmvktnY/hh/L3iWr2sQpr5Qu2u/lKw4GumpoS8l xwkxxN3Dld/wHhJejycoz9zBWvSkcnuh0EwClZMdykRNvd3pRm6LmurN1TJn0v5HfT8v scnw== 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=3MR3h+En6xAnYa/nGayyjwsy00Mwh4XUedfM8z4JVpY=; b=i1R6QQJQmfLZbPydW4Gi3WQnJxSvbinhgX+p1Z8AV1HWO1y8hLzUHS4ig+s2+aPyR4 HdRpQGRcJXf+o7mAnLv6f1lMw/gGaW078O01oGh/0fDg126yY6S10FjBuc8SqRpbCuVG veUdvD0YFk8xldsnsfJCLICriYGee+wGdE5mIwivSRZyIWXqC6gE7oNm6+r3gBGqVPLI LSwkPHa2hADDr5Is8oBh6NzgAKJEPZU2KG/K1Ty2Vm4lQGusMY9IxAe5b9HtIpb478Ta ma6r2yJ4I7pjqTlO5ssgzxju9g6Q7hiUozQlb1jwP6LGjOCL2yeasEtAiuQ7V5dCYFFP o+8w== X-Gm-Message-State: ANoB5plcobYXhs/xCeQ7qIyb8PBCP4zEZLWfQOSUzZQrZkTLnHG2ssmC MVrkwVQnuKhqVsgNBab3qH0zKWQTu+CnAA== X-Received: by 2002:a17:90a:4615:b0:218:8f4:bad5 with SMTP id w21-20020a17090a461500b0021808f4bad5mr72721002pjg.55.1669830435020; Wed, 30 Nov 2022 09:47:15 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47:14 -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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 1/7] can: etas_es58x: add devlink support Date: Thu, 1 Dec 2022 02:46:52 +0900 Message-Id: <20221130174658.29282-2-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1750576593978685394?= X-GMAIL-MSGID: =?utf-8?q?1750944172224174793?= Add basic support for devlink at the device level. The callbacks of struct devlink_ops will be implemented next. Signed-off-by: Vincent Mailhol --- drivers/net/can/usb/Kconfig | 1 + drivers/net/can/usb/etas_es58x/Makefile | 2 +- drivers/net/can/usb/etas_es58x/es58x_core.c | 13 ++++++++++--- drivers/net/can/usb/etas_es58x/es58x_core.h | 6 ++++++ drivers/net/can/usb/etas_es58x/es58x_devlink.c | 13 +++++++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 drivers/net/can/usb/etas_es58x/es58x_devlink.c diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig index 8c6fea661530..445504ababce 100644 --- a/drivers/net/can/usb/Kconfig +++ b/drivers/net/can/usb/Kconfig @@ -30,6 +30,7 @@ config CAN_ESD_USB config CAN_ETAS_ES58X tristate "ETAS ES58X CAN/USB interfaces" select CRC16 + select NET_DEVLINK help This driver supports the ES581.4, ES582.1 and ES584.1 interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php). diff --git a/drivers/net/can/usb/etas_es58x/Makefile b/drivers/net/can/usb/etas_es58x/Makefile index a129b4aa0215..d6667ebe259f 100644 --- a/drivers/net/can/usb/etas_es58x/Makefile +++ b/drivers/net/can/usb/etas_es58x/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_CAN_ETAS_ES58X) += etas_es58x.o -etas_es58x-y = es58x_core.o es581_4.o es58x_fd.o +etas_es58x-y = es58x_core.o es58x_devlink.o es581_4.o es58x_fd.o diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index 5aba16849603..aeffe61faed8 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "es58x_core.h" @@ -2177,6 +2178,7 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf, { struct device *dev = &intf->dev; struct es58x_device *es58x_dev; + struct devlink *devlink; const struct es58x_parameters *param; const struct es58x_operators *ops; struct usb_device *udev = interface_to_usbdev(intf); @@ -2199,11 +2201,12 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf, ops = &es581_4_ops; } - es58x_dev = devm_kzalloc(dev, es58x_sizeof_es58x_device(param), - GFP_KERNEL); - if (!es58x_dev) + devlink = devlink_alloc(&es58x_dl_ops, es58x_sizeof_es58x_device(param), + dev); + if (!devlink) return ERR_PTR(-ENOMEM); + es58x_dev = devlink_priv(devlink); es58x_dev->param = param; es58x_dev->ops = ops; es58x_dev->dev = dev; @@ -2250,6 +2253,8 @@ static int es58x_probe(struct usb_interface *intf, if (ret) return ret; + devlink_register(priv_to_devlink(es58x_dev)); + for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) { ret = es58x_init_netdev(es58x_dev, ch_idx); if (ret) { @@ -2275,8 +2280,10 @@ static void es58x_disconnect(struct usb_interface *intf) dev_info(&intf->dev, "Disconnecting %s %s\n", es58x_dev->udev->manufacturer, es58x_dev->udev->product); + devlink_unregister(priv_to_devlink(es58x_dev)); es58x_free_netdevs(es58x_dev); es58x_free_urbs(es58x_dev); + devlink_free(priv_to_devlink(es58x_dev)); usb_set_intfdata(intf, NULL); } diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h index 4a082fd69e6f..bf24375580e5 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.h +++ b/drivers/net/can/usb/etas_es58x/es58x_core.h @@ -674,6 +674,7 @@ static inline enum es58x_flag es58x_get_flags(const struct sk_buff *skb) return es58x_flags; } +/* es58x_core.c. */ int es58x_can_get_echo_skb(struct net_device *netdev, u32 packet_idx, u64 *tstamps, unsigned int pkts); int es58x_tx_ack_msg(struct net_device *netdev, u16 tx_free_entries, @@ -691,9 +692,14 @@ int es58x_rx_cmd_ret_u32(struct net_device *netdev, int es58x_send_msg(struct es58x_device *es58x_dev, u8 cmd_type, u8 cmd_id, const void *msg, u16 cmd_len, int channel_idx); +/* es58x_devlink.c. */ +extern const struct devlink_ops es58x_dl_ops; + +/* es581_4.c. */ extern const struct es58x_parameters es581_4_param; extern const struct es58x_operators es581_4_ops; +/* es58x_fd.c. */ extern const struct es58x_parameters es58x_fd_param; extern const struct es58x_operators es58x_fd_ops; diff --git a/drivers/net/can/usb/etas_es58x/es58x_devlink.c b/drivers/net/can/usb/etas_es58x/es58x_devlink.c new file mode 100644 index 000000000000..af6ca7ada23f --- /dev/null +++ b/drivers/net/can/usb/etas_es58x/es58x_devlink.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* Driver for ETAS GmbH ES58X USB CAN(-FD) Bus Interfaces. + * + * File es58x_devlink.c: report the product information using devlink. + * + * Copyright (c) 2022 Vincent Mailhol + */ + +#include + +const struct devlink_ops es58x_dl_ops = { +}; From patchwork Wed Nov 30 17:46:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1064365wrr; Wed, 30 Nov 2022 09:48:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf7HFfWJ/il20iT6NN25JbiT0V4KWb8Hv2dsTeuAybVZbs1xfBwEQ/tahDz+rsdevlI6buja X-Received: by 2002:a17:906:b28f:b0:7ad:a942:4d6b with SMTP id q15-20020a170906b28f00b007ada9424d6bmr51776457ejz.379.1669830516219; Wed, 30 Nov 2022 09:48:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669830516; cv=none; d=google.com; s=arc-20160816; b=OrITex2LyECPm322zd9N9a0mqAkdWoOJKK3SxQNR1jQJF2h3nnv5KYvm06b7pNjgGB QybIpSocHp4kiuKMs6SCXi9532BulIxNA/0Pz7dF5pKRrleUEPq2HvQU3SKtinnvtxnM qH634W8WwkVQV4aBcqdlbpHKfxEo4zRNrhDXU/1x/8+yIfY0yVyOJ2Byk8NBndR8UYmV Cwruh9zmR00ZCzA54QunyRsy8vh7INDGXNH1iEYWhNWLzlnNFtvrRJ0/5xum0KQrGYw5 gsmYjoOlajRve19HjwctiCN0eqrAzPwmx/x0rHRNcIVAAXZPYOnQCDfoIxWSzOGusBeZ St6w== 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=Jw/lz6qBvhDf1TeMH0QpjUbxo1UIWujCkJAcKsFr2sI=; b=XcKdglxeB+R7skUtn76Jp0Cme6IbSbEA+ENUoS35WCKZH1nRnNWyhMj7DzqSzUJW9S y0H9NLJOLhw6MRIf0pXsqYHmeo8KcOeup6rd7xiLyvcSeYjQmDwpOvdB6irngk6Tzcs6 11A5DYbS5tgkYd+WQspPPG3qROs6GGRLt5EX4WbVTuVs9VGrSVuFc3f0u0v5ATP/Wpn/ hfrm3EM6whyKD3VJX6lc6cfWU65EXXQzPAUjeGiJuqKebS1ahjCOW/vqnLIgfcVDOX7S 74lZPmfewQNPsw/YTGdOcCi6uvIhpzpInFjawY5oQKoIzqwac/S4NZ/cqTLQXTSCMmLh d6Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UeVcfWv4; 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 w11-20020aa7cb4b000000b0046af8f1da30si1680869edt.189.2022.11.30.09.48.12; Wed, 30 Nov 2022 09:48:36 -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=UeVcfWv4; 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 S229988AbiK3Rri (ORCPT + 99 others); Wed, 30 Nov 2022 12:47:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbiK3RrT (ORCPT ); Wed, 30 Nov 2022 12:47:19 -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 7BAF4578D1; Wed, 30 Nov 2022 09:47:18 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso2742293pjt.0; Wed, 30 Nov 2022 09:47:18 -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=Jw/lz6qBvhDf1TeMH0QpjUbxo1UIWujCkJAcKsFr2sI=; b=UeVcfWv4VtbGtbKXgZckHOn84zZh27z1dOXv9De1s2MVPJv6/7zXstZUaxtjo8xz32 AK/ykoByYoXfHJEG3cpzUr48xT9ZDT63InvQaBYEuGTpXlPCS4mqbisxA9m0fzc/m5iL ldJZDs6RPIiWOorP1q+ytWYjdndNL/umQClOssptuxKnnbMe/zOY0U8xmMdeTfrK5R0a m/f4mtJxY0ljBMJ6lUCvnEWjHKL8GJ/rrW98/Nb5Py5ayfs++HLO3hjeRC9VF9m+l9qB hevw0vTFtA0kMOxs0i5bznHZlTr2udoIaaNn+PX13SJyq6/mwPnZcZ2kNPgQA02ppe+e xr8Q== 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=Jw/lz6qBvhDf1TeMH0QpjUbxo1UIWujCkJAcKsFr2sI=; b=2VNFnnns+7/2jp7zQ6DfYlG61a2roSp1bP+AGO7nMv3d0PTkz+atF331A7MlKr8ahM HcIYcJfYOFm2Is93kHBD8bUosSUzuXmOSFjs6t+chql08hC7GwkQhsl4oLMALHpNOzC/ nVEUJbfh26WShMf3y6ehzd7GMZi2BqngBhQi13D6Uq3krLhmR5sNShfKLqgsEliwVNig OOq9UZ42wUomgKSsNVsUs9+kJNf7j2b2eTSk4ilOm4MnIBbk2mIU93HErr0jE/s88393 u5Q+DUx8wrsVJ6yA/JJMxhel43GjKCVgo7ELrxK/CJsF0kU7fE5GPXRwA5o50Zs31I0n iznw== X-Gm-Message-State: ANoB5pndVfQTM2B5No35RuiKUMys2X3/CDk7Oe1uqyNXxnxiaInGI1JB n4XPmPMVKYrdB9rWwcSVID6lid3fuRstpg== X-Received: by 2002:a17:902:e313:b0:189:97e9:c8e with SMTP id q19-20020a170902e31300b0018997e90c8emr11087620plc.63.1669830437763; Wed, 30 Nov 2022 09:47:17 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47:17 -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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 2/7] can: etas_es58x: add devlink port support Date: Thu, 1 Dec 2022 02:46:53 +0900 Message-Id: <20221130174658.29282-3-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1750944202932040601?= X-GMAIL-MSGID: =?utf-8?q?1750944202932040601?= Add support for devlink port which extends the devlink support to the network interface level. For now, the etas_es58x driver will only rely on the default features that devlink port has to offer and not implement additional feature ones. Signed-off-by: Vincent Mailhol --- drivers/net/can/usb/etas_es58x/es58x_core.c | 34 ++++++++++++++++----- drivers/net/can/usb/etas_es58x/es58x_core.h | 3 ++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index aeffe61faed8..de884de9fe57 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -2039,10 +2039,16 @@ static int es58x_set_mode(struct net_device *netdev, enum can_mode mode) * @es58x_dev: ES58X device. * @priv: ES58X private parameters related to the network device. * @channel_idx: Index of the network device. + * + * Return: zero on success, errno if devlink port could not be + * properly registered. */ -static void es58x_init_priv(struct es58x_device *es58x_dev, - struct es58x_priv *priv, int channel_idx) +static int es58x_init_priv(struct es58x_device *es58x_dev, + struct es58x_priv *priv, int channel_idx) { + struct devlink_port_attrs attrs = { + .flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL, + }; const struct es58x_parameters *param = es58x_dev->param; struct can_priv *can = &priv->can; @@ -2061,6 +2067,10 @@ static void es58x_init_priv(struct es58x_device *es58x_dev, can->state = CAN_STATE_STOPPED; can->ctrlmode_supported = param->ctrlmode_supported; can->do_set_mode = es58x_set_mode; + + devlink_port_attrs_set(&priv->devlink_port, &attrs); + return devlink_port_register(priv_to_devlink(es58x_dev), + &priv->devlink_port, channel_idx); } /** @@ -2084,7 +2094,10 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx) } SET_NETDEV_DEV(netdev, dev); es58x_dev->netdev[channel_idx] = netdev; - es58x_init_priv(es58x_dev, es58x_priv(netdev), channel_idx); + ret = es58x_init_priv(es58x_dev, es58x_priv(netdev), channel_idx); + if (ret) + goto free_candev; + SET_NETDEV_DEVLINK_PORT(netdev, &es58x_priv(netdev)->devlink_port); netdev->netdev_ops = &es58x_netdev_ops; netdev->ethtool_ops = &es58x_ethtool_ops; @@ -2092,16 +2105,20 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx) netdev->dev_port = channel_idx; ret = register_candev(netdev); - if (ret) { - es58x_dev->netdev[channel_idx] = NULL; - free_candev(netdev); - return ret; - } + if (ret) + goto devlink_port_unregister; netdev_queue_set_dql_min_limit(netdev_get_tx_queue(netdev, 0), es58x_dev->param->dql_min_limit); return ret; + + devlink_port_unregister: + devlink_port_unregister(&es58x_priv(netdev)->devlink_port); + free_candev: + es58x_dev->netdev[channel_idx] = NULL; + free_candev(netdev); + return ret; } /** @@ -2118,6 +2135,7 @@ static void es58x_free_netdevs(struct es58x_device *es58x_dev) if (!netdev) continue; unregister_candev(netdev); + devlink_port_unregister(&es58x_priv(netdev)->devlink_port); es58x_dev->netdev[i] = NULL; free_candev(netdev); } diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h index bf24375580e5..a76789119229 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.h +++ b/drivers/net/can/usb/etas_es58x/es58x_core.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "es581_4.h" #include "es58x_fd.h" @@ -230,6 +231,7 @@ union es58x_urb_cmd { * @can: struct can_priv must be the first member (Socket CAN relies * on the fact that function netdev_priv() returns a pointer to * a struct can_priv). + * @devlink_port: devlink instance for the network interface. * @es58x_dev: pointer to the corresponding ES58X device. * @tx_urb: Used as a buffer to concatenate the TX messages and to do * a bulk send. Please refer to es58x_start_xmit() for more @@ -255,6 +257,7 @@ union es58x_urb_cmd { */ struct es58x_priv { struct can_priv can; + struct devlink_port devlink_port; struct es58x_device *es58x_dev; struct urb *tx_urb; From patchwork Wed Nov 30 17:46:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1064364wrr; Wed, 30 Nov 2022 09:48:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf45KDm7vZLz4JrbE88weZ+N795y5AP9EpMp+nb86MSjUao/Ye77nP1dDuWNVf535gFxs1sO X-Received: by 2002:a17:906:547:b0:7ad:9028:4b17 with SMTP id k7-20020a170906054700b007ad90284b17mr52925057eja.366.1669830516099; Wed, 30 Nov 2022 09:48:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669830516; cv=none; d=google.com; s=arc-20160816; b=ukuHwAdSDfx8B9Tq+FBXOzK3W2aurK5524wBdIGlpKdKJFYRRfespGVpWFkhswcvVv D8SH0QQvCPihEbu497+5hXZBe6TkPH/WysssAy0TxlDzHOwN8fsMh9hcPO8b83+byEhW n448w8lWmjfC91fZzzMHFuCXLhyeXksa3FmJD1hnb1EBHgTjkqDFUaIEF5TMz5xZFxoA 08ilfuLCIoZnL348PFclrqSSbzdDt9KOXdWMznW5wmpZhUf4gXBWqmkkNHzQLTkmCzxe hIq+F8IwKg3NBkp/Sdl92+kImA4wGiryy29aPwtgbAHrXRZR/A1PRNY/sth8bJNijdpz DQQg== 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=vkA/imn3R47+/xWfnmkBBzHVEaOv5ORTLT0XDNYcHEQ=; b=Zc8q7aABXnjje4e1yt3T650woF5GOwBeGgJfD0B+vJ7Gypaxt8LkVD9d7E+OxtHVRC e2DAw0nhFDVcSXBaTdlG6cltwHxjBnnxcB33CavbK4ldUaGt9zUvrSXejc5UOzFlTVuP CzWbXz4fVy24Nn9+5Hr1VLK0Q10OXJRof+adhl9tjNOkzVN+T6Qs2cZ0jRxh3CqHuXK4 ZUPSvgAmZCQp6rVkAV8vvGe6h/3TysThMPPfJO3qmxjzmm8NaMWR3Nuu3pOd/enPcZfj GXmdf2+RzJ2h1oGj79x7u2wBW9mozde3gRgUbTcrRdwfR9iGjHoEoB6oJws719vPxNf+ JBBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="OoP+A/Pe"; 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 di9-20020a170906730900b00783d5a873dcsi1907551ejc.341.2022.11.30.09.48.13; Wed, 30 Nov 2022 09:48:36 -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="OoP+A/Pe"; 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 S229974AbiK3Rrk (ORCPT + 99 others); Wed, 30 Nov 2022 12:47:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbiK3Rre (ORCPT ); Wed, 30 Nov 2022 12:47:34 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABB2578FF; Wed, 30 Nov 2022 09:47:21 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id 4so17446169pli.0; Wed, 30 Nov 2022 09:47:21 -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=vkA/imn3R47+/xWfnmkBBzHVEaOv5ORTLT0XDNYcHEQ=; b=OoP+A/PeBvBzmupXLt/lsvO1apltYMdxEG3OZIhEC56t6KiA/M+UZ48T+l+4UXsWKq wNknt8IOx/edAvich+nZPNoTnGFuyINikd9r7gtrl8JC7knnpTbFEouni1nDP7Sr8PfD xP+xyRmtblMM1CKchHrJ3zvN45jH5OnL2A+AmL5Dofp4zU9mHOKueyJlgS67DvEn5x7D ef2/K5Hle/fHa9BeZ4Ok+Xbe+AgVLiKSxeclQarv36/zpWFKjWhFOOB3Ef1qYwuJRlfc oJeR9a/u2canR6akO3wVyWecdbm9X1USCbkOyuwPtQG2w3n51ugiiz5/FGFOtbhyvgvc 2WLA== 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=vkA/imn3R47+/xWfnmkBBzHVEaOv5ORTLT0XDNYcHEQ=; b=bUXMyDPKvJ7TL8KZ6d76IiWOFlr5o2l447djpxLPDuKQTwv4YUyOf8rUfEw6Yj3QuN IfYF/qjEatB/lGRbMQ5swli0GsOB2YUsuruqB+8prg46IrlgIMaxws3zlqhk5LBkz5su PYqEA6gRUNvxeDpA0PYv0z4wPPPPHWZg8yHzKne36/cnJvLzAhIEL7Vbf8RKh4O3u4pX VC6MXXzKtnfUINuZIxGbbV7/fbbWJGbaKSpRwyeCMWgibVnf5U7Z6zbEFy5H/dH9DI0p 6kP0ba4JKz8jYiRx1YTxIYfJbhAe/GuqpdHvB+/LockJ6puKUWhGJ4Hvvd88bm4UDB8c Np4Q== X-Gm-Message-State: ANoB5pnF7ZMY6PB8lxN3kPtNqRoIOo3BcdKtWn7p3kotBcnAI3U72krQ tUPAipNAFudbgmvqUDHC4YKGSgJ+KpU8Jg== X-Received: by 2002:a17:90b:3c52:b0:219:2b64:cc0e with SMTP id pm18-20020a17090b3c5200b002192b64cc0emr19627097pjb.161.1669830440569; Wed, 30 Nov 2022 09:47:20 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47:20 -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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 3/7] USB: core: export usb_cache_string() Date: Thu, 1 Dec 2022 02:46:54 +0900 Message-Id: <20221130174658.29282-4-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1748586761916897891?= X-GMAIL-MSGID: =?utf-8?q?1750944203337122626?= usb_cache_string() can also be useful for the drivers so export it. Signed-off-by: Vincent Mailhol Acked-by: Greg Kroah-Hartman --- For reference, acked by Greg here: https://lore.kernel.org/linux-usb/Y3zyCz5HbGdsxmRT@kroah.com/ --- drivers/usb/core/message.c | 1 + drivers/usb/core/usb.h | 1 - include/linux/usb.h | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 4d59d927ae3e..127fac1af676 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1037,6 +1037,7 @@ char *usb_cache_string(struct usb_device *udev, int index) } return smallbuf; } +EXPORT_SYMBOL_GPL(usb_cache_string); /* * usb_get_device_descriptor - (re)reads the device descriptor (usbcore) diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 82538daac8b8..0eac7d4285d1 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -47,7 +47,6 @@ extern int usb_get_device_descriptor(struct usb_device *dev, extern int usb_set_isoch_delay(struct usb_device *dev); extern int usb_get_bos_descriptor(struct usb_device *dev); extern void usb_release_bos_descriptor(struct usb_device *dev); -extern char *usb_cache_string(struct usb_device *udev, int index); extern int usb_set_configuration(struct usb_device *dev, int configuration); extern int usb_choose_configuration(struct usb_device *udev); extern int usb_generic_driver_probe(struct usb_device *udev); diff --git a/include/linux/usb.h b/include/linux/usb.h index 9ff1ad4dfad1..d2d2f41052c0 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1829,6 +1829,7 @@ static inline int usb_get_ptm_status(struct usb_device *dev, void *data) extern int usb_string(struct usb_device *dev, int index, char *buf, size_t size); +extern char *usb_cache_string(struct usb_device *udev, int index); /* wrappers that also update important state inside usbcore */ extern int usb_clear_halt(struct usb_device *dev, int pipe); From patchwork Wed Nov 30 17:46:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1064540wrr; Wed, 30 Nov 2022 09:49:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf77BrhypY+Q/w5GZSgdGEK5kJipOgDOCkX7HcgrzXqon+nqv61z9ZYPNbR2fOsfAAaKP0od X-Received: by 2002:a17:906:583:b0:78d:9e18:b8f7 with SMTP id 3-20020a170906058300b0078d9e18b8f7mr51037259ejn.657.1669830541013; Wed, 30 Nov 2022 09:49:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669830541; cv=none; d=google.com; s=arc-20160816; b=07+V7rNw5DAR7lmncNsMUBK8HrdNmHviYqkw2JanqECVfRZ1WLnZ9RZm0mfFs7/zKY q+iWJxF2QBA5Vm7tYmMICb4olspxUc4BkegKzxag48iWByxiR6gbqEFuFtD/m7cnu9Qc Z5FG+REh2ZWdJF30b7bpPXbFqO+OXtXLiisTKto7CGZ69X8f3fxvxEMDzO31pPvmGU+m ykQUdFpT27vYuye1feTSAk0cTL6SkqqUMncrgGc56nQxh0/VZo3HHRXhXFdZazuq7pRo bUBhIsQuLEh2lWKI0Rk1p9+Y8NNBo0ZEBGE1kBGWj/ZpyOQzqPFgKJYsgFQbjRKfRFyl UpVQ== 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=kpwlduiswno0GODc7vV+afSgYhDmAPourYDvbL9id5k=; b=C3m2D6mIV5btVYUguWl+sGTNm4FOUwasKS/7Bu47lMwLv0fCk6+wmoL22FEtpj/bLg ZCUPCcH3hWQ1qL+x5VVc2ym7aESWAaP/ys+WWYBs9yqeXgc4Sl6F3alfl9cFm+QT2PUI LyIPC0FEaaadoiYLcgL3RmX+eZU+mHq7TfKIrKPSP0xpW+RpgyLCe5Wec1iTyYhmNTuF Jo+YNkSnKxKBvD12qFHSOTBfWrJuoUP9iyMvngzi63aQ5sVOt1QQzwQUrTE8L//ogvke VePj3uUSgMa8Auv/zuw4LawEAsDnPQf4GcxnC+nVyArjYNjjSZ4hGdlI+sLVSvX7DCYW fwHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=konABwWS; 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 l25-20020a170906231900b0078dcfe6a000si1334765eja.727.2022.11.30.09.48.36; Wed, 30 Nov 2022 09:49:00 -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=konABwWS; 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 S229853AbiK3Rrq (ORCPT + 99 others); Wed, 30 Nov 2022 12:47:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbiK3Rrg (ORCPT ); Wed, 30 Nov 2022 12:47:36 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC6D578F8; Wed, 30 Nov 2022 09:47:24 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id w79so17513682pfc.2; Wed, 30 Nov 2022 09:47:24 -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=kpwlduiswno0GODc7vV+afSgYhDmAPourYDvbL9id5k=; b=konABwWSuQgbns2x2gFYV7aV7YXTZiNFUrzMBapHKFzorTx6vKkB1h2AO7olpBAJVW WzuEargfUwpfygc3VRPSNrAqnfITf9uGDAYyjeQk2oPy6dAy0tsYc2+uC2dr64U2+X6b Jxh/6JmfrSnKlnHWy2+9IcnIO3GFWOEcoQwU1024WMRezE8EvR9Ndd31AeA5paTbsfaM ZGearzpvjXMNGhgLDkNXmc2iw/HopPxH7VZ++55xYGOcW4cFVqcSfVqHm7HbH7deMDGS P1ZooGi5779Dja9dHzI00RKTrA3w3IsL3NI+M9qvNirSNNbUlB5DWZelF8rEfUlGePMP TpyQ== 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=kpwlduiswno0GODc7vV+afSgYhDmAPourYDvbL9id5k=; b=PeHOe1qFRS7b7Q4jo+7DfGe7GkUHDVxA9jTmpd8KxXW2ZH1EKz3MSiHxgcDPhxHan2 4zH1N0nlmILPXLEfisjQzZ/NOwWtwCn9DrRcka7KRan3g+Zl9ZI/nodiIzOBRtuE7+3P BQeAuQPY2YK41+yJkNSzohLW/89hnHpQ4EpgUl0KwUgzlTrcVq7z+M3M84XZs7RhMAAK /8jTgaber5UEkkywiVmTNG/3bODxAEGf4e3cDgPRhEOW9kUNhQ9W/65tyWmUBLwyoxN8 OqD4oFPZqpycvRKX3RTNqv7lyOQG9gnJtxNCcH5KftCdtBd+Aminu/Cp4QjZKCOXRfyz l+jQ== X-Gm-Message-State: ANoB5pn2ee/ZQGykI9V/WTB75F0GnpuHmpHsKdNduLMoT4Afncvv9iLy x6i6VFB+dBfaHV7Fc7VnAFLXVHTy4iYgMA== X-Received: by 2002:a05:6a00:338c:b0:56b:a319:7b52 with SMTP id cm12-20020a056a00338c00b0056ba3197b52mr43478099pfb.21.1669830443318; Wed, 30 Nov 2022 09:47:23 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47:23 -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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 4/7] net: devlink: add DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER Date: Thu, 1 Dec 2022 02:46:55 +0900 Message-Id: <20221130174658.29282-5-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1750944229617860660?= X-GMAIL-MSGID: =?utf-8?q?1750944229617860660?= As discussed in [1], abbreviating the bootloader to "bl" might not be well understood. Instead, a bootloader technically being a firmware, name it "fw.bootloader". Add a new macro to devlink.h to formalize this new info attribute name and update the documentation. [1] https://lore.kernel.org/netdev/20221128142723.2f826d20@kernel.org/ Suggested-by: Jakub Kicinski Signed-off-by: Vincent Mailhol --- This was initially sent as a standalone patch here: https://lore.kernel.org/netdev/20221129031406.3849872-1-mailhol.vincent@wanadoo.fr/ Merging it to this series so that it is both added and used. --- Documentation/networking/devlink/devlink-info.rst | 5 +++++ include/net/devlink.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Documentation/networking/devlink/devlink-info.rst b/Documentation/networking/devlink/devlink-info.rst index 7572bf6de5c1..1242b0e6826b 100644 --- a/Documentation/networking/devlink/devlink-info.rst +++ b/Documentation/networking/devlink/devlink-info.rst @@ -198,6 +198,11 @@ fw.bundle_id Unique identifier of the entire firmware bundle. +fw.bootloader +------------- + +Version of the bootloader. + Future work =========== diff --git a/include/net/devlink.h b/include/net/devlink.h index 074a79b8933f..2f552b90b5c6 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -621,6 +621,8 @@ enum devlink_param_generic_id { #define DEVLINK_INFO_VERSION_GENERIC_FW_ROCE "fw.roce" /* Firmware bundle identifier */ #define DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID "fw.bundle_id" +/* Bootloader */ +#define DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER "fw.bootloader" /** * struct devlink_flash_update_params - Flash Update parameters From patchwork Wed Nov 30 17:46:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1064744wrr; Wed, 30 Nov 2022 09:49:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf5UrmQtYpIgtAM1VoftHCqr7jiQNtMFFs+I/KzX723rQSyv+eccf4j20ghdMNLHBp9sJbJi X-Received: by 2002:aa7:dada:0:b0:46b:c59b:d10d with SMTP id x26-20020aa7dada000000b0046bc59bd10dmr2388118eds.403.1669830569199; Wed, 30 Nov 2022 09:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669830569; cv=none; d=google.com; s=arc-20160816; b=lgOAj4ScelzWWNVDg1lN80L0pNxzlE8j/ACbwrzpnTUP91wNYNJl69/UwF134vrGQe PPOtKweJMu0bEIhuuKKhlPMNwmEVcyKkippk1Rx8ZiAQzU9UcZF3gnF3LV4LbYMj1ndx CcEAdlptLDxREd+8O0+KuTujDN6WuW67bbPkV5iyJViJNye+tiaqav/ASFUVvRcnp4yA Deqq7y1lfQAgFdSfKE8k7ql5v0DWSNAcHPMCeIBbvkB7L+znk/tSdLbHbMqBvB4EzfVr e/v/auozwDDRC2jW/yWszZlleQgNdxsR2V+ke5/bsSt5MjYnh6JdXFjhApUm91aBrLlP Qc4Q== 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=o0U6N7wghuvDknwU1i485ov3cOC1peP0YhafdBuFLnE=; b=cGVr1N6H4Tbi69cj8CigOYqpxjKm8GmuM/k7m1h+JkDSmmkSjpGkOyshghkF0WS25o RwRUFgWVegB/M2j9o5iAKWOPR20+77tx56ekWe5LDZ5bTM+62zHlb0qsc3TnDuHgoC5h jvHLLiEfwykj7T+9JIR8ZSH/FOsQ/ucNpQp9RWSLOMEhpi/OWmw7qLE4BQdYjH74CY1h AT43SN/R6PftKdpAprFA/P4hs78HYyHRms5TasPOu/qVmXsUy+sWB4NbVt5rL8TWfg3R 73lQTeiA57fD5gPpWKRo932eaT1TUCE/pUhzJ3XmqyZ5z9uBdjoxsJIc8avVSMi/aWwN 1Sbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S28Ex5gz; 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 l3-20020a170906794300b007a087ccd275si2048740ejo.384.2022.11.30.09.49.04; Wed, 30 Nov 2022 09:49:29 -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=S28Ex5gz; 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 S230163AbiK3RsL (ORCPT + 99 others); Wed, 30 Nov 2022 12:48:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230056AbiK3Rrk (ORCPT ); Wed, 30 Nov 2022 12:47:40 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 141FE6C72B; Wed, 30 Nov 2022 09:47:26 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id y17so9524669plp.3; Wed, 30 Nov 2022 09:47:26 -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=o0U6N7wghuvDknwU1i485ov3cOC1peP0YhafdBuFLnE=; b=S28Ex5gzgwRN7fw9NwDj/uRGm1RcY7WR88VxtTv5H7nd1KvwuqphYev4ZJCYoMoeD9 csHVC6ePETaH9ZAcA5a+tznxKKs01lvKWb7q3qP5qyB0QZi8OygYL+E+EMrGRJ/JC3tl ghG9xriAhWfvLwB28v9VWLBJlJB+dEJ1X/G6whtBEm/glgeziWiKd1HXmzN5JOgxieZI bDsACUZ87QoPgTAs67VBR3orPCjoazUovGv43alE8xqHrvAiosMXITCO+27BuPwxMIbn 5n8vLRssEuUmol/6VR0whhonNnh3Tu7OErf+CZVz7LG0ZPtXfr4RAfT1qW4l/0gNJiMD OjKw== 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=o0U6N7wghuvDknwU1i485ov3cOC1peP0YhafdBuFLnE=; b=sRu90ZHQBcTTl4HZG/motPbO7JEKqupzxaezS+Gs6ee9y8+pj7Nys+hovW3bu7ffxR hN58EEJqvem6CiK5eykPJ/NoXQKdFTi4BJwPSwoea9qn8EP84pXvm592/mHgiRcuVcKi upa6xZn9iGHAy1ZNKlaRktolW6yH6L0knIIELxMy/uhSn/2ndvsevG0APFTzx666mk/I OH6yk4WeOUIZGTIXsScgKChOn0F1jmQAP+tP4TSRQvgccqMk1dvW497VJDHB7UtCgUig ruz/3S6FEa5MAqe+qX7s7W3BbMV8gCVpwONY1yhFXOcKNjJWVIKKajzlr5C02Jo5GJYn Bjaw== X-Gm-Message-State: ANoB5pnE8NT2uMBK1Q79PH1n5No4kCuCMV3hqWDYt0ik77Bi4SmMa0o7 319vaWj9eiGHblFTVr64lzjMqEHM4qgrPA== X-Received: by 2002:a17:902:bb84:b0:184:e4db:e3e with SMTP id m4-20020a170902bb8400b00184e4db0e3emr46824334pls.47.1669830446123; Wed, 30 Nov 2022 09:47:26 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47:25 -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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 5/7] can: etas_es58x: export product information through devlink_ops::info_get() Date: Thu, 1 Dec 2022 02:46:56 +0900 Message-Id: <20221130174658.29282-6-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1750576580790628629?= X-GMAIL-MSGID: =?utf-8?q?1750944258856418540?= ES58x devices report below product information through a custom usb string: * the firmware version * the bootloader version * the hardware revision Parse this string, store the results in struct es58x_dev, export: * the firmware version through devlink's "fw" name * the bootloader version through devlink's "fw.bootloader" name * the hardware revisionthrough devlink's "board.rev" name Those devlink entries are not critical to use the device, if parsing fails, print an informative log message and continue to probe the device. In addition to that, use usb_device::serial to report the device serial number. Signed-off-by: Vincent Mailhol Reviewed-by: Andrew Lunn --- drivers/net/can/usb/etas_es58x/es58x_core.c | 1 + drivers/net/can/usb/etas_es58x/es58x_core.h | 41 ++++ .../net/can/usb/etas_es58x/es58x_devlink.c | 222 ++++++++++++++++++ 3 files changed, 264 insertions(+) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index de884de9fe57..4d6d5a4ac06e 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -2271,6 +2271,7 @@ static int es58x_probe(struct usb_interface *intf, if (ret) return ret; + es58x_parse_product_info(es58x_dev); devlink_register(priv_to_devlink(es58x_dev)); for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) { diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h index a76789119229..c1ba1a4e8857 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.h +++ b/drivers/net/can/usb/etas_es58x/es58x_core.h @@ -359,6 +359,39 @@ struct es58x_operators { int (*get_timestamp)(struct es58x_device *es58x_dev); }; +/** + * struct es58x_sw_version - Version number of the firmware or the + * bootloader. + * @major: Version major number, represented on two digits. + * @minor: Version minor number, represented on two digits. + * @revision: Version revision number, represented on two digits. + * + * The firmware and the bootloader share the same format: "xx.xx.xx" + * where 'x' is a digit. Both can be retrieved from the product + * information string. + */ +struct es58x_sw_version { + u8 major; + u8 minor; + u8 revision; +}; + +/** + * struct es58x_hw_revision - Hardware revision number. + * @letter: Revision letter. + * @major: Version major number, represented on three digits. + * @minor: Version minor number, represented on three digits. + * + * The hardware revision uses its own format: "axxx/xxx" where 'a' is + * a letter and 'x' a digit. It can be retrieved from the product + * information string. + */ +struct es58x_hw_revision { + char letter; + u16 major; + u16 minor; +}; + /** * struct es58x_device - All information specific to an ES58X device. * @dev: Device information. @@ -376,6 +409,9 @@ struct es58x_operators { * queue wake/stop logic should prevent this URB from getting * empty. Please refer to es58x_get_tx_urb() for more details. * @tx_urbs_idle_cnt: number of urbs in @tx_urbs_idle. + * @firmware_version: The firmware version number. + * @bootloader_version: The bootloader version number. + * @hardware_revision: The hardware revision number. * @ktime_req_ns: kernel timestamp when es58x_set_realtime_diff_ns() * was called. * @realtime_diff_ns: difference in nanoseconds between the clocks of @@ -411,6 +447,10 @@ struct es58x_device { struct usb_anchor tx_urbs_idle; atomic_t tx_urbs_idle_cnt; + struct es58x_sw_version firmware_version; + struct es58x_sw_version bootloader_version; + struct es58x_hw_revision hardware_revision; + u64 ktime_req_ns; s64 realtime_diff_ns; @@ -696,6 +736,7 @@ int es58x_send_msg(struct es58x_device *es58x_dev, u8 cmd_type, u8 cmd_id, const void *msg, u16 cmd_len, int channel_idx); /* es58x_devlink.c. */ +void es58x_parse_product_info(struct es58x_device *es58x_dev); extern const struct devlink_ops es58x_dl_ops; /* es581_4.c. */ diff --git a/drivers/net/can/usb/etas_es58x/es58x_devlink.c b/drivers/net/can/usb/etas_es58x/es58x_devlink.c index af6ca7ada23f..9fba29e2f57c 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_devlink.c +++ b/drivers/net/can/usb/etas_es58x/es58x_devlink.c @@ -7,7 +7,229 @@ * Copyright (c) 2022 Vincent Mailhol */ +#include +#include +#include #include +#include "es58x_core.h" + +/* USB descriptor index containing the product information string. */ +#define ES58X_PROD_INFO_IDX 6 + +/** + * es58x_parse_sw_version() - Extract boot loader or firmware version. + * @es58x_dev: ES58X device. + * @prod_info: USB custom string returned by the device. + * @prefix: Select which information should be parsed. Set it to "FW" + * to parse the firmware version or to "BL" to parse the + * bootloader version. + * + * The @prod_info string contains the firmware and the bootloader + * version number all prefixed by a magic string and concatenated with + * other numbers. Depending on the device, the firmware (bootloader) + * format is either "FW_Vxx.xx.xx" ("BL_Vxx.xx.xx") or "FW:xx.xx.xx" + * ("BL:xx.xx.xx") where 'x' represents a digit. @prod_info must + * contains the common part of those prefixes: "FW" or "BL". + * + * Parse @prod_info and store the version number in + * &es58x_dev.firmware_version or &es58x_dev.bootloader_version + * according to @prefix value. + * + * Return: zero on success, -EINVAL if @prefix contains an invalid + * value and -EBADMSG if @prod_info could not be parsed. + */ +static int es58x_parse_sw_version(struct es58x_device *es58x_dev, + const char *prod_info, const char *prefix) +{ + struct es58x_sw_version *version; + int major, minor, revision; + + if (!strcmp(prefix, "FW")) + version = &es58x_dev->firmware_version; + else if (!strcmp(prefix, "BL")) + version = &es58x_dev->bootloader_version; + else + return -EINVAL; + + /* Go to prefix */ + prod_info = strstr(prod_info, prefix); + if (!prod_info) + return -EBADMSG; + /* Go to beginning of the version number */ + while (!isdigit(*prod_info)) { + prod_info++; + if (!*prod_info) + return -EBADMSG; + } + + if (sscanf(prod_info, "%2u.%2u.%2u", &major, &minor, &revision) != 3) + return -EBADMSG; + + version->major = major; + version->minor = minor; + version->revision = revision; + + return 0; +} + +/** + * es58x_parse_hw_rev() - Extract hardware revision number. + * @es58x_dev: ES58X device. + * @prod_info: USB custom string returned by the device. + * + * @prod_info contains the hardware revision prefixed by a magic + * string and conquenated together with other numbers. Depending on + * the device, the hardware revision format is either + * "HW_VER:axxx/xxx" or "HR:axxx/xxx" where 'a' represents a letter + * and 'x' a digit. + * + * Parse @prod_info and store the hardware revision number in + * &es58x_dev.hardware_revision. + * + * Return: zero on success, -EBADMSG if @prod_info could not be + * parsed. + */ +static int es58x_parse_hw_rev(struct es58x_device *es58x_dev, + const char *prod_info) +{ + char letter; + int major, minor; + + /* The only occurrence of 'H' is in the hardware revision prefix. */ + prod_info = strchr(prod_info, 'H'); + if (!prod_info) + return -EBADMSG; + /* Go to beginning of the hardware revision */ + prod_info = strchr(prod_info, ':'); + if (!prod_info) + return -EBADMSG; + prod_info++; + + if (sscanf(prod_info, "%c%3u/%3u", &letter, &major, &minor) != 3) + return -EBADMSG; + + es58x_dev->hardware_revision.letter = letter; + es58x_dev->hardware_revision.major = major; + es58x_dev->hardware_revision.minor = minor; + + return 0; +} + +/** + * es58x_parse_product_info() - Parse the ES58x product information + * string. + * @es58x_dev: ES58X device. + * + * Retrieve the product information string and parse it to extract the + * firmware version, the bootloader version and the hardware + * revision. + * + * If the function fails, simply emit a log message and continue + * because product information is not critical for the driver to + * operate. + */ +void es58x_parse_product_info(struct es58x_device *es58x_dev) +{ + char *prod_info; + + prod_info = usb_cache_string(es58x_dev->udev, ES58X_PROD_INFO_IDX); + if (!prod_info) { + dev_warn(es58x_dev->dev, + "could not retrieve the product info string\n"); + return; + } + + if (es58x_parse_sw_version(es58x_dev, prod_info, "FW") || + es58x_parse_sw_version(es58x_dev, prod_info, "BL") || + es58x_parse_hw_rev(es58x_dev, prod_info)) + dev_info(es58x_dev->dev, + "could not parse product info: '%s'\n", prod_info); + + kfree(prod_info); +} + +/** + * es58x_sw_version_is_set() - Check if the version is a valid number. + * @sw_ver: Version number of either the firmware or the bootloader. + * + * If &es58x_sw_version.major, &es58x_sw_version.minor and + * &es58x_sw_version.revision are all zero, the product string could + * not be parsed and the version number is invalid. + */ +static inline bool es58x_sw_version_is_set(struct es58x_sw_version *sw_ver) +{ + return sw_ver->major || sw_ver->minor || sw_ver->revision; +} + +/** + * es58x_hw_revision_is_set() - Check if the revision is a valid number. + * @hw_rev: Revision number of the hardware. + * + * If &es58x_hw_revision.letter is the null character, the product + * string could not be parsed and the hardware revision number is + * invalid. + */ +static inline bool es58x_hw_revision_is_set(struct es58x_hw_revision *hw_rev) +{ + return hw_rev->letter != '\0'; +} + +/** + * es58x_devlink_info_get() - Report the product information. + * @devlink: Devlink. + * @req: skb wrapper where to put requested information. + * @extack: Unused. + * + * Report the firmware version, the bootloader version, the hardware + * revision and the serial number through netlink. + * + * Return: zero on success, errno when any error occurs. + */ +static int es58x_devlink_info_get(struct devlink *devlink, + struct devlink_info_req *req, + struct netlink_ext_ack *extack) +{ + struct es58x_device *es58x_dev = devlink_priv(devlink); + struct es58x_sw_version *fw_ver = &es58x_dev->firmware_version; + struct es58x_sw_version *bl_ver = &es58x_dev->bootloader_version; + struct es58x_hw_revision *hw_rev = &es58x_dev->hardware_revision; + char buf[max(sizeof("xx.xx.xx"), sizeof("axxx/xxx"))]; + int ret = 0; + + if (es58x_sw_version_is_set(fw_ver)) { + snprintf(buf, sizeof(buf), "%02u.%02u.%02u", + fw_ver->major, fw_ver->minor, fw_ver->revision); + ret = devlink_info_version_running_put(req, + DEVLINK_INFO_VERSION_GENERIC_FW, + buf); + if (ret) + return ret; + } + + if (es58x_sw_version_is_set(bl_ver)) { + snprintf(buf, sizeof(buf), "%02u.%02u.%02u", + bl_ver->major, bl_ver->minor, bl_ver->revision); + ret = devlink_info_version_running_put(req, + DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER, + buf); + if (ret) + return ret; + } + + if (es58x_hw_revision_is_set(hw_rev)) { + snprintf(buf, sizeof(buf), "%c%03u/%03u", + hw_rev->letter, hw_rev->major, hw_rev->minor); + ret = devlink_info_version_fixed_put(req, + DEVLINK_INFO_VERSION_GENERIC_BOARD_REV, + buf); + if (ret) + return ret; + } + + return devlink_info_serial_number_put(req, es58x_dev->udev->serial); +} + const struct devlink_ops es58x_dl_ops = { + .info_get = es58x_devlink_info_get, }; From patchwork Wed Nov 30 17:46:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1065087wrr; Wed, 30 Nov 2022 09:50:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5itTm2PEGELHrUIGzzhHTdXf9z0xMotNf4zKpOFGSzRyA1xnOewReM9uUy8Y85B3PqyrM+ X-Received: by 2002:a17:907:2a82:b0:7ab:9952:9452 with SMTP id fl2-20020a1709072a8200b007ab99529452mr55259919ejc.142.1669830615581; Wed, 30 Nov 2022 09:50:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669830615; cv=none; d=google.com; s=arc-20160816; b=zGh6XEKB9HPW7hO3Hexzpw3CPjoAtt3Mnu4l6QsDGAOQJMpXTXYVxlCuFfokM/FTHW kFmmqzvMbWsUbPFi5ysdZ2ekfDKg4u6zMMobnMN67L9GuXw9Y2EArGSl7Mp4xfagWdwb TN6v8Pdu+5E/epsUO2z1W6eeCs/hILvhWvx3ulCUSecSLIi1UqjAzfnktj0xDFuatMdB BFBeNLBdRdecPKwNLYklCa6pvEf5qltCKdflcv+C1yxVNR4gbCn5feeYW2HlbCxzHUDA 9UHnQCAz3viRpmSQhzSSbYa0/nLwqt4Nhf64xvd0y49ElfYIfz/17SkSFBbUKQwhzjHH aP3A== 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=tj7enRhPuy66CIZyAohvX82mU67j6EK9+WaOtfyvKP0=; b=GOkISxHvarHm1ma5xWnwpBLPBrnev16FAlWZhtNFQCiFd+ejF8+132UiB8PGe/qBxB FXkZgk3pjccVZKz7su82KuvCmP4isjlzUsvL0IY3D9JuKEyJxgceVCsz60ZPwdfqzELP rQDFpydsswWSb/afz16cS/taNR8uXmA4f21o+wKpJsmwD3Ip7IDbF8bAccnxPM93WUmm vIZdmOD39vlt3e2JOXOaw16eXiLGF5OB2uQmpbTVBTl1U838TKxSePiln1UViIB55Z+2 dHIcF0yZt/ght348YK6/jFyjroOppnT2cKJBKt96B/e087Me99x19jechWG4LixoKzh6 sQYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gW7Glxr4; 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 r12-20020aa7d14c000000b004520b01a355si1648249edo.52.2022.11.30.09.49.51; Wed, 30 Nov 2022 09:50:15 -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=gW7Glxr4; 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 S230209AbiK3RsR (ORCPT + 99 others); Wed, 30 Nov 2022 12:48:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbiK3RsD (ORCPT ); Wed, 30 Nov 2022 12:48:03 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2C975F869; Wed, 30 Nov 2022 09:47:29 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id o5-20020a17090a678500b00218cd5a21c9so2973702pjj.4; Wed, 30 Nov 2022 09:47:29 -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=tj7enRhPuy66CIZyAohvX82mU67j6EK9+WaOtfyvKP0=; b=gW7Glxr4GdJ3ncxZPVzkedpvAS3HmjppVo/DWtEB5hmO2I3RVWF6iyP4GnJ6jfwN8U /fliXq/vxErXBr8QBZuWgR65ZDILbneZZM0yDdJlj+cWRF8/dL2zCzC2HXfrIUOpVnJW KBpIUaOEcb+UPR7PRj7SGZDapCPMwheYM5t5Xjvg+CS2vlCtAN4xA+XijWSah7gYZ1kM VVlyctPzd8duvhvOP35k5QG5eqNYzIut5X4gcjAfmAyz7EVgrAbHcUVbRFjcrtVdD1pa GAKc5+H8MHwRR8vrNLT7k0Glv/FfGl/OXHwQLMJAnqLaPX56fd0FzWfEpmLgzrqmRlkS 97XQ== 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=tj7enRhPuy66CIZyAohvX82mU67j6EK9+WaOtfyvKP0=; b=QljJZR8uaO+VW9KWMCNn6GD5zP+PDeqvoHZMwV9DbY23xExTKT686n3e2DpFfRiqkm mnXaQWg2dF1qHn+U7iUPFYPD1PLFSKqf6J4WO5cY/CKVrArRIPpsr0tYYDoNROTlJuTj tLX04oxVyGti8W+hsWNDd9aovJV8VoViu7sSqARH4GFF6vvq4GH9BMjODMxwt1mUjLAp PQEwNo18cEsNkhB4qEmK6mx39Cq0lmZDDuz1QugHq8y8gqbqC/Q9d7pr2HC4VGlTZb/L I2urpof1aY/HMtzYZ9cevEtKBtX8XfZ7mrIQMapfC++ovCYzKmOjdC/3rh2d/fgoyI1X 6ZtA== X-Gm-Message-State: ANoB5pnczyX/BuxGCKmsqxcRINLzdgwZ7Yi0WomL7l7EShn3X+9bTQrX kY1KcImtDNNn+BbHyBYKGyuF7RqmOBaSXg== X-Received: by 2002:a17:902:8604:b0:189:5484:3717 with SMTP id f4-20020a170902860400b0018954843717mr34377645plo.15.1669830448882; Wed, 30 Nov 2022 09:47:28 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47:28 -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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 6/7] can: etas_es58x: remove es58x_get_product_info() Date: Thu, 1 Dec 2022 02:46:57 +0900 Message-Id: <20221130174658.29282-7-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1750576588839389451?= X-GMAIL-MSGID: =?utf-8?q?1750944307998211537?= Now that the product information are available under devlink, no more need to print them in the kernel log. Remove es58x_get_product_info(). Signed-off-by: Vincent Mailhol Reviewed-by: Andrew Lunn --- drivers/net/can/usb/etas_es58x/es58x_core.c | 52 ++------------------- 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index 4d6d5a4ac06e..0c7f7505632c 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -2141,48 +2141,6 @@ static void es58x_free_netdevs(struct es58x_device *es58x_dev) } } -/** - * es58x_get_product_info() - Get the product information and print them. - * @es58x_dev: ES58X device. - * - * Do a synchronous call to get the product information. - * - * Return: zero on success, errno when any error occurs. - */ -static int es58x_get_product_info(struct es58x_device *es58x_dev) -{ - struct usb_device *udev = es58x_dev->udev; - const int es58x_prod_info_idx = 6; - /* Empirical tests show a prod_info length of maximum 83, - * below should be more than enough. - */ - const size_t prod_info_len = 127; - char *prod_info; - int ret; - - prod_info = kmalloc(prod_info_len, GFP_KERNEL); - if (!prod_info) - return -ENOMEM; - - ret = usb_string(udev, es58x_prod_info_idx, prod_info, prod_info_len); - if (ret < 0) { - dev_err(es58x_dev->dev, - "%s: Could not read the product info: %pe\n", - __func__, ERR_PTR(ret)); - goto out_free; - } - if (ret >= prod_info_len - 1) { - dev_warn(es58x_dev->dev, - "%s: Buffer is too small, result might be truncated\n", - __func__); - } - dev_info(es58x_dev->dev, "Product info: %s\n", prod_info); - - out_free: - kfree(prod_info); - return ret < 0 ? ret : 0; -} - /** * es58x_init_es58x_dev() - Initialize the ES58X device. * @intf: USB interface. @@ -2261,28 +2219,24 @@ static int es58x_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct es58x_device *es58x_dev; - int ch_idx, ret; + int ch_idx; es58x_dev = es58x_init_es58x_dev(intf, id->driver_info); if (IS_ERR(es58x_dev)) return PTR_ERR(es58x_dev); - ret = es58x_get_product_info(es58x_dev); - if (ret) - return ret; - es58x_parse_product_info(es58x_dev); devlink_register(priv_to_devlink(es58x_dev)); for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) { - ret = es58x_init_netdev(es58x_dev, ch_idx); + int ret = es58x_init_netdev(es58x_dev, ch_idx); if (ret) { es58x_free_netdevs(es58x_dev); return ret; } } - return ret; + return 0; } /** From patchwork Wed Nov 30 17:46:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 27929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1072472wrr; Wed, 30 Nov 2022 10:05:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4jxQ1ypcFQOzuHseaoBahzZ4aoM2/UI0JRvpOFYIkm5VRbyNlRsnpc78J14fuUeDfF8pX/ X-Received: by 2002:a17:907:98cf:b0:7c0:805d:141e with SMTP id kd15-20020a17090798cf00b007c0805d141emr9796099ejc.398.1669831511915; Wed, 30 Nov 2022 10:05:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669831511; cv=none; d=google.com; s=arc-20160816; b=VwQdQVB82fQjN9P6eASDOa6S5KCcRBQ+Gv+804/Rjwc9WVTeXDViYAb1Uu0Wh2GaCJ YlPcxmwEYELjWdAdCU8Cbhsra9SzzQD8lxdNW642haauDus8TbjKD1pIzLXEHWBjdllw h627ce+zTexAYIpt7an1bBKjyEJmunjGM5eUSvPu+t3uRQHiXo1AhAGLYgU0FCfayEoT U4U4a5DeQro5CCa5lp/GYIWSNEEkmbpyU9/hAqfFMU/jf3JfJ9F7Q8qprznU/bPwQy7E Yz7zPu34illwQr3oa31CiryVPOcNj6hn4J1KHsUIOksBLlIGh+PsBqf4KMyIUU8xqGzw 4Giw== 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=cBWVgR+RLUqkJ8KuTZNticMrWH5FaJ887K/c4/dMWdA=; b=LM2+sepiqWh+w5/t24Q8zAKjm++imjfAdckMIevOf8LiZ7r0on4vSXxKymm4WRBCVQ A2/u8Tr9nczmdsWgFcwl4XIbAD6eb9XcFmI/2YM7S6uXHLrFrrvFvksKqhZmOg5TaDZz gTit7yloCLHkf787B9OCSI/kWlvBupFh+YEzEWrDvLbdRJBFAaGoV3F0THcYQDsMy0qe QXr3myN02wHH0urHNiX69V4VNGVB7OMtpXvpnqBY295cxZlKZaEAUeGcmEsv5Pxna/d4 pFcFwQfXfsND+p9o+UU7IrcSudKNY4YrMI3C7L40ixXwrW8792f4QPjc0J+pS1Ugs+gM ftBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WsjXgGWo; 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 v1-20020a509541000000b00461d2ed78afsi1972036eda.563.2022.11.30.10.04.43; Wed, 30 Nov 2022 10:05:11 -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=WsjXgGWo; 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 S230133AbiK3Rsf (ORCPT + 99 others); Wed, 30 Nov 2022 12:48:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbiK3RsI (ORCPT ); Wed, 30 Nov 2022 12:48:08 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C359DF8; Wed, 30 Nov 2022 09:47:32 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id r18so16736778pgr.12; Wed, 30 Nov 2022 09:47: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=cBWVgR+RLUqkJ8KuTZNticMrWH5FaJ887K/c4/dMWdA=; b=WsjXgGWo66TTf4k4CxDjO+Yxift66oL1FoKPNxBbihKtuoOA6A11uvbDG1PwudCgXQ w2Ti5aXY8NPBiYPRx1hyWUXPmCkOESo3MEfV2IflpG7PcWR5dtjp0WF24VSI2s/8jqEl u0Zs46TlIevVudlrikGM7pRi4OV7QB008WyTpDuAw4c5SX+SWGbr7y10DFDAgzZ+CEnd +07OmOj6ViR0TZqXMuxH+nduGu3vUSf9+2P3pSXh/Z8SIDh1Zyl8nMfCKI49nfag8N7p x6YY/OHtrnAAu/wR7sapVecrlvjsHAfYrOtnVtWdTb2qLKrbft82Y93QZwMsWIzWv9tf kTCg== 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=cBWVgR+RLUqkJ8KuTZNticMrWH5FaJ887K/c4/dMWdA=; b=fW70i49ADstA59XQ8pgtgeVJfjFfOKyuYCcEUi3VkErUxEBOE45uRiM9PeeZ2iPutT NihDMKpVYvRELdg2xw8opexIiKvI5CwuR4ekkBZgLY/V/+B3/0XUGJos/IIY1607+p5d Mx2Srcr3MGMTMSGEnO6FE60a/QfyldRhI8LG/vjfzZ0K48O6gvYy55B8NlEnnYCjmpPs vbN2PV2yCGOeVq4Q/x/jbmfS4WdbQNnmWYaT5DfkRIpwdbg9Bzrc6LGrkCti5RZdh14h 161Gl2fbbFCG99+rA3DLYzlSjGcDjSBbu06xzvGZF3EGd/RZLbXTMMz7gwevlv5PhtDN 09Gg== X-Gm-Message-State: ANoB5plzxDzBqMAmOlEPSUJ4PM1X9VYrTGq5bvZgwAJ6sjQ+Sr6/B0xi 1lnh+YMYnZB2L6PZ7TzLwFDuKF+tjikdew== X-Received: by 2002:a63:1345:0:b0:476:f92f:69f0 with SMTP id 5-20020a631345000000b00476f92f69f0mr55727855pgt.463.1669830451644; Wed, 30 Nov 2022 09:47:31 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id p3-20020aa79e83000000b00574cdb63f03sm1714505pfq.144.2022.11.30.09.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:47: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 , Jakub Kicinski , Vincent Mailhol Subject: [PATCH v5 7/7] Documentation: devlink: add devlink documentation for the etas_es58x driver Date: Thu, 1 Dec 2022 02:46:58 +0900 Message-Id: <20221130174658.29282-8-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> References: <20221104073659.414147-1-mailhol.vincent@wanadoo.fr> <20221130174658.29282-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 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?1750576621064523703?= X-GMAIL-MSGID: =?utf-8?q?1750945247187461968?= List all the version information reported by the etas_es58x driver through devlink. Also, update MAINTAINERS with the newly created file. Signed-off-by: Vincent Mailhol --- .../networking/devlink/etas_es58x.rst | 36 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 37 insertions(+) create mode 100644 Documentation/networking/devlink/etas_es58x.rst diff --git a/Documentation/networking/devlink/etas_es58x.rst b/Documentation/networking/devlink/etas_es58x.rst new file mode 100644 index 000000000000..9893e57b625a --- /dev/null +++ b/Documentation/networking/devlink/etas_es58x.rst @@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================== +etas_es58x devlink support +========================== + +This document describes the devlink features implemented by the +``etas_es58x`` device driver. + +Info versions +============= + +The ``etas_es58x`` driver reports the following versions + +.. list-table:: devlink info versions implemented + :widths: 5 5 90 + + * - Name + - Type + - Description + * - ``fw`` + - running + - Version of the firmware running on the device. Also available + through ``ethtool -i`` as the first member of the + ``firmware-version``. + * - ``bl`` + - running + - Version of the bootloader running on the device. Also available + through ``ethtool -i`` as the second member of the + ``firmware-version``. + * - ``board.rev`` + - fixed + - The hardware revision of the device. + * - ``serial_number`` + - fixed + - The USB serial number. Also available through ``lsusb -v``. diff --git a/MAINTAINERS b/MAINTAINERS index 955c1be1efb2..71f4f8776779 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7682,6 +7682,7 @@ ETAS ES58X CAN/USB DRIVER M: Vincent Mailhol L: linux-can@vger.kernel.org S: Maintained +F: Documentation/networking/devlink/etas_es58x.rst F: drivers/net/can/usb/etas_es58x/ ETHERNET BRIDGE