From patchwork Mon Feb 8 20:12:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 44832 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 621D1B7D01 for ; Tue, 9 Feb 2010 07:17:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755273Ab0BHUQn (ORCPT ); Mon, 8 Feb 2010 15:16:43 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:53840 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754923Ab0BHUNK (ORCPT ); Mon, 8 Feb 2010 15:13:10 -0500 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate03.web.de (Postfix) with ESMTP id 0AF6913D50075; Mon, 8 Feb 2010 21:13:10 +0100 (CET) Received: from [88.65.45.120] (helo=localhost.localdomain) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #314) id 1NeZyn-0006fo-02; Mon, 08 Feb 2010 21:13:09 +0100 From: Jan Kiszka To: David Miller , Karsten Keil Cc: linux-kernel@vger.kernel.org, i4ldeveloper@listserv.isdn4linux.de, isdn4linux@listserv.isdn4linux.de, netdev@vger.kernel.org, Alan Cox , Marcel Holtmann Subject: [PATCH v2 26/41] CAPI: Drop remaining NULL checks on tty->driver_data Date: Mon, 8 Feb 2010 21:12:30 +0100 Message-Id: <8e192d49420287aef66facf77b454a9bc8c799de.1265659936.git.jan.kiszka@web.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX18B4bI7AJV9bIeJ4JJbQ6GUo6/D4sx92uC3hR9c HRMEFiKJM2u6Tv+YC8WaeeyoVgF7+Yg5WQBHsI39GP54rKy9VP LZVjPtQhE= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tty_struct's driver_data cannot be NULL, no need to test for it. Signed-off-by: Jan Kiszka --- drivers/isdn/capi/capi.c | 64 ++++++++++++++++++++++----------------------- 1 files changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index e164a8f..acc811b 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1097,7 +1097,7 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp) static int capinc_tty_write(struct tty_struct * tty, const unsigned char *buf, int count) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; struct sk_buff *skb; unsigned long flags; @@ -1105,7 +1105,7 @@ static int capinc_tty_write(struct tty_struct * tty, printk(KERN_DEBUG "capinc_tty_write(count=%d)\n", count); #endif - if (!mp || !mp->nccip) { + if (!mp->nccip) { #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_write: mp or mp->ncci NULL\n"); #endif @@ -1140,7 +1140,7 @@ static int capinc_tty_write(struct tty_struct * tty, static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; struct sk_buff *skb; unsigned long flags; int ret = 1; @@ -1149,7 +1149,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) printk(KERN_DEBUG "capinc_put_char(%u)\n", ch); #endif - if (!mp || !mp->nccip) { + if (!mp->nccip) { #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_put_char: mp or mp->ncci NULL\n"); #endif @@ -1184,7 +1184,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) static void capinc_tty_flush_chars(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; struct sk_buff *skb; unsigned long flags; @@ -1192,7 +1192,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) printk(KERN_DEBUG "capinc_tty_flush_chars\n"); #endif - if (!mp || !mp->nccip) { + if (!mp->nccip) { #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_flush_chars: mp or mp->ncci NULL\n"); #endif @@ -1213,9 +1213,10 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) static int capinc_tty_write_room(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; int room; - if (!mp || !mp->nccip) { + + if (!mp->nccip) { #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_write_room: mp or mp->ncci NULL\n"); #endif @@ -1231,8 +1232,9 @@ static int capinc_tty_write_room(struct tty_struct *tty) static int capinc_tty_chars_in_buffer(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - if (!mp || !mp->nccip) { + struct capiminor *mp = tty->driver_data; + + if (!mp->nccip) { #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_chars_in_buffer: mp or mp->ncci NULL\n"); #endif @@ -1266,55 +1268,51 @@ static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old #endif } -static void capinc_tty_throttle(struct tty_struct * tty) +static void capinc_tty_throttle(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_throttle\n"); #endif - if (mp) - mp->ttyinstop = 1; + mp->ttyinstop = 1; } -static void capinc_tty_unthrottle(struct tty_struct * tty) +static void capinc_tty_unthrottle(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; unsigned long flags; + #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_unthrottle\n"); #endif - if (mp) { - spin_lock_irqsave(&workaround_lock, flags); - mp->ttyinstop = 0; - handle_minor_recv(mp); - spin_unlock_irqrestore(&workaround_lock, flags); - } + spin_lock_irqsave(&workaround_lock, flags); + mp->ttyinstop = 0; + handle_minor_recv(mp); + spin_unlock_irqrestore(&workaround_lock, flags); } static void capinc_tty_stop(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; + #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_stop\n"); #endif - if (mp) { - mp->ttyoutstop = 1; - } + mp->ttyoutstop = 1; } static void capinc_tty_start(struct tty_struct *tty) { - struct capiminor *mp = (struct capiminor *)tty->driver_data; + struct capiminor *mp = tty->driver_data; unsigned long flags; + #ifdef _DEBUG_TTYFUNCS printk(KERN_DEBUG "capinc_tty_start\n"); #endif - if (mp) { - spin_lock_irqsave(&workaround_lock, flags); - mp->ttyoutstop = 0; - (void)handle_minor_send(mp); - spin_unlock_irqrestore(&workaround_lock, flags); - } + spin_lock_irqsave(&workaround_lock, flags); + mp->ttyoutstop = 0; + (void)handle_minor_send(mp); + spin_unlock_irqrestore(&workaround_lock, flags); } static void capinc_tty_hangup(struct tty_struct *tty)