Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754364AbbDTHb7 (ORCPT ); Mon, 20 Apr 2015 03:31:59 -0400 Received: from blu004-omc1s11.hotmail.com ([65.55.116.22]:52526 "EHLO BLU004-OMC1S11.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752013AbbDTHb6 (ORCPT ); Mon, 20 Apr 2015 03:31:58 -0400 X-TMN: [laePCMINnibUBgzl/wg4kuznG9PKFJAo] X-Originating-Email: [yorick-rommers@hotmail.com] Message-ID: From: Yorick Rommers To: joe@perches.com CC: lidza.louina@gmail.com, markh@compro.net, gregkh@linuxfoundation.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Yorick Rommers Subject: [PATCH] Staging: dgnc: Using a temporary value for repeated dereferences. Date: Mon, 20 Apr 2015 09:33:04 +0200 X-Mailer: git-send-email 2.3.5 In-Reply-To: <1429491259.27863.1.camel@perches.com> References: <1429491259.27863.1.camel@perches.com> X-OriginalArrivalTime: 20 Apr 2015 07:31:55.0883 (UTC) FILETIME=[1413A3B0:01D07B3C] MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2185 Lines: 64 Sorry, it has been changed in the patch below. --------------------------------------- A patch for a line being too long (>80) in dgnc_mgmt.c, fixed by making a temporary value for dgnc_Board[brd], replacing all instanced of dgnc_Board[brd] with temporary value, and removing unnecessary typecasts. Signed-off-by: Yorick Rommers --- drivers/staging/dgnc/dgnc_mgmt.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index b13318a..ac2581a 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -131,6 +131,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) int brd; struct digi_info di; + struct dgnc_board *bd; if (copy_from_user(&brd, uarg, sizeof(int))) return -EFAULT; @@ -142,19 +143,21 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) di.info_bdnum = brd; - spin_lock_irqsave(&dgnc_Board[brd]->bd_lock, flags); + bd = dgnc_Board[brd]; - di.info_bdtype = dgnc_Board[brd]->dpatype; - di.info_bdstate = dgnc_Board[brd]->dpastatus; + spin_lock_irqsave(&bd->bd_lock, flags); + + di.info_bdtype = bd->dpatype; + di.info_bdstate = bd->dpastatus; di.info_ioport = 0; - di.info_physaddr = (ulong) dgnc_Board[brd]->membase; - di.info_physsize = (ulong) dgnc_Board[brd]->membase - dgnc_Board[brd]->membase_end; - if (dgnc_Board[brd]->state != BOARD_FAILED) - di.info_nports = dgnc_Board[brd]->nasync; + di.info_physaddr = bd->membase; + di.info_physsize = bd->membase - bd->membase_end; + if (bd->state != BOARD_FAILED) + di.info_nports = bd->nasync; else di.info_nports = 0; - spin_unlock_irqrestore(&dgnc_Board[brd]->bd_lock, flags); + spin_unlock_irqrestore(&bd->bd_lock, flags); if (copy_to_user(uarg, &di, sizeof(di))) return -EFAULT; -- 2.3.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/