[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <81d6e283-fd87-4fd6-964f-22cbf420cdaa@kadam.mountain>
Date: Thu, 12 Oct 2023 09:33:07 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Soumya Negi <soumya.negi97@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Micky Ching <micky_ching@...lsil.com.cn>,
outreachy@...ts.linux.dev, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rts5208: Parenthesize macro arguments
On Wed, Oct 11, 2023 at 10:02:40PM -0700, Soumya Negi wrote:
> Use parenthesis with macro arguments to avoid possible precedence
> issues. Found by checkpatch.pl
>
> Signed-off-by: Soumya Negi <soumya.negi97@...il.com>
> ---
> 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..1cc05956ab6d 100644
> --- a/drivers/staging/rts5208/rtsx.h
> +++ b/drivers/staging/rts5208/rtsx.h
> @@ -40,17 +40,17 @@
> * macros for easy use
> */
> #define rtsx_writel(chip, reg, value) \
> - iowrite32(value, (chip)->rtsx->remap_addr + reg)
> + iowrite32(value, (chip)->rtsx->remap_addr + (reg))
These would be better as functions instead of defines.
> #define rtsx_readl(chip, reg) \
> - ioread32((chip)->rtsx->remap_addr + reg)
> + ioread32((chip)->rtsx->remap_addr + (reg))
> #define rtsx_writew(chip, reg, value) \
> - iowrite16(value, (chip)->rtsx->remap_addr + reg)
> + iowrite16(value, (chip)->rtsx->remap_addr + (reg))
> #define rtsx_readw(chip, reg) \
> - ioread16((chip)->rtsx->remap_addr + reg)
> + ioread16((chip)->rtsx->remap_addr + (reg))
> #define rtsx_writeb(chip, reg, value) \
> - iowrite8(value, (chip)->rtsx->remap_addr + reg)
> + iowrite8(value, (chip)->rtsx->remap_addr + (reg))
> #define rtsx_readb(chip, reg) \
> - ioread8((chip)->rtsx->remap_addr + reg)
> + ioread8((chip)->rtsx->remap_addr + (reg))
>
> #define rtsx_read_config_byte(chip, where, val) \
> pci_read_config_byte((chip)->rtsx->pci, 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)
For these ones, the name is too generic. probably the right thing is
to just get rid of them completely and call spin_lock/unlock_irq()
directly.
regards,
dan carpenter
Powered by blists - more mailing lists