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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 615A7C433EF for ; Wed, 27 Oct 2021 10:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 414B56103C for ; Wed, 27 Oct 2021 10:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239299AbhJ0KaL (ORCPT ); Wed, 27 Oct 2021 06:30:11 -0400 Received: from mga05.intel.com ([192.55.52.43]:4474 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbhJ0KaH (ORCPT ); Wed, 27 Oct 2021 06:30:07 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10149"; a="316334146" X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="316334146" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 03:27:42 -0700 X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="597312127" Received: from smile.fi.intel.com ([10.237.72.184]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 03:27:39 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mfg9P-001R57-CT; Wed, 27 Oct 2021 13:27:19 +0300 Date: Wed, 27 Oct 2021 13:27:19 +0300 From: Andy Shevchenko To: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= Cc: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , Jim Quinlan , Florian Fainelli , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas Subject: Re: [PATCH v1 1/1] PCI: brcmstb: Use GENMASK() as __GENMASK() is for internal use only Message-ID: References: <20211027093433.4832-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 27, 2021 at 12:00:16PM +0200, Krzysztof Wilczyński wrote: > > Use GENMASK() as __GENMASK() is for internal use only. > > To add, for posterity, that using __GENMASK() bypasses the > GENMASK_INPUT_CHECK() macro that adds extra validation. In general, yes, but here we have a variable... > > - u32 val = __GENMASK(31, msi->legacy_shift); > > + u32 val = GENMASK(31, msi->legacy_shift); ...which make me thing that the whole construction is ugly (and I truly believe the code is very ugly here, because the idea behind GENMASK() is to be used with constants). So, what about u32 val = ~(BIT(msi->legacy_shift) - 1); instead? > Thank you! > > Reviewed-by: Krzysztof Wilczyński Thank you! -- With Best Regards, Andy Shevchenko