Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp852181rdb; Fri, 20 Oct 2023 00:49:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEL3wAh0DZEYQ3a/HfAiA4844akdW08DeijP9XE5O/t+x3PmvlFx9vKE+ARaFjuhu34SNMm X-Received: by 2002:a17:90a:4d:b0:27d:76e2:ab18 with SMTP id 13-20020a17090a004d00b0027d76e2ab18mr1260991pjb.9.1697788143543; Fri, 20 Oct 2023 00:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697788143; cv=none; d=google.com; s=arc-20160816; b=KqXP7qom+EheJdXST57MWca5eTUPu+pvCLL5B7dbndB6+5+3/ge/4SqTuueVDHap/l ePwx+eapHEQ8l6xYMW2MxzxJRsD7gEBk6Irz7HkfSc8qDH3LwG0C+3kj+v9/oxTLd8DY f4DozrKKY9E2QknEQtc1xQ/NCz1jnCs1GQT1MZR8KyE2+l3Tk3to3RO9DbDnn4FREK32 ThVOYppm2ivfXKiEzFElaXv3xR8bqhFVPT2yFpoGyQZIK/leqUSwptn+7iVPTBsHRMLg JMhNT6Hrw/Ot4levtQ9GeNMrSKzT880VLkvRyLyapsQXINwGyO9ZPXD8/NX318r5C4pl ir5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=IaUvHvf8Dgzxm7NYbMB7ToEmLLG4rPc01nfYboIRTVM=; fh=WC5jRnYBaa6evVRIIekPnfpNIOYLRM4cJ+jWDkpvy6c=; b=VV7jboGRZ5nQqSxPJJJ15rFScmLE5d9rtgiAha0/XvHenMPEoax+u90c+dgiCrA+9f wHeegUeT2PNeJt/2+UG0RF+lDYezYNJ2ZevobnL1LIpi/7ByjYJ6DqnrTAOkixsarLWh wdYs8zvACXIFh0c9IQ2XtS6kYCqvNlskASr7yMB2hmpxcCVt1AuT44pdlIgJTESOf7B0 naS+VlC2SmFss7fZt8hsKFPJEqDLLioV9dSBOy63jNwiayCRKgZJuyfm87bNRO2D7Ox8 JCO99gEE6ZXfpGqbGVTQUJitBFmVXLiXeyRzp3lchPPPMv7fq1v4oLvXqigjpEZcE400 7ieQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=hpx2qlYp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id sc5-20020a17090b510500b0027d22ad8127si407812pjb.0.2023.10.20.00.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=hpx2qlYp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0BE1381EB9E8; Fri, 20 Oct 2023 00:49:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376440AbjJTHsp (ORCPT + 99 others); Fri, 20 Oct 2023 03:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235636AbjJTHsl (ORCPT ); Fri, 20 Oct 2023 03:48:41 -0400 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0215EE8 for ; Fri, 20 Oct 2023 00:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=IaUvHvf8Dgzxm7NYbMB7ToEmLLG4rPc01nfYboIRTVM=; b=hpx2qlYp2mxSWdOkDwoENgxhYKBtvWsc/CHLQzj3bi3a+lsqERaUr7QO 9nu4FRCWcwcs8jvyPTdDFGCgkoh10r3M2xFlv/ZxT/SCcxNvB9MGBqYkK pirRrb8n4dzthvnF9N6xio06F2PQSUrD7SlXnJ0iuVZj2osq6A5K8jwMH Q=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.03,238,1694728800"; d="scan'208";a="132264898" Received: from dhcp-138-246-3-50.dynamic.eduroam.mwn.de (HELO hadrien) ([138.246.3.50]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 09:48:36 +0200 Date: Fri, 20 Oct 2023 09:48:35 +0200 (CEST) From: Julia Lawall To: kenechukwu maduechesi cc: shreeya.patel23498@gmail.com, outreachy@lists.linux.dev, Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rts5208: Add parenthesis to macro arguments In-Reply-To: <20231020065439.GA3579@ubuntu> Message-ID: References: <20231020065439.GA3579@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 20 Oct 2023 00:49:01 -0700 (PDT) On Thu, 19 Oct 2023, kenechukwu maduechesi wrote: > Checkpatch suggests using (reg) and (host) instead of reg and host > > The use of parenthesis in the macro argument '(reg)' ensures proper > precedence and resolves potential issues that may arise due to the > surrounding code context. This modification adheres to the recommended > coding style and improves the readability or maintainability of the > code. > > Signed-off-by: kenechukwu maduechesi > --- > drivers/staging/rts5208/rtsx.h | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h > index 2e101da83220..7d3373797eb4 100644 > --- a/drivers/staging/rts5208/rtsx.h > +++ b/drivers/staging/rts5208/rtsx.h > @@ -39,17 +39,17 @@ > /* > * macros for easy use > */ > -#define rtsx_writel(chip, reg, value) \ > +#define rtsx_writel(chip, (reg), value) \ > iowrite32(value, (chip)->rtsx->remap_addr + reg) I don't think this code has been subjected to the compiler. Note that you can't comiple a .h file directly; you have to find some other file that includes it. It may be useful to run make path/to/cfile.i (for some cfile.c) to see if the specific code you changed it included in the configuration or is discarded by the preprocessor. In any case, you have put () in the argument list of a macro, for reg, which is not correct. The parentheses for chip are ok. > -#define rtsx_readl(chip, reg) \ > +#define rtsx_readl(chip, (reg) \ Here you have broken the argument list of the macro completely, because the parentheses are not balanced. > ioread32((chip)->rtsx->remap_addr + reg) > -#define rtsx_writew(chip, reg, value) \ > +#define rtsx_writew(chip, (reg), value) \ > iowrite16(value, (chip)->rtsx->remap_addr + reg) > -#define rtsx_readw(chip, reg) \ > +#define rtsx_readw(chip, (reg)) \ > ioread16((chip)->rtsx->remap_addr + reg) > -#define rtsx_writeb(chip, reg, value) \ > +#define rtsx_writeb(chip, (reg), value) \ > iowrite8(value, (chip)->rtsx->remap_addr + reg) > -#define rtsx_readb(chip, reg) \ > +#define rtsx_readb(chip, (reg)) \ > ioread8((chip)->rtsx->remap_addr + reg) > > #define rtsx_read_config_byte(chip, where, val) \ > @@ -131,8 +131,8 @@ static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host) > * The scsi_lock() and scsi_unlock() macros protect the sm_state and the > * single queue element srb for write access > */ > -#define scsi_unlock(host) spin_unlock_irq(host->host_lock) > -#define scsi_lock(host) spin_lock_irq(host->host_lock) > +#define scsi_unlock(host) spin_unlock_irq((host)->host_lock) > +#define scsi_lock(host) spin_lock_irq((host)->host_lock) I also wonder if someone has worked on this code already? There was a suggestion to just drop these macros and use the standard kernel functions. Maybe your kernel tree is not up to date. julia > #define lock_state(chip) spin_lock_irq(&((chip)->rtsx->reg_lock)) > #define unlock_state(chip) spin_unlock_irq(&((chip)->rtsx->reg_lock)) > -- > 2.25.1 > > >