Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp58769iog; Sun, 12 Jun 2022 18:50:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiyxOiT9iaoXZLZgiQqx9DFriBB1PpuDmfcbuSN6C2v1Yqoe40RocgMAzBn9uS9oGi5DTo X-Received: by 2002:a17:903:2341:b0:167:4b11:a8e with SMTP id c1-20020a170903234100b001674b110a8emr48400351plh.10.1655085053292; Sun, 12 Jun 2022 18:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655085053; cv=none; d=google.com; s=arc-20160816; b=hbwizVkLTEtQ35ja8XnmLFP6KRflGEW8An2UGiCf4oIYD3f9nZZMFKYtPGfP4Czb4y 0EW6BW7aUcTeVPo93SYDy0mCoqMa0BhsUlZYjOERMMbEgiWIIxbmYK/OQw5/gZe/SzgC j12KCX0J97tiociQbnOsAXVo/17SiuZieQJPG19oSXTqcKAQnJJmGpOYnAB7PmskNPNw /PFGtvzGfIYJPwtHcxWHTCN6P+aG+ov4Yhus1tOjhQjhmervv3bv1aFraZ0WLPvQX57r ldVL3YaJyzGPwy6urK5l/QYlF9XB+lPiIWiV90yFhJaRI9jAzLWfnCGYccehJ6qiGB/o 4vZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VAh12BAJ2Y3B+nB2oJ2V7WD57RZgiUFZsN9mmdJrTLw=; b=wp3ZMvUcSlltnKTL1Dh2HOVoNzSdArcdJjyJWvJatvFYSPo5o2/JbPGxY2gtLGoavR A3bTQv6VJdreBPDD5EW1Xonl3MUH0ONRxGVz2mGg0CMGcEhCWuda8KtgEyUDkzqzfHqg PyJRLl6CA0TtToyvR5aZ7JWM4ve4DZ8DDlMZV43VlwaOBaMkkKS8RRkY/tBbjhxuFOh2 Bvr7i99SnUcPrpzMTVCAyhXqn2YRp905/IpNSJS14vqJ6Aug5swa+jxQ7bE7D+5tSejT mVHB1z7SO1jUgpBwsdSK9AmoyAZCfQ/2ZMD9mWTj2kpnkhv2LRzfxybfi3FN11RQi+ZP aPdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X8Y5pq4a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h34-20020a635762000000b003a4b9e4f3b3si8098252pgm.330.2022.06.12.18.50.40; Sun, 12 Jun 2022 18:50:53 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X8Y5pq4a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbiFLVUR (ORCPT + 99 others); Sun, 12 Jun 2022 17:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231941AbiFLVUP (ORCPT ); Sun, 12 Jun 2022 17:20:15 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659EF2DE for ; Sun, 12 Jun 2022 14:20:14 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id t25so6082099lfg.7 for ; Sun, 12 Jun 2022 14:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VAh12BAJ2Y3B+nB2oJ2V7WD57RZgiUFZsN9mmdJrTLw=; b=X8Y5pq4aGuSp91WJBgrowdekEmfZyCNbVDGIKpghHQ3ZjVDCHlIOCxB37dvAPsZ0Gn uRZ5mlEjaP94YKJZqJuUzIvlqTa8Vra3N3HUj6aI2QEWYMcy5mzeKg1lr5CpyxnJXIuy FaZsaY5HsaOQ9eZJOCsy0enGukg7/KyVc8rW4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VAh12BAJ2Y3B+nB2oJ2V7WD57RZgiUFZsN9mmdJrTLw=; b=2BmNB1o5Qx5DE6OT+sB4cghviR12Rricwn58yaYPbEcf0HG3KTzEjZHZrmal6+jWKk 8aQaRXCyiNTVRTdzX//ojvJPlFx6rvR/AAAht+zRqlpBl7gJs9zUKafyovfpaLYaN9dP R0Ss/vrTH4G5jGRcFg7p20ejBUfX9c35VxZ4rJotq3+Ei97t+O9Lst/pOZvdgDCQGH0C 4nDkL4+tH7d+dVBPmx9Ha6VeLNbuAFHxNV2WBUVyt4KkOpwT1Xq91z8CM/c713oP9txa 6pecsZQuFmIo7GewdVkeu1XBPnYG/lNb5sBqN0XRdosmPp9vZGq0NYElIvryX+1CumYz L+qg== X-Gm-Message-State: AOAM531HvsOGmSwBOPnv7tm0GH2+yVw9HNV/+GeykV+7zMD1VRGsXxLF OyXB/kWbePrIUotWAxQl+WVO+Mz9tEe1S/TjORJI78JDujjOSg== X-Received: by 2002:a05:6512:3a89:b0:479:52fc:f80a with SMTP id q9-20020a0565123a8900b0047952fcf80amr20862792lfu.120.1655068812754; Sun, 12 Jun 2022 14:20:12 -0700 (PDT) MIME-Version: 1.0 References: <20220608165116.1575390-1-dario.binacchi@amarulasolutions.com> <20220608165116.1575390-6-dario.binacchi@amarulasolutions.com> <20220612182302.36bdd9b9.max@enpas.org> In-Reply-To: From: Dario Binacchi Date: Sun, 12 Jun 2022 23:20:01 +0200 Message-ID: Subject: Re: [PATCH v2 05/13] can: slcan: simplify the device de-allocation To: Oliver Hartkopp Cc: Max Staudt , linux-kernel@vger.kernel.org, Amarula patchwork , michael@amarulasolutions.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marc Kleine-Budde , Paolo Abeni , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Sun, Jun 12, 2022 at 7:13 PM Oliver Hartkopp wrote: > > > > On 12.06.22 18:23, Max Staudt wrote: > > On Sat, 11 Jun 2022 12:46:04 +0200 > > Dario Binacchi wrote: > > > >>> As written before I would like to discuss this change out of your > >>> patch series "can: slcan: extend supported features" as it is no > >>> slcan feature extension AND has to be synchronized with the > >>> drivers/net/slip/slip.c implementation. > >> > >> Why do you need to synchronize it with drivers/net/slip/slip.c > >> implementation ? > > > > Because slcan.c is a derivative of slip.c and the code still looks > > *very* similar, so improvements in one file should be ported to the > > other and vice versa. This has happened several times now. > > > > > >>> When it has not real benefit and introduces more code and may create > >>> side effects, this beautification should probably be omitted at all. > >>> > >> > >> I totally agree with you. I would have already dropped it if this > >> patch didn't make sense. But since I seem to have understood that > >> this is not the case, I do not understand why it cannot be improved > >> in this series. > > > > This series is mostly about adding netlink support. If there is a point > > of contention about a beautification, it may be easier to discuss that > > separately, so the netlink code can be merged while the beautification > > is still being discussed. > > > > > > On another note, the global array of slcan_devs is really unnecessary > > and maintaining it is a mess - as seen in some of your patches, that > > have to account for it in tons of places and get complicated because of > > it. > > > > slcan_devs is probably grandfathered from a very old kernel, since > > slip.c is about 30 years old, so I suggest to remove it entirely. In > > fact, it may be easier to patch slcan_devs away first, and that will > > simplify your open/close patches - your decision :) > > > > > > If you wish to implement the slcan_devs removal, here are some hints: > > > > The private struct can just be allocated as part of struct can_priv in > > slcan_open(), like so: > > > > struct net_device *dev; > > dev = alloc_candev(sizeof(struct slcan), 0); > > > > And then accessed like so: > > > > struct slcan *sl = netdev_priv(dev); > > > > Make sure to add struct can_priv as the first member of struct slcan: > > > > /* This must be the first member when using alloc_candev() */ > > struct can_priv can; > > > > > >> The cover letter highlighted positive reactions to the series because > >> the module had been requiring these kinds of changes for quite > >> some time. So, why not take the opportunity to finalize this patch in > >> this series even if it doesn't extend the supported features ? > > > > Because... I can only speak for myself, but I'd merge all the > > unambiguous stuff first and discuss the difficult stuff later, if there > > are no interdependencies :) > > > > > > > > Max > > > > Thanks for stepping in Max! > > Couldn't have summarized it better ;-) > > When I created slcan.c from slip.c this line discipline driver was just > oriented at the SLIP idea including the user space tools to attach the > network device to the serial tty. > > Therefore the driver took most of the mechanics (like the slcan_devs > array) and did *only* the 'struct canframe' to ASCII conversion (and > vice versa). > > @Dario: Implementing the CAN netlink API with open/close/bitrate-setting > is a nice improvement. Especially as you wrote that you took care about > the former/old API with slcan_attach/slcand. > > Best regards, > Oliver Thanks to both of you for the explanations. best regards, Dario -- Dario Binacchi Embedded Linux Developer dario.binacchi@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com