Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp411479iol; Sat, 11 Jun 2022 07:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtgErLhydWG6uNkdVRSib8LuieGHT4QCmgDZZX0eK6ib7DAax0ow+G2QwksH5kZYdN2vhN X-Received: by 2002:a63:8842:0:b0:3fc:64b0:cacd with SMTP id l63-20020a638842000000b003fc64b0cacdmr44960965pgd.490.1654956870526; Sat, 11 Jun 2022 07:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654956870; cv=none; d=google.com; s=arc-20160816; b=uhjOWSXf/lmkBVBqbBHWTRIzJNEfRaMGuIjV/v/wQDFGGbus4c9nE5FWTj26pcZeoT HyB1/T+5F8uCBN1nbuZ3+uNopzXV4xuJjNO8B+w6nuQ6f2ShZgrC91mEHsbfanv+bSAt hnQJcQWIiLABU0smjksx5kyWdEkeVduJLFvTQ8K94oegRD0GJPxdaND4nCi+9fapvl4r kzfRiD2XUgEcyWAY+d39REwwStoll+ssNa6+6ht5SFKN0MZ+XfeTDI8zQ4rET1EgPUca XyVjh0CDiNBOMW0bGdETDvRq5Xiwdq6ptxlFESNsBV0cW0dmHKbfFgKEpk3BlvpeHCN+ OCwg== 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=YeC1i9uQxwO/F8NG2W7d85XtXBiOn4VafFyVdd+dTpQ=; b=A/qjz3d8k10M2XwLhAQ6Y2oJXLBANdph0ZuxHx1ZBSxdz3jstOVJcgAWJu/jnv2sQR Fdg8iPB6ynGjrBB6rvACLzygYW/yGR3fIJtTQ3zxOCrvYZeaMUuYW8RAeo7ASPQwjTdw Y0D/SjZwOvTRsN9ncgcWlNMesk+DalchSltElgzR8a0YdIy8Nch6+wFiWPYRdA8NTDKa PNOX8qhnZntAkd2sjMH1NrGWQGvYRUedCx+PcjKconG/VlMAFowMVuqpUNSx0uPJGl0u CZJ926vyXjxvtkdKMsBc5sAtYv5AzD8LMadnJIaojydnBMbclAAJbxem7gCUY76kwWqX rwRg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b29-20020a631b5d000000b003fc9b04edf6si2798373pgm.423.2022.06.11.07.14.17; Sat, 11 Jun 2022 07:14:30 -0700 (PDT) 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; 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 S233692AbiFKNiC (ORCPT + 99 others); Sat, 11 Jun 2022 09:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233682AbiFKNiA (ORCPT ); Sat, 11 Jun 2022 09:38:00 -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 05A75BE7 for ; Sat, 11 Jun 2022 06:37:58 -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 1o01JK-0003pU-1R; Sat, 11 Jun 2022 15:37:54 +0200 Received: from pengutronix.de (unknown [IPv6:2a01:4f8:1c1c:29e9:22:41ff:fe00:1400]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) 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 E6A6792DBD; Sat, 11 Jun 2022 13:36:08 +0000 (UTC) Date: Sat, 11 Jun 2022 15:36:08 +0200 From: Marc Kleine-Budde To: Max Staudt Cc: Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, Greg Kroah-Hartman , Oliver Neukum , linux-kernel@vger.kernel.org Subject: Re: [PATCH v7] can, tty: can327 CAN/ldisc driver for ELM327 based OBD-II adapters Message-ID: <20220611133608.3zdfb3nnl5445kr7@pengutronix.de> References: <20220602213544.68273-1-max@enpas.org> <20220611151551.5024f51e.max@enpas.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5edtfo4qnqqn26om" Content-Disposition: inline In-Reply-To: <20220611151551.5024f51e.max@enpas.org> 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 --5edtfo4qnqqn26om Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 11.06.2022 15:15:51, Max Staudt wrote: > @Marc, Wolfgang - one SocketCAN design question about bitrate setting at > the end. I'd appreciate your opinion on my dummy do_set_bittiming(). [...] > > > +/* Dummy needed to use bitrate_const */ > > > +static int can327_do_set_bittiming(struct net_device *netdev) > > > +{ > > > + return 0; > > > +} =20 > >=20 > > Is this dummy function really needed? If think that access to > > can_priv::do_set_bittiming is always garded. Setting it to NULL should > > be OK. c.f.: > > https://elixir.bootlin.com/linux/latest/source/drivers/net/can/dev/netl= ink.c#L198 >=20 > drivers/net/can/dev/netlink.c - can_changelink(): >=20 > /* Calculate bittiming parameters based on > * bittiming_const if set, otherwise pass bitrate > * directly via do_set_bitrate(). Bail out if neither > * is given. > */ > if (!priv->bittiming_const && !priv->do_set_bittiming) > return -EOPNOTSUPP; >=20 > can327 has neither of these two, so I provide a dummy for one. >=20 > What should I do instead? What about this change? diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index 7633d98e3912..667ddd28fcdc 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -176,7 +176,8 @@ static int can_changelink(struct net_device *dev, struc= t nlattr *tb[], * directly via do_set_bitrate(). Bail out if neither * is given. */ - if (!priv->bittiming_const && !priv->do_set_bittiming) + if (!priv->bittiming_const && !priv->do_set_bittiming && + !priv->bitrate_const) return -EOPNOTSUPP; =20 memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); If it works I'll make a patch and apply it to net-next/master so that you can base your series on this. > While at it, a comment in elm327_init mentioned bittiming_const - that > was from the pre-bitrate_const (< v4.11) times, and I've now updated it > to mention bitrate_const instead. regards, 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 | --5edtfo4qnqqn26om Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEBsvAIBsPu6mG7thcrX5LkNig010FAmKkmkUACgkQrX5LkNig 011eDgf7BAiZK/sQ02v4VkaRbtTc7AzHRodPZZJGQMfwJTPwsix2ExBYkUpVwXeZ QTKUcIK2cVWiojidYmWXeuS7uHu62y9smz2PwjZuUg1etbeRxfG3V/o9am3DOLnv mHFeaTMxVLij01BW6GI4vVqbvW9m9uyZmF/I3pKZJVNFZ+X2VX2I2knKHyuFV2oD e59UOlIvSytJ7xEZn9dU4xSRgtMUX9yxBHe//M8Zq6DaRldf8jZ0fzJMzZcdbjg+ Kd04UgB8Yo33P9n4eDz9HEpkdgoJKBkb7Bq+PGw/DXA9vP0YUcCYYS4zevRqKbo0 u+sIue7VyQj54MuSJEo7xkU2ukKWJQ== =lJBy -----END PGP SIGNATURE----- --5edtfo4qnqqn26om--