From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE57DC010A2 for ; Tue, 5 Nov 2019 11:10:32 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1C6B21929 for ; Tue, 5 Nov 2019 11:10:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fQwTMSPf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1C6B21929 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 93AE6892FB; Tue, 5 Nov 2019 11:10:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TOgfdFBFk80e; Tue, 5 Nov 2019 11:10:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 03F98892B4; Tue, 5 Nov 2019 11:10:32 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 819D01BF574 for ; Tue, 5 Nov 2019 11:10:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7716C8A669 for ; Tue, 5 Nov 2019 11:10:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tlXjQERtmJhR for ; Tue, 5 Nov 2019 11:10:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id 8EA318A623 for ; Tue, 5 Nov 2019 11:10:30 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id q70so20380959wme.1 for ; Tue, 05 Nov 2019 03:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=y2qxlg9/WxYNrodQutppo1itEPPVt4haSvgHKc6Nv0U=; b=fQwTMSPfRFIr9Xsxooeb+ZdrmMotEymjjH3x72bOkSt6I5ppLg3TGDl6JXUCh79wZY nwh/hKrc9OI6tvuJ3Il5RdP4wXlfboHsTUlrqY+mzOEuVxVneFmlh4SUGwJe+KaZDMNB rJdSD17SV2fe77NLKdviMNLnHXDZlJX4ZUMOiKT8zQKBkNvomvt9TNizP4d3BLe2tRVI LL147AeUfVtjMz8qzIHGvcYoTWtIY6NptFe0e9xVWgwJJ198Dum5OrMRu/pMFflk1Gc5 yA3SRUMgnJkIUX4pxomzJf/l5e7jgD3QWhfXtLQjHnD4vzPwScNRBHkdfcc1r/GyZzfZ P12A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=y2qxlg9/WxYNrodQutppo1itEPPVt4haSvgHKc6Nv0U=; b=o8GvPw39Zb6mBreBcPXJrhvDwZ4ayVdwk1Lk1ZG03Vl4LQozzdHr2t79G8rsqQHK0d mAaUgnhqSfiMxg/GgVORwFqii/XPpjuPqqd1IAbuHst3M/0mVHwb1ppAPROMFyne7Uza U/sEAgB+J3XcouTBrXaCCMXlgxu6JHniaCVSxFqjIEoWZVR12KoVG9llIBQ6BKe/YUye kuVsXDk8Wmy0bzLSCt1ZTLCv1FLFzY/TpX3XhGkbZrLTWf7p3gaOiLbP3SKPGSjnBrBF GIShLsYdS1k9nOfQVpEawITlJMaNTGWlP3P4TDDqVfHmnHzEUoA8YEFONj5yVUEmgCyc XHsg== X-Gm-Message-State: APjAAAUdOWD74nz9WBlHk64lPJrCxQrpjkdH1iHz7bSAWXDRCHFQkYHM K0cWpj3RysK68UIF0J3pXg== X-Google-Smtp-Source: APXvYqyvvSKLAZakm9eFYTOjJ3YOmB1B6VsR9rqH+5wCmZ7zKBaZ55nBL4aPq0HmDNVMb8XotKN8LQ== X-Received: by 2002:a05:600c:c5:: with SMTP id u5mr3526268wmm.35.1572952228869; Tue, 05 Nov 2019 03:10:28 -0800 (PST) Received: from ninjahub.lan (79-73-36-243.dynamic.dsl.as9105.com. [79.73.36.243]) by smtp.gmail.com with ESMTPSA id y67sm1366175wmb.38.2019.11.05.03.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 03:10:28 -0800 (PST) From: Jules Irenge X-Google-Original-From: Jules Irenge Date: Tue, 5 Nov 2019 11:09:44 +0000 (GMT) To: Greg KH Subject: Re: [PATCH] staging: rts5208: rewrite macro with GNU extension __auto_type In-Reply-To: <20191104165148.GA2293059@kroah.com> Message-ID: References: <20191104164400.9935-1-jbi.octave@gmail.com> <20191104165148.GA2293059@kroah.com> MIME-Version: 1.0 X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, outreachy-kernel@googlegroups.com, Jules Irenge , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Mon, 4 Nov 2019, Greg KH wrote: > On Mon, Nov 04, 2019 at 04:44:00PM +0000, Jules Irenge wrote: > > Rewrite macro function with GNU extension __auto_type > > to remove issue detected by checkpatch tool. > > CHECK: MACRO argument reuse - possible side-effects? > > > > Signed-off-by: Jules Irenge > > --- > > drivers/staging/rts5208/rtsx_chip.h | 92 +++++++++++++++++------------ > > 1 file changed, 55 insertions(+), 37 deletions(-) > > > > diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h > > index bac65784d4a1..4b986d5c68da 100644 > > --- a/drivers/staging/rts5208/rtsx_chip.h > > +++ b/drivers/staging/rts5208/rtsx_chip.h > > @@ -386,23 +386,31 @@ struct zone_entry { > > > > /* SD card */ > > #define CHK_SD(sd_card) (((sd_card)->sd_type & 0xFF) == TYPE_SD) > > -#define CHK_SD_HS(sd_card) (CHK_SD(sd_card) && \ > > - ((sd_card)->sd_type & SD_HS)) > > -#define CHK_SD_SDR50(sd_card) (CHK_SD(sd_card) && \ > > - ((sd_card)->sd_type & SD_SDR50)) > > -#define CHK_SD_DDR50(sd_card) (CHK_SD(sd_card) && \ > > - ((sd_card)->sd_type & SD_DDR50)) > > -#define CHK_SD_SDR104(sd_card) (CHK_SD(sd_card) && \ > > - ((sd_card)->sd_type & SD_SDR104)) > > -#define CHK_SD_HCXC(sd_card) (CHK_SD(sd_card) && \ > > - ((sd_card)->sd_type & SD_HCXC)) > > -#define CHK_SD_HC(sd_card) (CHK_SD_HCXC(sd_card) && \ > > - ((sd_card)->capacity <= 0x4000000)) > > -#define CHK_SD_XC(sd_card) (CHK_SD_HCXC(sd_card) && \ > > - ((sd_card)->capacity > 0x4000000)) > > -#define CHK_SD30_SPEED(sd_card) (CHK_SD_SDR50(sd_card) || \ > > - CHK_SD_DDR50(sd_card) || \ > > - CHK_SD_SDR104(sd_card)) > > +#define CHK_SD_HS(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD(_sd) && \ > > + (_sd->sd_type & SD_HS); }) > > +#define CHK_SD_SDR50(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD(_sd) && \ > > + (_sd->sd_type & SD_SDR50); }) > > +#define CHK_SD_DDR50(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD(_sd) && \ > > + (_sd->sd_type & SD_DDR50); }) > > +#define CHK_SD_SDR104(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD(_sd) && \ > > + (_sd->sd_type & SD_SDR104); }) > > +#define CHK_SD_HCXC(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD(_sd) && \ > > + (_sd->sd_type & SD_HCXC); }) > > +#define CHK_SD_HC(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD_HCXC(_sd) && \ > > + (_sd->capacity <= 0x4000000); }) > > +#define CHK_SD_XC(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD_HCXC(_sd) && \ > > + (_sd->capacity > 0x4000000); }) > > +#define CHK_SD30_SPEED(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD_SDR50(_sd) || \ > > + CHK_SD_DDR50(_sd) || \ > > + CHK_SD_SDR104(_sd); }) > > > > #define SET_SD(sd_card) ((sd_card)->sd_type = TYPE_SD) > > #define SET_SD_HS(sd_card) ((sd_card)->sd_type |= SD_HS) > > @@ -420,18 +428,24 @@ struct zone_entry { > > /* MMC card */ > > #define CHK_MMC(sd_card) (((sd_card)->sd_type & 0xFF) == \ > > TYPE_MMC) > > -#define CHK_MMC_26M(sd_card) (CHK_MMC(sd_card) && \ > > - ((sd_card)->sd_type & MMC_26M)) > > -#define CHK_MMC_52M(sd_card) (CHK_MMC(sd_card) && \ > > - ((sd_card)->sd_type & MMC_52M)) > > -#define CHK_MMC_4BIT(sd_card) (CHK_MMC(sd_card) && \ > > - ((sd_card)->sd_type & MMC_4BIT)) > > -#define CHK_MMC_8BIT(sd_card) (CHK_MMC(sd_card) && \ > > - ((sd_card)->sd_type & MMC_8BIT)) > > -#define CHK_MMC_SECTOR_MODE(sd_card) (CHK_MMC(sd_card) && \ > > - ((sd_card)->sd_type & MMC_SECTOR_MODE)) > > -#define CHK_MMC_DDR52(sd_card) (CHK_MMC(sd_card) && \ > > - ((sd_card)->sd_type & MMC_DDR52)) > > +#define CHK_MMC_26M(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_MMC(_sd) && \ > > + (_sd->sd_type & MMC_26M); }) > > Ick, no. These are obviously pointers, which can not be "evaluated > twice" so this whole thing is just fine. > > checkpatch is just a "hint" that you might want to look at the code. > This stuff is just fine, look at how it is being used for proof of that. > > thanks, > > greg k-h > Thanks for the feedback. It's good to know. I really appreciate. Kind regards, Jules _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel