Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp265187iol; Sat, 11 Jun 2022 03:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwL55EYF3J3qLsOJP6iRWtkEz1TvKDpyoUoFPwvD9mlmXMTPGi9twyvnuNqi0KwdSWrefE X-Received: by 2002:a17:902:7202:b0:167:6548:3f3e with SMTP id ba2-20020a170902720200b0016765483f3emr36457912plb.98.1654944666089; Sat, 11 Jun 2022 03:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654944666; cv=none; d=google.com; s=arc-20160816; b=rOIa4fFJ3ABUWlVtH+VOVRAl7gUeOGXeh4F6YpBbcKAVdcjMJH5AfNn04cMXlLUQPF YQfdrfHDg/Ae/xdJ7NzGyr/rWPLWZSCa5H+MYn9yTXlq1AvtZPEfHttgc2kBWmGwnVx1 NJf5s7PzBs0M0WtYXXOXOQKz9s0r8Un2p3NAC6+4dQb1rByr0JvYIHDprPzXoUe6OGzN s68l6byr2mHidEAU6u8PSXl8qUx0cQqRDvmqLs+dTSiDL8d5drmAqSAp4G6QtcPuDb+t aRDqcEhtIxObABi19AI6qfFLP2HwUoZ76SZTKk1enFQgdTjjJ9wvmOg5tKTX1yilPtmQ Gwnw== 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=va6/lF6L6Ng8zl2J0isVPUb8pv9qoi2tKiUrpBsODPA=; b=IU1NUopg+Q9ll3OR0tGyP8fQZN5h0ewycEjB0aaNDnQ17G3q4KNJvXFP1160DGqyJj ZAk2sesimINUFyGO2zXwO+VKbAemNmgxY1NNstlWwbcVB0K/b5Ifns9MMcf5lFLT3O5M 5N20IbDUfuQJuo7bsJs+6svzwZPFRzexVMSkA5ThRgSIbaTUE7IKtSSxkT3Qm5BIT1gr /32J3T2YriUvHL2BK1dubQvXA4JYmkkBv+eRwivMswXPHh5lYxb5v+udQzyN10b4YZZY aTKIHrNd105xQqUkMSnh5jsyuyokhBJuJlAAEC8OEoJP6i7mihRoXYoNWie+4fZfuM5s +LHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DjLgzQ27; 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 s1-20020a634501000000b003dba8415dfesi1951071pga.769.2022.06.11.03.50.54; Sat, 11 Jun 2022 03:51:06 -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=DjLgzQ27; 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 S232428AbiFKKqT (ORCPT + 99 others); Sat, 11 Jun 2022 06:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbiFKKqS (ORCPT ); Sat, 11 Jun 2022 06:46:18 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C319FCC for ; Sat, 11 Jun 2022 03:46:16 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id c2so2129964lfk.0 for ; Sat, 11 Jun 2022 03:46:16 -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=va6/lF6L6Ng8zl2J0isVPUb8pv9qoi2tKiUrpBsODPA=; b=DjLgzQ27Ee07ihrkEXtl7JW/IRmTqDJodYVSEyOl8ZIznuzFzBdk9oqZMHdorpBtr8 syS/0JO2bowlxuPY8zX3+ul0eLzNyIVUFRTW57NNCDGKVOwLkWkZJ8ov4yX9MljDw15s B1cwl1nzokQ9zDokzpNPPERUAATQQF+MUCRKA= 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=va6/lF6L6Ng8zl2J0isVPUb8pv9qoi2tKiUrpBsODPA=; b=WtmG2/aOftu2Std1HqG4hA0a205gv83wHIGoiR9ZCr7YC8Z8tJgRsLadnL6DZC1w1c lmOd7Raub8GdW03uoGFdBx5HSF+z9kawF7/dfVFSlAqczP/jSnyu5ZZfQgJ/Wyxxlrli f7b9zdRUNM6x56YUtYknSmvMlgj/tOQIOiKeHGEs5pxn0fC3L7jrPbiXCVoSGTSwHuEY 77YUoBzO8HXpy4M8AnqnpMQLQVwXFJxHx2lm8ba3G0IqFmHbjKS0tg9gMLoJ4M8ql3lv 1Wz/XTgDFc63pPxSLpyei8PTpEJjMUhWchZYBv69PZ5WOdU7NpvzjWzANXYkPql0cymR JiQg== X-Gm-Message-State: AOAM5331n/XZImv6LKeXi4gBWGasemx/HVr/5u19doDPhmGZS1zAlrUv KSOFRC9adkhMaZyNzgJvJYzexaAKUvE3/h0Jy7kCTDJ24aFD0w== X-Received: by 2002:a05:6512:10c5:b0:479:2de0:561c with SMTP id k5-20020a05651210c500b004792de0561cmr21354813lfg.536.1654944374938; Sat, 11 Jun 2022 03:46:14 -0700 (PDT) MIME-Version: 1.0 References: <20220608165116.1575390-1-dario.binacchi@amarulasolutions.com> <20220608165116.1575390-6-dario.binacchi@amarulasolutions.com> In-Reply-To: From: Dario Binacchi Date: Sat, 11 Jun 2022 12:46:04 +0200 Message-ID: Subject: Re: [PATCH v2 05/13] can: slcan: simplify the device de-allocation To: Oliver Hartkopp Cc: 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 Hi, On Wed, Jun 8, 2022 at 10:38 PM Oliver Hartkopp wrote: > > This patch (at least) needs some rework. Any suggestions are welcome. And double-checking the patch, I already have some changes to put in version 3. > > The patch cf124db566e6b036 ("net: Fix inconsistent teardown and release > of private netdev state.") from DaveM added some priv_destructor > > dev->priv_destructor = sl_free_netdev; > > which is not taken into account in this patch. > > 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 ? > > 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. 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 ? Anyway, I have some changes and tests to run before submitting version 3. If I don't get any hints before then, I'll drop it from the series. Thanks and regards, Dario > Thanks, > Oliver > > On 08.06.22 18:51, Dario Binacchi wrote: > > Since slcan_devs array contains the addresses of the created devices, I > > think it is more natural to use its address to remove it from the list. > > It is not necessary to store the index of the array that points to the > > device in the driver's private data. > > > > Signed-off-by: Dario Binacchi > > --- > > > > (no changes since v1) > > > > drivers/net/can/slcan.c | 15 ++++++++++----- > > 1 file changed, 10 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c > > index 929cb55e08af..cf05c30b8da5 100644 > > --- a/drivers/net/can/slcan.c > > +++ b/drivers/net/can/slcan.c > > @@ -432,11 +432,17 @@ static int slc_open(struct net_device *dev) > > > > static void slc_dealloc(struct slcan *sl) > > { > > - int i = sl->dev->base_addr; > > + unsigned int i; > > > > - free_candev(sl->dev); > > - if (slcan_devs) > > - slcan_devs[i] = NULL; > > + for (i = 0; i < maxdev; i++) { > > + if (sl->dev == slcan_devs[i]) { > > + free_candev(sl->dev); > > + slcan_devs[i] = NULL; > > + return; > > + } > > + } > > + > > + pr_err("slcan: can't free %s resources\n", sl->dev->name); > > } > > > > static int slcan_change_mtu(struct net_device *dev, int new_mtu) > > @@ -533,7 +539,6 @@ static struct slcan *slc_alloc(void) > > > > snprintf(dev->name, sizeof(dev->name), "slcan%d", i); > > dev->netdev_ops = &slc_netdev_ops; > > - dev->base_addr = i; > > sl = netdev_priv(dev); > > > > /* Initialize channel control data */ > > -- 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