From patchwork Thu Jul 30 11:56:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 6902061 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00AF59F358 for ; Thu, 30 Jul 2015 11:57:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C0222054D for ; Thu, 30 Jul 2015 11:57:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 103752054C for ; Thu, 30 Jul 2015 11:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751295AbbG3L5D (ORCPT ); Thu, 30 Jul 2015 07:57:03 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34910 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbbG3L5B (ORCPT ); Thu, 30 Jul 2015 07:57:01 -0400 Received: by pabkd10 with SMTP id kd10so22543841pab.2 for ; Thu, 30 Jul 2015 04:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=MFmAClNnZVTo7Amloaznc2J7JIpNewrR4LinXeVMAJ8=; b=zyxfDM7TpI6y7VhIZVXisBVFu2mnfMiahkNbIe/Oc4X9PokAO4jwKgTb6ITiFi061f W+YvJmKi1apVX7RuKGTCFj4sWW2mQ+cQSoXe5AuMa+ETZO39sslVvo+REJhi1pbI8zPJ Ns8UlYQ7yfwcY/kcPQjJJAPv1K/mmB35dYkKX/Xj6RF1CExCfAbEsUmdxnMFDiHWQY1x uEPCFyTd4Lm9eflKUUSZFODlKFFoE6404HXzmUatUulhfZbysPbRAlo/lYKltGPFdSoL bCGpWWYKI1ZXaVEy+4t8vckVAOLXubw05cxOZLDFsm92k2YujppIqU1wSZYVNpEa517q 3KtA== X-Received: by 10.66.55.66 with SMTP id q2mr105069508pap.94.1438257421324; Thu, 30 Jul 2015 04:57:01 -0700 (PDT) Received: from sudip-pc ([49.206.240.169]) by smtp.gmail.com with ESMTPSA id si3sm1901012pac.5.2015.07.30.04.56.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 Jul 2015 04:57:00 -0700 (PDT) Date: Thu, 30 Jul 2015 17:26:48 +0530 From: Sudip Mukherjee To: Tony Cho Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, rachel.kim@atmel.com, chris.park@atmel.com, austin.shin@atmel.com, linux-wireless@vger.kernel.org, johnny.kim@atmel.com, Nicolas.FERRE@atmel.com, robin.hwang@atmel.com, jude.lee@atmel.com, leo.kim@atmel.com Subject: Re: [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions Message-ID: <20150730115647.GA12823@sudip-pc> References: <1438247414-19708-1-git-send-email-tony.cho@atmel.com> <1438247414-19708-2-git-send-email-tony.cho@atmel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1438247414-19708-2-git-send-email-tony.cho@atmel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jul 30, 2015 at 06:10:10PM +0900, Tony Cho wrote: > This patch lets preprocessor conditionals (#ifdef) related to > WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out > the entire functions is preferred rather than portions of functions or > expressions becausue doing so makes code harder to read. > > Signed-off-by: Tony Cho > --- > > +#ifdef WILC_SDIO_IRQ_GPIO > static int sdio_clear_int(void) > { > -#ifndef WILC_SDIO_IRQ_GPIO > - /* uint32_t sts; */ > - sdio_cmd52_t cmd; > - > - cmd.read_write = 0; > - cmd.function = 1; > - cmd.raw = 0; > - cmd.address = 0x4; > - cmd.data = 0; > - g_sdio.sdio_cmd52(&cmd); > - int_clrd++; > - > - return cmd.data; > -#else > uint32_t reg; > > if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { > @@ -181,9 +168,23 @@ static int sdio_clear_int(void) > sdio_write_reg(WILC_HOST_RX_CTRL_0, reg); > int_clrd++; > return 1; > -#endif > +} > +#else > +static int sdio_clear_int(void) > +{ > + sdio_cmd52_t cmd; > + > + cmd.read_write = 0; > + cmd.function = 1; > + cmd.raw = 0; > + cmd.address = 0x4; > + cmd.data = 0; > + g_sdio.sdio_cmd52(&cmd); > + int_clrd++; > > + return cmd.data; > } > +#endif /* WILC_SDIO_IRQ_GPIO */ instead of changing #ifndef to #ifdef i think the following would have been easier: > > uint32_t sdio_xfer_cnt(void) > +#ifdef WILC_SDIO_IRQ_GPIO > static int sdio_clear_int_ext(uint32_t val) > { > int ret; > > - if (g_sdio.has_thrpt_enh3) { > + if(g_sdio.has_thrpt_enh3) { why changing this? The original style is according to the kernel coding style. regards sudip --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 5a18148..5cd4d45 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -155,9 +155,9 @@ _fail_: return 0; } +#ifndef WILC_SDIO_IRQ_GPIO static int sdio_clear_int(void) { -#ifndef WILC_SDIO_IRQ_GPIO /* uint32_t sts; */ sdio_cmd52_t cmd; @@ -170,7 +170,10 @@ static int sdio_clear_int(void) int_clrd++; return cmd.data; +} #else +static int sdio_clear_int(void) +{ uint32_t reg; if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { @@ -181,9 +184,8 @@ static int sdio_clear_int(void) sdio_write_reg(WILC_HOST_RX_CTRL_0, reg); int_clrd++; return 1; -#endif - } +#endif uint32_t sdio_xfer_cnt(void) {