Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp4813299rwn; Sun, 11 Sep 2022 22:30:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hFqHPu3bUWYhYfWss6AOfcYS+gaWS+mKCUhCZN+OKxJWSTaJNkhho2b9mq98zuacmY1rY X-Received: by 2002:a17:90b:1b06:b0:202:c7c2:b66d with SMTP id nu6-20020a17090b1b0600b00202c7c2b66dmr4945920pjb.77.1662960615876; Sun, 11 Sep 2022 22:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662960615; cv=none; d=google.com; s=arc-20160816; b=yWoySqqPf9TEiGGj5G/sngrgoRakl+Cgq+JrTlvDSbs6agyRBPu77f6sVNz+n5oC3Z +NS3sPJdPmGQ6DAHevGrlRXqo5iQNeuuXKku7jLhtrLVhBwi0lLN+VKXHHh2yjqjpUQx d0nEUH5SHdGcjjf9ANBjxcnxME5gclR9s1OOU/cW93mSyIukP1CPpWOkrekufxneS2a2 8aqcP85lq5wX9HFAx29MDrq6M3X9oB4bH1wwQbxUaH2vr45dYa7ElSM2M6xvEy0b88SR 4maY2Jp13xVqI60w/ka8WaxJgnSj8UhDst1MnJOtSFi5x3t1b6CeQaJJztGcPAMk582K RoTA== 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=wMnPW8sQPrVL8KagTR37lorbRR14ltjvlMMWJEAyAGg=; b=GEy62+o1Fv4NGdQ4NDHPxlJvvtQTF6JNAQ6/q6F/4yKTUfPJSnTv0OBx8W/P6PhBhD Ke6wdq4t7qHBtEhqH5W6F5jw6orw1yp5lZd0SzBuGNeyW1N4pl7wMKeow6mYYhgbvOkD FAHgE6tuholFaSDCgypcxrRJ10gc5OJOXpbN2q3acnkIhrr43t4erdMhFBW2RgX4FwxE WrXRBqLBWJIiUlETd6TYmL3CPePxIowjkELGWVNOMB4n1LSBR+r6tfx4ziSReKVoMWW9 rjhVM838wSSP0LEPgy7RwJQBP6Hphu+C/g1pEpW/combcz8SQUb2ZEUExMKeTm6Tutdy eh8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kYdKfVRU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il11-20020a17090b164b00b00202c44a8b52si3975879pjb.7.2022.09.11.22.30.03; Sun, 11 Sep 2022 22:30:15 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=kYdKfVRU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229577AbiILF3K (ORCPT + 99 others); Mon, 12 Sep 2022 01:29:10 -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-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: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 = 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /* -- 2.37.3