From nobody Mon Apr 6 03:09:19 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6245DECAAD5 for ; Mon, 12 Sep 2022 05:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbiILF3L (ORCPT ); Mon, 12 Sep 2022 01:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiILF3H (ORCPT ); Mon, 12 Sep 2022 01:29:07 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D513724096 for ; Sun, 11 Sep 2022 22:29:06 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id c4so6145461iof.3 for ; Sun, 11 Sep 2022 22:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=wMnPW8sQPrVL8KagTR37lorbRR14ltjvlMMWJEAyAGg=; b=kYdKfVRUHlEG8+qImsA7YlTFI6xkeavOLcLlAeaIDOOOft1rL8LHX2rXIYFWOUMWrW 7xhAtwhgEZAyu6Eksym85vqzKNSVzO11Djoxh0+nGLS76/MmHS/4lN75YfTElKnDj5n6 cGkWS9r2H+MOvAI1qDPQ6x37zKEH3KB+dHQKLDg65any2sWEqLh1Fl1KbMzlOZ5Osi2V fDqyOsPxLFgrxqZPDDRvALJtcqZpweGo3waYTwMty3aifd6H1runl+nhfxEK/WjTvjum 03JUOyVCZYGKgKaxDYYmiW980Ua9wdKRpiI15/eJjGEr9NevmdQ/8vHHi3OhLpz2GOws 0tCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=wMnPW8sQPrVL8KagTR37lorbRR14ltjvlMMWJEAyAGg=; b=phXyPm+Smubl8QV0QBzLrSDP8Oww32L2D2Q3XfHa429LVLMX+uVEbU7JnHtFsbk4QV hdyjzfd4CcHyvbqAamfpsmrJ8PTHpwSZiyPggI1TuN+Ev3QKbEOFDgGH0uFNxiVLof2z Ne0BVvyPvXtTTgthCqw57tYWe3NNUkjSQUFBjIJ9tQI+rSZwfkHGztFcdb6Muv+sdtZc rZWrzJow6b8E4bYRrV5gAclo5ZukgYrL/kRVJ5oOpEVD8WGWJHbpUf1VnT5mZorHOUHb KHfDvSBN6k+K2Vo6jimX2os3pLIXjg1Kw/Vx8D6keTRyEms3ydW6Du7Ovm6eeAM39+p6 uoJg== X-Gm-Message-State: ACgBeo3tCSVNMkeWPt8haiaoDItmCtbmq4DRIm3/Abjt4gZX2dBZXJrh r0W0Crlv2yu6Dbapiq8IU0c= X-Google-Smtp-Source: AA6agR7a8UvflaCOS0O/szEoMKv+7GfDEj8qn5sgo2pmielI/CNoxVV+xn7kMWI0aVvEe2oJDYnezw== X-Received: by 2002:a02:6386:0:b0:349:d0b1:bb7 with SMTP id j128-20020a026386000000b00349d0b10bb7mr13293720jac.172.1662960546197; Sun, 11 Sep 2022 22:29:06 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id q16-20020a056e02079000b002eb75fb01dbsm3006057ils.28.2022.09.11.22.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Sep 2022 22:29:05 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, linux@rasmusvillemoes.dk, joe@perches.com, Jim Cromie Subject: [PATCH v7 1/9] drm_print: condense enum drm_debug_category Date: Sun, 11 Sep 2022 23:28:44 -0600 Message-Id: <20220912052852.1123868-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220912052852.1123868-1-jim.cromie@gmail.com> References: <20220912052852.1123868-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" enum drm_debug_category has 10 categories, but is initialized with bitmasks which require 10 bits of underlying storage. By using natural enumeration, and moving the BIT(cat) into drm_debug_enabled(), the enum fits in 4 bits, allowing the category to be represented directly in pr_debug callsites, via the ddebug.class_id field. While this slightly pessimizes the bit-test in drm_debug_enabled(), using dyndbg with JUMP_LABEL will avoid the function entirely. NOTE: this change forecloses the possibility of doing: drm_dbg(DRM_UT_CORE|DRM_UT_KMS, "weird 2-cat experiment") but thats already strongly implied by the use of the enum itself; its not a normal enum if it can be 2 values simultaneously. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 22fabdeed297..b3b470440e46 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -279,49 +279,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE =3D 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER =3D 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS =3D 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME =3D 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC =3D 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL =3D 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE =3D 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE =3D 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP =3D 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES =3D 0x200, + DRM_UT_DRMRES }; =20 static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } =20 /* --=20 2.37.3