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 B5F18C433F5 for ; Mon, 15 Nov 2021 14:40:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84F796320D for ; Mon, 15 Nov 2021 14:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 84F796320D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+apPTqBM3HTmho+hqvRYV3/S0Qs5IZs6pZnPd0PV/uE=; b=tqdSur67aitvhv XNfLJnrowmMUyyfjjeu0VZ2/1BBIB2tmCnPpJbx/PsqMq5L4hGhsPZ8/IqO2YOA5I5Q+vddPmO5Rr QVQrq65J05JYnSE5TZSTNA+CQ6WlAlyq7NTOurprbze1Dg25VqnNLAsdio/TzIh07JVKmPTGlmH1O WNKkZmLor8n07KFTDXjGQ49a3Gox0rk3lh2jQUJT/AbemHdkbu8qB47+xpJTvksHNk40wjGva8+eS eis2MQyaBsGISY52eunwBA1XuOOgkv1kXKXyH9C2UWWccsdiLgNpOedv99lufUMurKO3PwXltXFNd af2JB0sxxa+TCHP1Xi2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmd92-00FtAG-TY; Mon, 15 Nov 2021 14:39:41 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmd8y-00Ft9s-Rn; Mon, 15 Nov 2021 14:39:38 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10168"; a="213483994" X-IronPort-AV: E=Sophos;i="5.87,236,1631602800"; d="scan'208";a="213483994" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2021 06:39:35 -0800 X-IronPort-AV: E=Sophos;i="5.87,236,1631602800"; d="scan'208";a="548027586" Received: from smile.fi.intel.com ([10.237.72.184]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2021 06:39:32 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mmd8m-0077T3-1r; Mon, 15 Nov 2021 16:39:24 +0200 Date: Mon, 15 Nov 2021 16:39:23 +0200 From: Andy Shevchenko To: Robin Murphy Cc: bcm-kernel-feedback-list , linux-rpi-kernel , linux-arm Mailing List , linux-pci , Linux Kernel Mailing List , Jim Quinlan , Nicolas Saenz Julienne , Florian Fainelli , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas Subject: Re: [PATCH v2 1/1] PCI: brcmstb: Use BIT() as __GENMASK() is for internal use only Message-ID: References: <20211115112000.23693-1-andriy.shevchenko@linux.intel.com> <94d3f4e5-a698-134c-8264-55d31d3eafa6@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_063936_954715_DD8F375F X-CRM114-Status: GOOD ( 17.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 15, 2021 at 04:14:21PM +0200, Andy Shevchenko wrote: > On Mon, Nov 15, 2021 at 4:01 PM Robin Murphy wrote: > > On 2021-11-15 11:20, Andy Shevchenko wrote: > > > Use BIT() as __GENMASK() is for internal use only. The rationale > > > of switching to BIT() is to provide better generated code. The > > > GENMASK() against non-constant numbers may produce an ugly assembler > > > code. On contrary the BIT() is simply converted to corresponding shift > > > operation. > > > > FWIW, If you care about code quality and want the compiler to do the > > obvious thing, why not specify it as the obvious thing: > > > > u32 val = ~0 << msi->legacy_shift; > > Obvious and buggy (from the C standard point of view)? :-) Forgot to mention that BIT() is also makes it easy to avoid such mistake. > > Personally I don't think that abusing BIT() in the context of setting > > multiple bits is any better than abusing __GENMASK()... > > No, BIT() is not abused here, but __GENMASK(). > > After all it's up to you, folks, consider that as a bug report. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel