Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1992298yba; Tue, 2 Apr 2019 22:02:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC4NBC99br+OKWQZn4f6dWcyFDi0F1VoV+d90Dnn3vui1LC46k4lMC6zPJWKHhU9kEI1QF X-Received: by 2002:a63:d1f:: with SMTP id c31mr46491511pgl.353.1554267767826; Tue, 02 Apr 2019 22:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554267767; cv=none; d=google.com; s=arc-20160816; b=0VpZ/s7si15dNdYsHpfFhqAAwcRaV+YQmteqGyTw5NUQD5V7nYVFKlDHE36HCb5Eu4 ziO+A5VLOAo67N+tgZaVr88BcK0NUbWOVBOpOPxhh4Ao2rsWRBdc0ztcVQoWCoagotLH SsxWoYUVaA8TrSnwrZ6N9W/5NQ6F6hjFWNOHVQHNbjq8EBX9EFTHLWO/OLJAYuf/XUSd wy/GbijnH2YlUgUVhqqsoIWuoQuIYSdGFY1YhWb1k8XJkBB9gEydBzYEQVZIwaZcvzOL LZYXbK8kFeCP73uTshE51WI/duNdzrwmo2aPMVOfgolOxKldpQwxxwbKXY/D1SSPd3lm Qgrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=yixq/AvseZ32qyAUxmoffowohsD5F6JvzFzPxzpalhw=; b=pnhKYT6p7yU1p+E4Ehin1rSDIcyDwWstS5P4D3U0GsqNrd4HIjaFbE30LD7//pHG0S Z3LP3LLg4LvNshZKiMbPwXe4qpxtHPHR22HvO0aDerxKV0cx2vd6aVUiOFs8/KudVwL9 iDsM/5/dEtD/vFDVdPO2OGDSwJfVPLbFJ9u2/6JKWg8hJa/DY84jolmvStNny073/JUS kFrGhX69sIRaL3BG7/mchKnYGyD8Q4FT2iE2ofxxb9vQj0WEc3vAKJV/bE/rmmxoHo7H s1JQcm/ACcY2+O3VMKDqLbFLJSyIMLNt8ql91VU6FpnQog/U4GgXdzQCWGAwXYv58Bt0 ubhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si13850115plb.58.2019.04.02.22.02.32; Tue, 02 Apr 2019 22:02:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728752AbfDCFBj (ORCPT + 99 others); Wed, 3 Apr 2019 01:01:39 -0400 Received: from host-88-217-225-28.customer.m-online.net ([88.217.225.28]:11914 "EHLO mail.dev.tdt.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728699AbfDCFBh (ORCPT ); Wed, 3 Apr 2019 01:01:37 -0400 Received: from localhost.localdomain (unknown [10.2.3.20]) by mail.dev.tdt.de (Postfix) with ESMTPSA id EEA1320B46; Wed, 3 Apr 2019 05:01:34 +0000 (UTC) From: Martin Schiller To: andrew.hendry@gmail.com, davem@davemloft.net, khc@pm.waw.pl, isdn@linux-pingi.de Cc: edumazet@google.com, linux-x25@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schiller Subject: [PATCH 4/4] isdn/i4l: Call notifiers before and after changing device type Date: Wed, 3 Apr 2019 07:01:18 +0200 Message-Id: <20190403050118.12785-4-ms@dev.tdt.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190403050118.12785-1-ms@dev.tdt.de> References: <20190403050118.12785-1-ms@dev.tdt.de> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Martin Schiller --- drivers/isdn/i4l/isdn_net.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index c138f66f2659..3016cbcc719a 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -2692,8 +2692,12 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) p->dev->name); return -EINVAL; #else + rtnl_lock(); + call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, p->dev); p->dev->type = ARPHRD_PPP; /* change ARP type */ + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, p->dev); p->dev->addr_len = 0; + rtnl_unlock(); #endif break; case ISDN_NET_ENCAP_X25IFACE: @@ -2702,16 +2706,27 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) p->dev->name); return -EINVAL; #else + rtnl_lock(); + call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, p->dev); p->dev->type = ARPHRD_X25; /* change ARP type */ + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, p->dev); p->dev->addr_len = 0; + rtnl_unlock(); #endif break; case ISDN_NET_ENCAP_CISCOHDLCK: break; default: if (cfg->p_encap >= 0 && - cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP) + cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP) { + rtnl_lock(); + call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, p->dev); + p->dev->type = ARPHRD_ETHER; /* change ARP type */ + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, p->dev); + p->dev->addr_len = ETH_ALEN; + rtnl_unlock(); break; + } printk(KERN_WARNING "%s: encapsulation protocol %d not supported\n", p->dev->name, cfg->p_encap); -- 2.11.0