Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp183949pxy; Sat, 14 Aug 2021 04:14:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvtzRNMBrEpYvZggPooV7NtoNu9OfhjBtGEL4aVuZleghhqwOSQRx6yPWr1t9fffo+xGJ7 X-Received: by 2002:a17:906:87d0:: with SMTP id zb16mr4880424ejb.143.1628939691425; Sat, 14 Aug 2021 04:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628939691; cv=none; d=google.com; s=arc-20160816; b=AxBimeglQTi/IyicRwEhoQOBQghCT9Xcm3crfnPLOkJUj8BKW3tvBdLCzRz1+lzjJv RrrJzXDFWDrt4Fe5CF4HjthRmVB/gZs9oOV3XI6EXdVg7y9fYQDlF724bqvTkkfrcj/6 bIH5qq4ZzDQsdSnEg+6bdlgF6ZE62V+xvyPiok+7jfEfk4IeNfnFiRxrFP3qCygb9AQx pCA1MpkxXQ6aJVn3fSwmmECvmmz0HQNrb7vRb6Vahrl+sPLCB8ReszmzUHFAPUyU4BIU zPZX8EX7JlrIei4Mm8/spHTzrMO0xYaejrEHWSRuFHTvgaWvUCHf5T/IP8kea24SXIAs mBAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=A35sSUaL8GFC/OfKldlBQSyJfaW4OXpeZ4VtTCVh3Ss=; b=coM8FMxEKijgBo9wJ2r8f6PZGJhnVdUNq6scjG/D/yDz/wycwvgFu74J5PRXdujGIQ hnKPJ6WRx6MNksXs2VhNF3p43Z3ZtQE1L0XTPQRrAd+8dZqIwGLulAFqJnwLfGwAmxHI Vc5AVoabCuxdf09n1r+rBL4EYfKEwpdgdtOtZ5QcqmdjAP1Mk4qlaS5AyL2LTMG68hA7 /AoMfKruiPrtviIuKicaS+UvPEnlf8YOoZjvsrJb5Z4xWdzVJMdpUCIu7Sg3/p5IqtME 3RGOPlY3Ob8mkyuR62LNPTkBQ15ueHHNqv7gxs6FPchRdKEL3vubLvBHygURLBq/Te3b 2Mmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si3444627ejp.504.2021.08.14.04.14.27; Sat, 14 Aug 2021 04:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238132AbhHNLNU (ORCPT + 99 others); Sat, 14 Aug 2021 07:13:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238068AbhHNLNT (ORCPT ); Sat, 14 Aug 2021 07:13:19 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DCFC0613CF for ; Sat, 14 Aug 2021 04:12:51 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mErap-0006l4-Mg; Sat, 14 Aug 2021 13:12:47 +0200 Received: from pengutronix.de (unknown [IPv6:2a02:810a:8940:aa0:9c12:ab28:ecb4:fe2f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 690556672B6; Sat, 14 Aug 2021 11:12:45 +0000 (UTC) Date: Sat, 14 Aug 2021 13:12:43 +0200 From: Marc Kleine-Budde To: Vincent Mailhol Cc: linux-can@vger.kernel.org, Stefan =?utf-8?B?TcOkdGpl?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 5/7] can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC) Message-ID: <20210814111243.biquurwkyzmhmsad@pengutronix.de> References: <20210814091750.73931-1-mailhol.vincent@wanadoo.fr> <20210814091750.73931-6-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4shgy4pvm2efxhha" Content-Disposition: inline In-Reply-To: <20210814091750.73931-6-mailhol.vincent@wanadoo.fr> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4shgy4pvm2efxhha Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 14.08.2021 18:17:48, Vincent Mailhol wrote: [...] > static int can_changelink(struct net_device *dev, struct nlattr *tb[], > struct nlattr *data[], > struct netlink_ext_ack *extack) > { > struct can_priv *priv =3D netdev_priv(dev); > + u32 tdc_mask =3D 0; > int err; > =20 > /* We need synchronization with dev->stop() */ > @@ -107,6 +179,7 @@ static int can_changelink(struct net_device *dev, str= uct nlattr *tb[], > struct can_ctrlmode *cm; > u32 ctrlstatic; > u32 maskedflags; > + u32 tdc_flags; > =20 > /* Do not allow changing controller mode while running */ > if (dev->flags & IFF_UP) > @@ -138,7 +211,18 @@ static int can_changelink(struct net_device *dev, st= ruct nlattr *tb[], > dev->mtu =3D CAN_MTU; > memset(&priv->data_bittiming, 0, > sizeof(priv->data_bittiming)); > + memset(&priv->tdc, 0, sizeof(priv->tdc)); > + priv->ctrlmode &=3D ~CAN_CTRLMODE_TDC_MASK; > } > + > + tdc_flags =3D cm->flags & CAN_CTRLMODE_TDC_MASK; > + /* CAN_CTRLMODE_TDC_{AUTO,MANUAL} are mutually exclusive */ > + if (tdc_flags =3D=3D CAN_CTRLMODE_TDC_MASK) > + return -EOPNOTSUPP; > + /* If one of CAN_CTRLMODE_TDC_* is set then TDC must be set */ > + if (tdc_flags && !data[IFLA_CAN_TDC]) > + return -EOPNOTSUPP; These don't need information form the can_priv, right? So these checks can be moved to can_validate()? > + tdc_mask =3D cm->mask & CAN_CTRLMODE_TDC_MASK; > } Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --4shgy4pvm2efxhha Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmEXpSkACgkQqclaivrt 76lPBAgAiA1KYdu+Pm1Su6TWxfQKUKI6UbAud8iKhBti39RNRgD6V5zQGQBZGhNS wqFdr1nRzsdLT/oQ4W8M0EWrS+mNvB5IPk/geNY9jO1rC46KAZtWwoyf7BqIlfx3 higjmxcgqe/teVyMh6/L+5QWqdv2Lz2WBiI9DY2+6IZAgqsVQfyMqI93KF8zwJpr EjM6u6xJsCnCiUhDpCAmX/S1sOOKa9VaLLkAdK9x1jx3WNKE3xE76gQHJFKlu0TJ 0Mn173df3TUTjX5drGHuQKSn6tKqZZOsZxn+O1CQw1+JZyY1S4jorZ4o3swLn8+y VROzoormCCov12GfAZJ68ayCvdUWtQ== =Dlcn -----END PGP SIGNATURE----- --4shgy4pvm2efxhha--