Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2514142pxb; Tue, 24 Aug 2021 00:29:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV3jyahG/rSdIlT0DtU+2ZMR36h5pH8uI/p6XJbgk+74Xuv/MYYxwQXvqUdOewdgm6Hrsa X-Received: by 2002:a17:906:9142:: with SMTP id y2mr5975381ejw.545.1629790172238; Tue, 24 Aug 2021 00:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629790172; cv=none; d=google.com; s=arc-20160816; b=T143UlDnBn4yha6/Teq6tacKfrNfeZcIcF2bWouGk404Dnu/GOdUA+hHeV6rqkDN7Y Px3KK4y1jrRVTin5wgNKcwflpgKZMHpFeCMZCrHzYq1dZWYWQFfOSEa3Gt7MlTwqk0Ak EnMYLGu7r74ihBRoV3u6zUbh9IkFKxmNbZKbnAi185Z1VIhH0xCosRU3rGUA7ABbkcho YFXNOAYTEFpSaysuFV/v9ugB+vI68iKy4iOQY++OpJMERj64UoZunbDO5M6UbRIKf4Bh 1BeULXwNp3GJyuWpM0zlB8RuKlvpqRraz79HHEI4bEY8luHMog53SzCn8+E4RpPfTHAv uGjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eP/fzaCJf83R5w9CDsCe7nt2TiaRQKPHnE9dwKIQjLo=; b=Br/8OQstFCAZfjEZ+Ggmy2sVcaQgmZMbMVcVzjD9qKrME2SbDLGz6wb2W77n+KB7AT O/ngyCLks6Hf3qCjW11Ln/oQDvDAu2GJxB/KMHYMXoeSEsIv+8lQ59dwa0q1GEFBHKF6 Flp/ez3PNwlebj499FReov2qQIsXE66uS49cq+T5ALu8WRLiUwWIL+Mjh9H1RgrZ7gX9 nXJqGxIuSZx8BEqQNbBuX4iBqdhFUJxxbg4hETokwdNUlVwrp6KFKdnbOEqYiP+mTkPM 73gRcuE++23dlVnPwrtS7jGm3yYpMsd7Ao/ipeiMA+xaVTkDauxmnRqT6LHyxVZNxxea IEjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TaY/dGFN"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i15si17623979edc.539.2021.08.24.00.29.09; Tue, 24 Aug 2021 00:29:32 -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=@gmail.com header.s=20161025 header.b="TaY/dGFN"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234817AbhHXH2M (ORCPT + 99 others); Tue, 24 Aug 2021 03:28:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234818AbhHXH2I (ORCPT ); Tue, 24 Aug 2021 03:28:08 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C20C06175F for ; Tue, 24 Aug 2021 00:27:24 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id v19so18169978lfo.7 for ; Tue, 24 Aug 2021 00:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eP/fzaCJf83R5w9CDsCe7nt2TiaRQKPHnE9dwKIQjLo=; b=TaY/dGFNh66ahf0u939KNhrEWvSqy+kTfCR5FtPemYu5CsIDh9EsyvyDMirGEd+Feh A9jGi5paDcg9YC8WGRbKhJTfMkMSy4knUPer6hNjegoMNBzoLs0OgadeWmj8b1s+tTNp kr26B4XpXhhbf0xajGkKVyW0qJkgzuh1GQyN61NqPcfHlq+rMMPN1i1zgcYlLd+EfgbQ nQWQA7+XCYLOgLQjVSKkVS37YXNvEHNnffPyJf8bsuap7wFKNFGpsCYmUglD2Sp+SS/5 oc3pEGCovIFnIZHwcFW13VP9F4ADKxe3k11lW5gOA4X62pHpT9N2I1jRO3Jdgff1wfgo o+9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eP/fzaCJf83R5w9CDsCe7nt2TiaRQKPHnE9dwKIQjLo=; b=cElWAKFc9YfmS+Hd/mrRtz6JynTN3Ze2ln/jCYeBS2I/ehvCUekTfW5Be0e/eVd3y/ daGYm5rrHWMY2/w1Kr4EiQt+CD6Zje6OEi441KmgJ6l+BnhcLLRkviqTLb6D8SgM4P7Q OPqbWbl/FVTeobsFPibGBZYVhCIL1fNPrnzFWRf5n8xmePgk/IK0JiMmxkBE6BTTT9dl xSmUKaEEw6Se2g/o2OpsBLg8+25L1qJDhHA9QedNPLWXqI4xKz5mtoFPoDabgeB5PL3r 4uwTezOv0vDH60blxavDpQtvafjDM/Uexqt2KhsGJtiAtNd77HzTS0ORHZ5rn2VaU0+9 Aizw== X-Gm-Message-State: AOAM533bU/VfUlu5asXFAkhRgj9/DcHvmRxZxj5i3jOQ3+oqKcLtcO/H 9lpH5GIchUfPYh42axIqPuQ= X-Received: by 2002:a05:6512:ac3:: with SMTP id n3mr27759041lfu.583.1629790043067; Tue, 24 Aug 2021 00:27:23 -0700 (PDT) Received: from localhost.localdomain ([46.235.66.127]) by smtp.gmail.com with ESMTPSA id a22sm1672127lfl.259.2021.08.24.00.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 00:27:22 -0700 (PDT) From: Pavel Skripkin To: Larry.Finger@lwfinger.net, phil@philpotter.co.uk, gregkh@linuxfoundation.org, straube.linux@gmail.com, fmdefrancesco@gmail.com Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Pavel Skripkin Subject: [PATCH v3 2/6] staging: r8188eu: add helper macro for printing registers Date: Tue, 24 Aug 2021 10:27:20 +0300 Message-Id: <84e388b0eaaf3c56f575216b0571318ed799a4d2.1629789580.git.paskripkin@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a lof of places, where DBG_88E() is used to print register value. Since following patches change _rtw_read*() family prototypes, we can wrap printing registers into useful macro to avoid open-coding error checking like this: u32 tmp; if (!rtw_read(&tmp)) DBG("reg = %d\n", tmp); So, added DBG_88E_REG{8,16,32} macros for printing register values. Signed-off-by: Pavel Skripkin --- drivers/staging/r8188eu/include/rtw_debug.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/staging/r8188eu/include/rtw_debug.h b/drivers/staging/r8188eu/include/rtw_debug.h index 3c3bf2a4f30e..059647b9cd3a 100644 --- a/drivers/staging/r8188eu/include/rtw_debug.h +++ b/drivers/staging/r8188eu/include/rtw_debug.h @@ -72,6 +72,19 @@ extern u32 GlobalDebugLevel; pr_info(DRIVER_PREFIX __VA_ARGS__); \ } while (0) +#define __DBG_88E_REG(fmt, adap, reg, size) \ + do { \ + u##size __tmp__; \ + if (rtw_read##size((adap), (reg), &__tmp__)) \ + break; \ + if (_drv_err_ <= GlobalDebugLevel) \ + pr_info(DRIVER_PREFIX fmt, __tmp__); \ + } while (0) + +#define DBG_88E_REG8(fmt, adap, reg) __DBG_88E_REG(fmt, adap, reg, 8) +#define DBG_88E_REG16(fmt, adap, reg) __DBG_88E_REG(fmt, adap, reg, 16) +#define DBG_88E_REG32(fmt, adap, reg) __DBG_88E_REG(fmt, adap, reg, 32) + int proc_get_drv_version(char *page, char **start, off_t offset, int count, int *eof, void *data); -- 2.32.0