Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2982463pxf; Sun, 28 Mar 2021 07:56:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXo4Uv3sQqhpWAQitlmz/ZQfMy+b7HMK4Urnd+twacK3vKzPfp1aE/XrM49S8d4/A/D9Wk X-Received: by 2002:aa7:c654:: with SMTP id z20mr24509987edr.377.1616943360742; Sun, 28 Mar 2021 07:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616943360; cv=none; d=google.com; s=arc-20160816; b=g96qaE016WcjeOZPsFEoa86auUQvVmljnfzKXkILmSKY2TQ9J9vOb0plnebUyldlh6 q70r/TCYwBuP2sOmk5raa5DC/7ufMfMtKRR4MNipAmipTuWYEo0s8ywflV+KKGyuVqkY BxugzXY5WyG/4foJmH9zHVt4uWUdRAy+Qf8L+cX9PtBFFfTpXPxdj2dXltPH6hodggVF 2b5MyqG1H0jKKrRxHuGNehHFRI+mjq+xdzxOl5GSr89pnWVyDviAOalRrg3hAG7F+dm2 +BF0CeF0L3Io0HUy9x1/IxdLYv2aBv8P/jR62e8q235N6mGH7V1CzrQTwdZlF22BBMIB 4pFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hKXXSOHwMM0odzgM4/sXZSJ+qzYPPrhQfYLqfDXF18g=; b=b/qJMScKCBkaM4vD7kCnYyyJJY80/SzxBbQziCfi2Y6+pVG020oYZ5wiyQwLpND6CT 6U4vlwZCjKdZksmmVo3+eRR6tmwRYNaARt5czSwc9OyQr8HPJX0H9XaciEcEcAUrYwCS Ep4l5x2Nj3gILnbHNZ/vnpXDannL2XzuB7OhcJuGnNwCFhlhY7dcPA5EspueuY/0hBEY sF/4its3k1KUlEkcRWuHfyrC/kzOPlfT4SAaMqxoOVsPo8KN746UrXUhBFvRk9onYlXH GLees7f/9g67k258SD8vzPbe/3oVpDMz+Q+exJKyqPDBqL5G3ckE2UXQws2iwqNjv9jz u5cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MDt4dB7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b24si6310468edt.285.2021.03.28.07.55.37; Sun, 28 Mar 2021 07:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MDt4dB7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbhC1Oyg (ORCPT + 99 others); Sun, 28 Mar 2021 10:54:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbhC1OyJ (ORCPT ); Sun, 28 Mar 2021 10:54:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 36D216192F; Sun, 28 Mar 2021 14:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616943248; bh=y/ymWEHYwTx8OaPC3G/hIMwkrfXN3ruJxutzb5Kk6E8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MDt4dB7jPHeJfP3QhNPcLLEymZ/3PaCJ+cPeHpZ3gfUmS02v6/XB0Jqx61ommtRlx wNYf1z5+pOA/DkR0rUilGohZB5PKTpYNeeBrizjd5m6b+AJLSvsYXcxKv0NssO9Cbi YZbbj2v+YecAQwFWKuv6j0D+ZAQxanrY8/n3nzKA= Date: Sun, 28 Mar 2021 16:54:06 +0200 From: Greg KH To: Fabio Aiuto Cc: joe@perches.com, dan.carpenter@oracle.com, david.laight@aculab.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Message-ID: References: <20210328144322.GB1450@agape.jhs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210328144322.GB1450@agape.jhs> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 28, 2021 at 04:43:24PM +0200, Fabio Aiuto wrote: > On Sun, Mar 28, 2021 at 02:08:41PM +0200, Greg KH wrote: > > On Sat, Mar 27, 2021 at 03:24:08PM +0100, Fabio Aiuto wrote: > > > fix the following checkpatch warning: > > > > > > ERROR: Macros starting with if should be enclosed by a > > > do - while loop to avoid possible if/else logic defects > > > + #define RT_PRINT_DATA(_Comp, _Level, > > > _TitleString, _HexData, _HexDataLen) \ > > > > > > Signed-off-by: Fabio Aiuto > > > --- > > > drivers/staging/rtl8723bs/include/rtw_debug.h | 28 ++++++++++--------- > > > 1 file changed, 15 insertions(+), 13 deletions(-) > > > > > > diff --git a/drivers/staging/rtl8723bs/include/rtw_debug.h b/drivers/staging/rtl8723bs/include/rtw_debug.h > > > index d1c557818305..b00f8a6c4312 100644 > > > --- a/drivers/staging/rtl8723bs/include/rtw_debug.h > > > +++ b/drivers/staging/rtl8723bs/include/rtw_debug.h > > > @@ -236,19 +236,21 @@ > > > #if defined(_dbgdump) > > > #undef RT_PRINT_DATA > > > #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \ > > > - if (((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \ > > > - { \ > > > - int __i; \ > > > - u8 *ptr = (u8 *)_HexData; \ > > > - _dbgdump("%s", DRIVER_PREFIX); \ > > > - _dbgdump(_TitleString); \ > > > - for (__i = 0; __i < (int)_HexDataLen; __i++) \ > > > - { \ > > > - _dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \ > > > - if (((__i + 1) % 16) == 0) _dbgdump("\n"); \ > > > - } \ > > > - _dbgdump("\n"); \ > > > - } > > > > This whole nightmare needs to just be deleted and any callers of it need > > to use the in-kernel functions for this instead. > > > > thanks, > > > > greg k-h > > ok, will we get rid of the private debug level and components tracking as well? Please do. > Maybe encapsulating the built-in proposed by Joe, keeping the macro alive? No, do not keep it alive. Individual debugging/trace/info macros for drivers do not make sense at all. We have kernel-wide infrastructure for this, it is bold for an individual driver to somehow think that they need a "custom" solution for this instead. Just use the normal apis, that is what they are there for. thanks, greg k-h