Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4621797rwj; Tue, 20 Dec 2022 12:45:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6aQL2/fMvTbOg+MEx7H/NGgMdXziIWUHSbe+kIOEeiremAbchjZWMiQHNwRmsjgLs7yWvF X-Received: by 2002:a17:903:234b:b0:189:e7ea:9ff9 with SMTP id c11-20020a170903234b00b00189e7ea9ff9mr70642313plh.42.1671569134675; Tue, 20 Dec 2022 12:45:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671569134; cv=pass; d=google.com; s=arc-20160816; b=ejiqkfwI2pwjm+LRFBIhhMXRgwrcU/EWV3CJRIebLA3eGQJ2fpMPJ5OJeGKMR6umPg 5WSnbAMgYtP4GOQ0XwzmZNQybUZgvfANvduf+p1rZlX4c53GTGDuejuhctGbn9WAadML VL2vTa7pMZ2PAH3RsMf31ojVnHCJ/JefcDDJCWOB7TDV7fEsQIr8FkylOWWeOqOrDAvU OdxPOXutaU5RvApi4enMkG4qZB+nXCNTYwdvqtjZnK3EpBv6qqv9ns/eS6hrUWWSrYk8 P/WPL3Dp0505BK/u7rc0F+S23Mk7tfYcE950zMxGnbq8QvOkZCx4Ngr2vmUGtX6vZbUX BqnQ== ARC-Message-Signature: i=2; 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:date:subject:message-id:cc:to:from :dkim-signature; bh=SOPWJE5d02Vzl8zylY3TQdJgvgPJ1agqESFAbzCxsWc=; b=QqoFOmiv2bHa9c65f4lH7qfxooAnaiq14UJAqKKZOqvaTiLQ4Q3Pfx7QCHspo0vAWA 8XZfksPrgI9DorR0lIleIcYo05cX6XTAgcJwxE9iJxvRKYnYtO5rQsbDqEjVkqNlYrEH DbWjcKw1ytBYkwOxblYhS3ytMUVdH1uu7FIps4qBVN7L9Wn4xbYi3a+PPjGLg3WiZtpd YLxa8CoIiRsxcuQMfNTQ8If4aIpMEFLARcsLDTd0jh23tp49FhqAYN8frXV1GNxRxzCa 0/NluAjGg7lhS2Srom283WIf0rgr1yeJBjtfpnFfLLSCRGWNPn9JAPpMt2XxvSL8LGad PBHQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siddh.me header.s=zmail header.b=lgnTQRGw; arc=pass (i=1 spf=pass spfdomain=siddh.me dkim=pass dkdomain=siddh.me dmarc=pass fromdomain=siddh.me>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siddh.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a17090274cc00b001781e393237si13899518plt.443.2022.12.20.12.45.25; Tue, 20 Dec 2022 12:45:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@siddh.me header.s=zmail header.b=lgnTQRGw; arc=pass (i=1 spf=pass spfdomain=siddh.me dkim=pass dkdomain=siddh.me dmarc=pass fromdomain=siddh.me>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siddh.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230130AbiLTURv (ORCPT + 68 others); Tue, 20 Dec 2022 15:17:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233028AbiLTURh (ORCPT ); Tue, 20 Dec 2022 15:17:37 -0500 Received: from sender-of-o50.zoho.in (sender-of-o50.zoho.in [103.117.158.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6879DBB9 for ; Tue, 20 Dec 2022 12:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671567421; cv=none; d=zohomail.in; s=zohoarc; b=ZZ3Cn1LzWaB2b2g9EzB96b3U+p+HkUtUoCidMJwmZfNzMqqMwwNhyYPaVdcicFA0jXk4L008AgQ3U/AD1OxEoEymw2ADuFvPVaB9rAGo4sIdke+713JwTgA8UoMpEpcPOpKgRAIb+Chu456RxqC23fWym27vYMZAONMo5liYs9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.in; s=zohoarc; t=1671567421; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=SOPWJE5d02Vzl8zylY3TQdJgvgPJ1agqESFAbzCxsWc=; b=IN0ArUvUu+fYhn6xTtELAF508aNe5TwmG0iZ6EEtafZfiGVc7BPNNRqXMTPVD6nfUCgSPoP8TIFAdLhKPcpz+sC2BB6PmoClKa9SMoLh07Cq8yT3j3fB0bVl1e4m5DqTdm0X18rKdtD7J4Y+3RrMDwqn7ZiO1QJ2lIMs3Yx0F1E= ARC-Authentication-Results: i=1; mx.zohomail.in; dkim=pass header.i=siddh.me; spf=pass smtp.mailfrom=code@siddh.me; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1671567421; s=zmail; d=siddh.me; i=code@siddh.me; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=SOPWJE5d02Vzl8zylY3TQdJgvgPJ1agqESFAbzCxsWc=; b=lgnTQRGwmsBUMMMnk5ePbGgupJvv767sqDRTZZUloEeojdEhLwK05LLeJRrdjEmr XgkUtvql+Oawe8lUl3omshzt/OUfaKyjfsGw2VpjBTIul3uoFDDaMGOtbPIcNyb/LPv y5UvkOrMz2JIJwqPy7K2GQQPjlYRn0iBKCR/dYEw= Received: from kampyooter.. (110.226.31.37 [110.226.31.37]) by mx.zoho.in with SMTPS id 1671567420947873.7402382604851; Wed, 21 Dec 2022 01:47:00 +0530 (IST) From: Siddh Raman Pant To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel , linux-kernel Message-ID: <3ebf0d61ad5e82875a4493108602e62429306b14.1671566741.git.code@siddh.me> Subject: [PATCH 04/10] drm/print: Fix support for NULL as first argument of drm_dbg_* Date: Wed, 21 Dec 2022 01:46:39 +0530 X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset=utf8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Comments say macros DRM_DEBUG_* are deprecated in favor of drm_dbg_*(NULL, ...), but they have broken support for it, as the macro will result in `(NULL) ? (NULL)->dev : NULL`. Thus, fix them by casting input drm to a temporary struct ptr, with the same convention as in __DRM_DEFINE_DBG_RATELIMITED. Signed-off-by: Siddh Raman Pant --- include/drm/drm_print.h | 89 ++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index a44fb7ef257f..53702d830291 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -486,26 +486,75 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct= device *dev, =09__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__) =20 =20 -#define drm_dbg_core(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__) -#define drm_dbg_driver(drm, fmt, ...)=09=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS_= _) -#define drm_dbg_kms(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__) -#define drm_dbg_prime(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__= ) -#define drm_dbg_atomic(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS_= _) -#define drm_dbg_vbl(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__) -#define drm_dbg_state(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__= ) -#define drm_dbg_lease(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__= ) -#define drm_dbg_dp(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__) -#define drm_dbg_drmres(drm, fmt, ...)=09=09=09=09=09\ -=09drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS_= _) +#define drm_dbg_core(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_CORE,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_driver(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DRIVER,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_kms(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_KMS,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_prime(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_PRIME,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_atomic(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_ATOMIC,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_vbl(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_VBL,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_state(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_STATE,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_lease(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_LEASE,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_dp(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DP,=09=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) + +#define drm_dbg_drmres(drm, fmt, ...)=09=09=09=09\ +({=09=09=09=09=09=09=09=09\ +=09const struct drm_device *drm_ =3D (drm);=09=09=09\ +=09drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DRMRES,=09\ +=09=09 fmt, ##__VA_ARGS__);=09=09=09\ +}) =20 #define drm_dbg(drm, fmt, ...)=09drm_dbg_driver(drm, fmt, ##__VA_ARGS__) =20 --=20 2.35.1