From patchwork Wed Aug 6 18:53:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wood X-Patchwork-Id: 4688081 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 351E2C0338 for ; Wed, 6 Aug 2014 18:53:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58F3A2015A for ; Wed, 6 Aug 2014 18:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6440F20117 for ; Wed, 6 Aug 2014 18:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755703AbaHFSxn (ORCPT ); Wed, 6 Aug 2014 14:53:43 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:54251 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755587AbaHFSxm (ORCPT ); Wed, 6 Aug 2014 14:53:42 -0400 Received: by mail-ob0-f174.google.com with SMTP id vb8so2139099obc.5 for ; Wed, 06 Aug 2014 11:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=hLq4l9zV3zDceI/jRyD2uptGLX1wB73UIsdydB3w4DU=; b=xPOZ7vQOGxNqQ/JNjhrqY7tC4Hr6iFFYmMHX1rimpT2u/bMhwRzwhjLZgiM84ZSOX5 Yg6owmR0On3ALbJLZxB8aZ9O9ZmYu58vioSH4pUstnvFZgx88QOaoWiVq2risXG/DuU5 Rboawl+4egdcNxaBVKoKwzMZlb6giM3T3BDNaj+nvHlu1Fcp/sw/iS1/AsglcWd1HFie kDsIPfcqhnhUb88Ws2WHcRrwdi26KLNXmZ3fr4Pt+OYaurNRpnAPo9M2hZa0md5/F6lM IH94/KBuNAOyCs1ez2vfUSA31nTlhIEsEGB3anJr7wWOa9IQ1j1uTd3AVNLG2keD165Z RO1w== MIME-Version: 1.0 X-Received: by 10.60.77.68 with SMTP id q4mr17613273oew.1.1407351221714; Wed, 06 Aug 2014 11:53:41 -0700 (PDT) Received: by 10.76.131.79 with HTTP; Wed, 6 Aug 2014 11:53:41 -0700 (PDT) Date: Wed, 6 Aug 2014 20:53:41 +0200 X-Google-Sender-Auth: yP9wDgTYDrW2L70JZyXDO5VnMiI Message-ID: Subject: Re: [PATCH] spi: Fix warning about redefinition From: David Wood To: Guenter Roeck Cc: Nick Krause , Mark Brown , "open list:SPI SUBSYSTEM" , open list , Richard Weinberger Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 Wed, 6 Aug 2014 11:33:28 -0700, Guenter Roeck wrote: > On Wed, Aug 06, 2014 at 07:19:54PM +0200, Richard Weinberger wrote: > > On Wed, Aug 6, 2014 at 6:55 PM, Nick Krause wrote: > > > Fix the following warnings about redefining READ and write > > > > > > drivers/spi/spi-omap-100k.c:73:0: warning: "WRITE" redefined [enabled by default] > > > include/linux/fs.h:193:0: note: this is the location of the previous definition > > > drivers/spi/spi-omap-100k.c:74:0: warning: "READ" redefined [enabled by default] > > > include/linux/fs.h:192:0: note: this is the location of the previous definition > > > > > > Signed-off-by: Nick Krause > > > --- > > > drivers/spi/spi-omap-100k.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c > > > index 5e91858..eb8ae4e 100644 > > > --- a/drivers/spi/spi-omap-100k.c > > > +++ b/drivers/spi/spi-omap-100k.c > > > @@ -70,6 +70,12 @@ > > > #define SPI_STATUS_WE (1UL << 1) > > > #define SPI_STATUS_RD (1UL << 0) > > > > > > +#ifdef WRITE > > > +#undef WRITE > > > +#endif > > > +#ifdef READ > > > +#undef READ > > > +#endif > > > #define WRITE 0 > > > #define READ 1 > > > > Are these symbols even in use? > > > > It is always fun watching those patches flow by :-) > With the following patch: > diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c > index 5e91858..f72ddfc 100644 > --- a/drivers/spi/spi-omap-100k.c > +++ b/drivers/spi/spi-omap-100k.c > @@ -70,8 +70,8 @@ > #define SPI_STATUS_WE (1UL << 1) > #define SPI_STATUS_RD (1UL << 0) > -#define WRITE 0 > -#define READ 1 > +#undef WRITE > +#undef READ > [ just to make sure that no existing defines are used instead of the new ones ] > When compiling the resulting code with W=1, I get: > drivers/spi/spi-omap-100k.c: In function 'spi100k_read_data': > drivers/spi/spi-omap-100k.c:148:6: warning: variable 'dataH' set but not used > [-Wunused-but-set-variable] > So, one might conclude that the defines are not used. > Guenter There's also no need to have the undefines, as the READ is defined as 0 in linux/fs.h, and WRITE as 1 (WRITE = RW_MASK = REQ_WRITE = 1ULL << __REQ_WRITE, with __REQ_WRITE being defined in enum rq_flag_bits { __REQ_WRITE = 0; };), so even if it did try to use those definitions, it wouldn't then matter. Unfortunately, neither the linux source code, nor the linwizard source (from which this file was copied) show how the defines got there, they appear to have been in the code ever since Nokia originally wrote the file in 2005. So the following should be sufficient: --- To unsubscribe from this list: send the line "unsubscribe linux-spi" 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/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 5e91858..1dbb706 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -70,9 +70,6 @@ #define SPI_STATUS_WE (1UL << 1) #define SPI_STATUS_RD (1UL << 0) -#define WRITE 0 -#define READ 1 - /* use PIO for small transfers, avoiding DMA setup/teardown overhead and * cache operations; better heuristics consider wordsize and bitrate.