From patchwork Sat Jul 31 15:05:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Halasa X-Patchwork-Id: 60406 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 462711007D1 for ; Sun, 1 Aug 2010 01:06:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756484Ab0GaPGH (ORCPT ); Sat, 31 Jul 2010 11:06:07 -0400 Received: from khc.piap.pl ([195.187.100.11]:41822 "EHLO khc.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755112Ab0GaPGF (ORCPT ); Sat, 31 Jul 2010 11:06:05 -0400 Received: from intrepid.localdomain (intrepid.localdomain [10.0.0.2]) by khc.piap.pl (Postfix) with ESMTP id 78FFA9872; Sat, 31 Jul 2010 17:05:53 +0200 (CEST) From: Krzysztof Halasa To: David Miller Cc: Subject: [PATCH 05/29] LMC: Remove non-LMC_PPP modes, everything is already handled by generic HDLC. Date: Sat, 31 Jul 2010 17:05:28 +0200 Message-Id: <1280588752-9340-5-git-send-email-khc@pm.waw.pl> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Krzysztof Hałasa Signed-off-by: Krzysztof Hałasa --- drivers/net/wan/lmc/main.c | 31 ------------------------ drivers/net/wan/lmc/proto.c | 55 ++++++------------------------------------ drivers/net/wan/lmc/var.h | 1 - 3 files changed, 8 insertions(+), 79 deletions(-) diff --git a/drivers/net/wan/lmc/main.c b/drivers/net/wan/lmc/main.c index 63297a5..a6de32f 100644 --- a/drivers/net/wan/lmc/main.c +++ b/drivers/net/wan/lmc/main.c @@ -161,36 +161,6 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ret = 0; break; - case LMCIOCIFTYPE: - { - u16 old_type = sc->if_type; - u16 new_type; - - if (!capable(CAP_NET_ADMIN)) { - ret = -EPERM; - break; - } - - if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u16))) { - ret = -EFAULT; - break; - } - - if (new_type == old_type) { - ret = 0 ; - break; /* no change */ - } - - spin_lock_irqsave(&sc->lmc_lock, flags); - lmc_proto_close(sc); - - sc->if_type = new_type; - lmc_proto_attach(sc); - ret = lmc_proto_open(sc); - spin_unlock_irqrestore(&sc->lmc_lock, flags); - break; - } - case LMCIOCGETXINFO: spin_lock_irqsave(&sc->lmc_lock, flags); sc->lmc_xinfo.Magic0 = 0xBEEFCAFE; @@ -819,7 +789,6 @@ static int __devinit lmc_init_one(struct pci_dev *pdev, dev->tx_queue_len = 100; sc->lmc_device = dev; sc->name = dev->name; - sc->if_type = LMC_PPP; sc->check = 0xBEAFCAFE; dev->base_addr = pci_resource_start(pdev, 0); dev->irq = pdev->irq; diff --git a/drivers/net/wan/lmc/proto.c b/drivers/net/wan/lmc/proto.c index 547c8d8..ffd952a 100644 --- a/drivers/net/wan/lmc/proto.c +++ b/drivers/net/wan/lmc/proto.c @@ -49,22 +49,13 @@ void lmc_proto_attach(struct card *sc) { lmc_trace(sc->lmc_device, "lmc_proto_attach in"); - if (sc->if_type == LMC_NET) { - struct net_device *dev = sc->lmc_device; - /* They set a few basics because they don't use HDLC */ - dev->flags |= IFF_POINTOPOINT; - dev->hard_header_len = 0; - dev->addr_len = 0; - } lmc_trace(sc->lmc_device, "lmc_proto_attach out"); } int lmc_proto_ioctl(struct card *sc, struct ifreq *ifr, int cmd) { lmc_trace(sc->lmc_device, "lmc_proto_ioctl"); - if (sc->if_type == LMC_PPP) - return hdlc_ioctl(sc->lmc_device, ifr, cmd); - return -EOPNOTSUPP; + return hdlc_ioctl(sc->lmc_device, ifr, cmd); } int lmc_proto_open(struct card *sc) @@ -73,12 +64,10 @@ int lmc_proto_open(struct card *sc) lmc_trace(sc->lmc_device, "lmc_proto_open in"); - if (sc->if_type == LMC_PPP) { - ret = hdlc_open(sc->lmc_device); - if (ret < 0) - printk(KERN_WARNING "%s: HDLC open failed: %d\n", - sc->name, ret); - } + ret = hdlc_open(sc->lmc_device); + if (ret < 0) + printk(KERN_WARNING "%s: HDLC open failed: %d\n", + sc->name, ret); lmc_trace(sc->lmc_device, "lmc_proto_open out"); return ret; @@ -87,48 +76,20 @@ int lmc_proto_open(struct card *sc) void lmc_proto_close(struct card *sc) { lmc_trace(sc->lmc_device, "lmc_proto_close in"); - - if (sc->if_type == LMC_PPP) - hdlc_close(sc->lmc_device); - + hdlc_close(sc->lmc_device); lmc_trace(sc->lmc_device, "lmc_proto_close out"); } __be16 lmc_proto_type(struct card *sc, struct sk_buff *skb) { lmc_trace(sc->lmc_device, "lmc_proto_type in"); - switch (sc->if_type) { - case LMC_PPP: - return hdlc_type_trans(skb, sc->lmc_device); - break; - case LMC_NET: - return htons(ETH_P_802_2); - break; - case LMC_RAW: /* Packet type for skbuff kind of useless */ - return htons(ETH_P_802_2); - break; - default: - printk(KERN_WARNING - "%s: No protocol set for this interface, assuming 802.2 (which is wrong!!)\n", - sc->name); - return htons(ETH_P_802_2); - break; - } + return hdlc_type_trans(skb, sc->lmc_device); lmc_trace(sc->lmc_device, "lmc_proto_tye out"); - } void lmc_proto_netif(struct card *sc, struct sk_buff *skb) { lmc_trace(sc->lmc_device, "lmc_proto_netif in"); - switch (sc->if_type) { - case LMC_PPP: - case LMC_NET: - default: - netif_rx(skb); - break; - case LMC_RAW: - break; - } + netif_rx(skb); lmc_trace(sc->lmc_device, "lmc_proto_netif out"); } diff --git a/drivers/net/wan/lmc/var.h b/drivers/net/wan/lmc/var.h index e9aad37..b889bf6 100644 --- a/drivers/net/wan/lmc/var.h +++ b/drivers/net/wan/lmc/var.h @@ -321,7 +321,6 @@ struct card { u32 num_int; spinlock_t lmc_lock; - u16 if_type; /* HDLC/PPP or NET */ u8 failed_ring; /* Failure cases */ u8 failed_recv_alloc;