Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3417525iob; Mon, 16 May 2022 22:35:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMXqCfcDaqiHSIU5zRmseSig35arDrHbn/yL63d2ldRaRj04FXyPP+nK9V6USalUoURI/Q X-Received: by 2002:a05:6a00:1d8f:b0:510:9430:8021 with SMTP id z15-20020a056a001d8f00b0051094308021mr20891448pfw.55.1652765714970; Mon, 16 May 2022 22:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652765714; cv=none; d=google.com; s=arc-20160816; b=b3KDQSYWwy+CtzuOB2xZ7RmENzrsM/mt/JxPaL2u2OFDzY3LuYIrsYkIixDvtFe08o rauOs3GPE7VREvBSqsfzoxKAMZR+pf8wC57FR/J1WFeeo19oapd0DH2878pLu4OuUlvL OQunBNBr2jf5R5zVYUR4d2fJdHdST9KhGVPcUPVZ9RBWmGJWS+o6NPbBriRWEosgnde9 xGyX17N/Ub5aTRPaKjdjdTmlrQP/8j1BBWJscp/XvePIfQJSQYz6fa8MhotGdzlEoQii XEKvE/LRpAhQGbdM8JU1lOkKnY+p/8dxfe7HbxL2PxNxbTA+K5phchRiKiFTacU0aszs c6nQ== 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=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=VMn6uYos2ZwrBjjRlJ2+jFDPA9LCuquwC21aRrI3KXytPWVzQw35cR+swJjbGpJbNu LmYsZ8gD3EQebeQypRNk14HX9E+jcalxPS65pnzALwiHxSOyTACNugh2OCBi/6Lp88Mv XPIEhNUrFNbgkU4hxu91+UOOSaVNQYt0pLiRzlGrSBJ1YDKT0v56FtypxVew2zwBkDcu NleQLxi8kuXrQNeWVL6HJFuRwB9+Xy7hQrLAL1E8btRebtAEpv2qzhbSl6KD+cieMTQm dsVEUHHVqD39P6PVpZjD/k+zF4MR2zewxL75gNkgSW25ctypmEYr0FCpY0mpOLP6QCjf C1KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="KaaEEVL/"; 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 oc15-20020a17090b1c0f00b001d9bee7dd25si1918421pjb.101.2022.05.16.22.35.04; Mon, 16 May 2022 22:35:14 -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="KaaEEVL/"; 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 S1350189AbiEPW6h (ORCPT + 99 others); Mon, 16 May 2022 18:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350016AbiEPW53 (ORCPT ); Mon, 16 May 2022 18:57:29 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A33C942EF0; Mon, 16 May 2022 15:57:22 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id z26so17596745iot.8; Mon, 16 May 2022 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=KaaEEVL/0Fno1HcfyHEf4z/GuhJ9D5azg/OjAEcSM6DLHTTuis6Xccyy1ycBgsKvpc yABcTngNZ6IB03n9FcCx+x5tr0OGamuH26VwGNrMjTbOMMi3HONtobw/Fogsnt465ByI FqVV8k8b/C02uYoFKxmplXXpTfBsJRhKRWbwMypPmFFywgnvDLRfylUFScGzQrVHxrQQ quJrCJ+HWHexPzKsRTX4u7w9PgYJi+eoJzechmdTsbGzUZEhZ3M67srd2/FZnTHT4wAL 5GKOiLS5DBwinLdgp5CUnslbZp4lzqFBT2wT+LC84PQkn2+HOK4+oLgm9CfIPrV9vv7K DzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=0yG8N5wXiwgLDV9WI9VwH0Xqg5pzvNRgnlf8Z0R+Dl5QsaGjoXpU0eyba/8uDpDIbz Hls6D4wRl9fN4SPGb01Jo98O/LbgvUVBgpym6ayqrnp1qhTPqRP336VjvSPDHIhgh9h6 Hyzridk+lI6keR0zpmWJRzbup80ZtZgt/OW58AAfhX14cTfOuo3Jav0hbM3N3BPJZSxl brtgdtLqIo0qtQD7rBaN4EXdhkOcJdqcjkduEKp+zcotxA6TR4WQau8PNDgRcHQwXVbS FRmwHtV8mrxqpcbRVPb5HR5hFwf6aCzafy96q0cJuxad9fGCZMY1DeVYzNCmo/Zd/yED gBYA== X-Gm-Message-State: AOAM531ULnYtOoEpDXjBnxfVKdfkdt324NPO0ujLuilRhsTG9Yb91mhk 9A/9T0w9YmeOOLrwEOTV6Mg= X-Received: by 2002:a5d:9f42:0:b0:654:9a2b:cab1 with SMTP id u2-20020a5d9f42000000b006549a2bcab1mr9039211iot.89.1652741841822; Mon, 16 May 2022 15:57:21 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: gregkh@linuxfoundation.org, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v2 17/27] drm_print: condense enum drm_debug_category Date: Mon, 16 May 2022 16:56:30 -0600 Message-Id: <20220516225640.3102269-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-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 0597137bac75..a157485bf573 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -284,49 +284,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.35.3