Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2189658rwb; Fri, 5 Aug 2022 15:18:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7qdnn6Dfwu36TiBA31v0C1sWNvGTpDtUs5/sgdc1TWxIUyhGG2B5OEA2HvKnEate1JPzfd X-Received: by 2002:a17:907:2c42:b0:730:aacf:1b69 with SMTP id hf2-20020a1709072c4200b00730aacf1b69mr6490680ejc.381.1659737900074; Fri, 05 Aug 2022 15:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659737900; cv=none; d=google.com; s=arc-20160816; b=N6rMbReDZc0TqYq2IjEELXAwWemF5I9UNxWOeL/WsdciFRX5nK5wO2S9gsDOzXgByb jFB+nY+Y0O9t2qiZe+ocdjXzfhu5uF+4U1OpzjntEgw/ASA9EFUdYrSQUWos8WQNgaHm Wvau6AmlNjqpFzqn44AdXiQUCiJyP5SD76EQNPeT3M2emdWuTxGt8mMpstKFqg77dDRr OZyANJx3ifbzyXCOrpvPanW5RkDF1J5oedkAe4yFrGiZ9r7e0tLqSV+MXUODz1veZ2KH otTiF4Ef3dWjnQkI7rw4w1cymUxLoA/DR01SSCZpVixWFaAA9s3LUVOlr1abLz+JWbSD VaOw== 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=1+1UJim8vhT48B81Hjf2bc/Sa3YkiMXKvAKc0hA3YOs=; b=TkKQI+zm/FaVtn2ecVuMdo3NiwxOMW8+tPWCGbiZ7Cl/1CNbljP6fAiZPLBBh5vENF 1i3fjrqTTje8eq25snsxgNo9Gfs3zQMTHznlH1Q43Iyd9W5sZ5l1Zr2jwbUOMFuW9L7R 6N/slllWFVlRmw/AaPReo3CGVe+8TPjfMl2ju9KMLKteBVdV85cXmh6w1Ml0ddHdCxdM jO32G8Uny4Zes86fRAAJwI7YOv1Kl5aNpyQjNy0vdKrq5EwXNQvpHW1gMmUI1ELtYYI0 gmwRHMx+B2SqDFrJ/cTyPu/X3maZruUM3MhIiVUXvRUoxGwd2wj28eFLSWJ8iNPoh42/ 14vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CrJgpQHb; 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 y11-20020a056402270b00b0043bbafc0129si946578edd.235.2022.08.05.15.17.53; Fri, 05 Aug 2022 15:18:20 -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=CrJgpQHb; 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 S241809AbiHEV4q (ORCPT + 99 others); Fri, 5 Aug 2022 17:56:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241668AbiHEVzS (ORCPT ); Fri, 5 Aug 2022 17:55:18 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC95C7CB59; Fri, 5 Aug 2022 14:54:45 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id j20so1975557ila.6; Fri, 05 Aug 2022 14:54:45 -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; bh=1+1UJim8vhT48B81Hjf2bc/Sa3YkiMXKvAKc0hA3YOs=; b=CrJgpQHbDBJ7RwTZKwsK2nXYyHhQp0KotTfA/P+uE/DFkz59bW5r74wG1/yBHFM/fk lcds8RusyQGP77GIRAOgM2dvk6VIWnIniw1zZsRFshKADGXYoCQpm/0hO/TPURqFaPeK +ib27KVmxXzoxn2ixUeAZuxrc6hFjetet7Tq1/5tjEgeaTMsI0liK2hjo37AIx2SbU/9 jwOEM5cmIGQwU+kEydBQxTnP2E27ovG3zbqjY9AtirFFHHnNPEV3ajSSBDPoNWfEuBGy xnO8SRMMDG9CUNKvM6SXEhBXSsqjloGSEULNWC/P+dWD2UwRk2ywIDuekd2gTdrsHipJ K7PA== 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; bh=1+1UJim8vhT48B81Hjf2bc/Sa3YkiMXKvAKc0hA3YOs=; b=IuqXkBQmrmb0IYBNwOJSRQZ/hkXtfklUQw3isoFpilMfQojGx2TveIFG7ZkucJ/9m5 9JCf4p+vGNZGzqZJ+pnikuZLuV+LbQ2y6xd+G8jmqefL8u6KkFSfSDHOguzlOflghcQB TzwGq1hvAOTXbDiH4dB4pL0+JSvZeelxNErMC5v4jesn1DKnbZGODgaat8K+tqovF36a U0ZaNeTrGXrluBFV0ie3itPHSDSmvXfrgadnmJKQSH+XTTwKlpOzlr0nWKwTrcvHDonF 4yhnsk8P5+y4HarTUzGY+ChrXSTX5afp/+K6kdAA72w+/rDjblqgZyqMGNUMRhaQ1xVM vaxQ== X-Gm-Message-State: ACgBeo3jmqZPpPO7JuiiBV4vMYSKbp+0xrj4SdCmt/whJXq5PRTxbMtE VJxsM6b9VSx2IBva3IZMZzbV6tQsPlnWqw== X-Received: by 2002:a05:6e02:17c7:b0:2de:ae1d:35a6 with SMTP id z7-20020a056e0217c700b002deae1d35a6mr3837745ilu.123.1659736484992; Fri, 05 Aug 2022 14:54:44 -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 e12-20020a056602044c00b0067c09fd0b53sm1765532iov.21.2022.08.05.14.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 14:54:44 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, 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-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 22/33] drm_print: condense enum drm_debug_category Date: Fri, 5 Aug 2022 15:53:44 -0600 Message-Id: <20220805215355.3509287-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220805215355.3509287-1-jim.cromie@gmail.com> References: <20220805215355.3509287-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.1