From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 620A3CE7A94 for ; Mon, 25 Sep 2023 12:08:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12F9B10E21B; Mon, 25 Sep 2023 12:08:16 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 351C710E21B for ; Mon, 25 Sep 2023 12:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695643693; x=1727179693; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=Esft+rDKLhiMoWZ3I/PgnC7bwFHvyGh6+NmReGKWAF0=; b=EGb71NeBVqViB82RxaVlM38flCEmGO6Kud+ZuTxzH/5G5Ls/3Mtrn1hd nPCiiwcIxyu2jZYPOPn8HLQNEId8QyCmZYWEB549HB4E84id+8iBMepvv Jsobs74iVJaTJaZvU1rrTGNJ1Ccnjtvg17JfMUg/sd05nX/ycPrp/7I9Z wWzNKiRzGTw/6F2/tErID0dYRmDU8kQO9GkLHVm9JO8SaW51ppbEauaTy LFhzoTDxOMFqjFkGZyojQurtjroWw3pjReVlqxyxXUtWzy+CEoWAdn3Bx FIBXOVzzKJNzhb7k/QQDUutq71y8axKKpjgCSkacV21OffpzXaJUyFQQB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="378501727" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="378501727" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 05:08:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="863857641" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="863857641" Received: from smgotth-mobl.ger.corp.intel.com (HELO localhost) ([10.252.40.46]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 05:08:10 -0700 From: Jani Nikula To: "Gupta, Anshuman" , Andi Shyti , "Vivi, Rodrigo" In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20230921102519.3355538-1-badal.nilawar@intel.com> <20230921102519.3355538-2-badal.nilawar@intel.com> Date: Mon, 25 Sep 2023 15:08:08 +0300 Message-ID: <871qemo3pz.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Intel-xe] [PATCH v5 1/6] drm/xe: Add XE_MISSING_CASE macro X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-hwmon@vger.kernel.org" , "intel-xe@lists.freedesktop.org" , "linux@roeck-us.net" Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Fri, 22 Sep 2023, "Gupta, Anshuman" wrote: >> -----Original Message----- >> From: Andi Shyti >> Sent: Friday, September 22, 2023 8:46 PM >> To: Vivi, Rodrigo >> Cc: Nilawar, Badal ; intel-xe@lists.freedesktop.org; >> linux-hwmon@vger.kernel.org; Gupta, Anshuman >> ; Dixit, Ashutosh ; >> linux@roeck-us.net; andi.shyti@linux.intel.com; Tauro, Riana >> ; Brost, Matthew >> Subject: Re: [PATCH v5 1/6] drm/xe: Add XE_MISSING_CASE macro >> >> Hi Rodrigo, >> >> On Thu, Sep 21, 2023 at 12:03:26PM -0400, Rodrigo Vivi wrote: >> > On Thu, Sep 21, 2023 at 03:55:14PM +0530, Badal Nilawar wrote: >> > > Add XE_MISSING_CASE macro to handle missing switch case >> > > >> > > v2: Add comment about macro usage (Himal) >> > > >> > > Cc: Andi Shyti >> > > Signed-off-by: Badal Nilawar >> > > Reviewed-by: Himal Prasad Ghimiray >> > > --- >> > > drivers/gpu/drm/xe/xe_macros.h | 4 ++++ >> > > 1 file changed, 4 insertions(+) >> > > >> > > diff --git a/drivers/gpu/drm/xe/xe_macros.h >> > > b/drivers/gpu/drm/xe/xe_macros.h index daf56c846d03..6c74c69920ed >> > > 100644 >> > > --- a/drivers/gpu/drm/xe/xe_macros.h >> > > +++ b/drivers/gpu/drm/xe/xe_macros.h >> > > @@ -15,4 +15,8 @@ >> > > "Ioctl argument check failed at %s:%d: %s", \ >> > > __FILE__, __LINE__, #cond), 1)) >> > > >> > > +/* Parameter to macro should be a variable name */ #define >> > > +XE_MISSING_CASE(x) WARN(1, "Missing case (%s == %ld)\n", \ >> > > + __stringify(x), (long)(x)) >> > > + >> > >> > No, please! Let's not add unnecessary macros. >> >> it's not a bad idea, actually... in i915 we have the MISSING_CASE for switch >> cases with a defined number of cases and print warnings in case none if them >> is the one inside the switch. > IMHO Our CI aborts the on MISSING_CASE, which is not recoverable, drm_warn would > Be better alternative here. The whole point is that it aborts, so it won't get ignored. It's only for cases like this. BR, Jani. > Thanks, > Anshuman Gupta. >> >> It's so widely used and actually nice to have that I thought many times to >> move it to some core kernel libraries. >> >> Andi -- Jani Nikula, Intel