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 2F647C433EF for ; Mon, 15 Nov 2021 14:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 18CDC63222 for ; Mon, 15 Nov 2021 14:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232011AbhKOOTU (ORCPT ); Mon, 15 Nov 2021 09:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232021AbhKOOSB (ORCPT ); Mon, 15 Nov 2021 09:18:01 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF8D4C061714; Mon, 15 Nov 2021 06:15:04 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id x15so72632949edv.1; Mon, 15 Nov 2021 06:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t3IGB38yNIMvvVAHrdjMQr2b/VUai/id3/Vj+OgaAcQ=; b=aPWxXxNcDn2tOT6fqzeOq9XAJSCvMRYfpRBv90Zv1Rnc2xvVoid6Zy581p3F4QyAVg 7oBnfq/JGGAITFxzWavXcIBtXQyH/D71zSVCXDyWQBA/fIQS1LLiCnn1Ueyms2N7owc3 pHJaB5PL1grvdpFDYyG/5QsfLzJ0Qy8ycXyAyd87CsotDYXRwu1cJCJ68EpJza3H4SiK tXMsxW+2L4JHRHJknYpU2xuOdED6jREj0tVo1xYzSzCauJJSDvyyJJq2+glQ8KfUALoJ Hr1K9XT2oRmV7QlEgYCJ8dgzs6uAt4uWtk+zHgenjVq240X1tGWjxm2CxMoUf9MpU2NT fYGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t3IGB38yNIMvvVAHrdjMQr2b/VUai/id3/Vj+OgaAcQ=; b=EYoymDa8hqrUQFcOJU4VrflXy89N3eUplgDPuWoqiSZLD+S1ez0kwkOxqrQ5ifLTnN d3fRlKWJv65i8boYy2g6ztxJ4rO9CPYdg7VvHML6JEo01GzeKRy1LKMU12qihRRkKDle HvEYH8x4JrcZEpGt0SaSQV7JD9xVTTArJ2f5JupM8U6I+tEP+i98yYYGCIi+ugqIBbfg GdmY+k8Wqgksx0qx2a+4bIlVFGpAM0Ly2EXjg4Wr2Fj1fjfveIxXdcRt10miR5bYkMhR lnzQ1eXaKwynZEuOQzyr1xGxjEHZoUdtIAnLRDkwkRxvFk1342xcLqiw2JGAzA/P/HOU IzGA== X-Gm-Message-State: AOAM530dBejOvxyNRqU3ML1cHZIrxqvZIkbmiEpL51zC7bRsIS0b5xVU WuTlb4mSJ9UN/TRJxQgQrSuoWErCj5K8F9UfNxw= X-Google-Smtp-Source: ABdhPJwnmDU1Cgwynrgfx6JVeigLWOC2f9G2oU962i2+072e1fw6/NK+SHGTPwurR8Kv7xwrKaJ+VTzT2sQncnLfgrU= X-Received: by 2002:aa7:cb09:: with SMTP id s9mr55677908edt.359.1636985703391; Mon, 15 Nov 2021 06:15:03 -0800 (PST) MIME-Version: 1.0 References: <20211115112000.23693-1-andriy.shevchenko@linux.intel.com> <94d3f4e5-a698-134c-8264-55d31d3eafa6@arm.com> In-Reply-To: <94d3f4e5-a698-134c-8264-55d31d3eafa6@arm.com> From: Andy Shevchenko Date: Mon, 15 Nov 2021 16:14:21 +0200 Message-ID: Subject: Re: [PATCH v2 1/1] PCI: brcmstb: Use BIT() as __GENMASK() is for internal use only To: Robin Murphy Cc: Andy Shevchenko , 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 , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)? :-) > 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 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 1301DC433EF for ; Mon, 15 Nov 2021 14:16:22 +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 D8A1A63222 for ; Mon, 15 Nov 2021 14:16:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D8A1A63222 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YQKfB1pvZvubab2ZyhRi8jPtV+YF6Gl0EgaXkWATkro=; b=AiQSCFftOhOiji PQHalkK6YsGwGucHiwydMDwir0UnKc4ZY16NMwV5DTi6lTK9CX5D6z0RGyTkOLD2H9kAJk0m5ucZA /2zMdiTio2mIDnQOQdlLZWzdRaYIavyuvOnOPHF7d3nFkX72ninT6kW0VPSdyfc0P+SZC1CSYmyL0 AiSu51NvVn7Qu2TGCunSCblZY4/Qu9VRAA74kkNbZOFXPQ8vJ8oDBwXXITkreDx5l5q7gX+Kk2WQu SL+QZvkB1EPVySTxcXeafqaopckjeGprlKldb5QFJg/ym8EcEzPl8q42MuBmgQ8iWwgztwMJOf+uk DNoM5ecVARR24ncFaOVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmclJ-00Fq0R-2v; Mon, 15 Nov 2021 14:15:09 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmclF-00Fpyx-55; Mon, 15 Nov 2021 14:15:06 +0000 Received: by mail-ed1-x52f.google.com with SMTP id r11so8783214edd.9; Mon, 15 Nov 2021 06:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t3IGB38yNIMvvVAHrdjMQr2b/VUai/id3/Vj+OgaAcQ=; b=aPWxXxNcDn2tOT6fqzeOq9XAJSCvMRYfpRBv90Zv1Rnc2xvVoid6Zy581p3F4QyAVg 7oBnfq/JGGAITFxzWavXcIBtXQyH/D71zSVCXDyWQBA/fIQS1LLiCnn1Ueyms2N7owc3 pHJaB5PL1grvdpFDYyG/5QsfLzJ0Qy8ycXyAyd87CsotDYXRwu1cJCJ68EpJza3H4SiK tXMsxW+2L4JHRHJknYpU2xuOdED6jREj0tVo1xYzSzCauJJSDvyyJJq2+glQ8KfUALoJ Hr1K9XT2oRmV7QlEgYCJ8dgzs6uAt4uWtk+zHgenjVq240X1tGWjxm2CxMoUf9MpU2NT fYGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t3IGB38yNIMvvVAHrdjMQr2b/VUai/id3/Vj+OgaAcQ=; b=sSUcqyG69ZJgNrWjpBaXA8U3+OpXQtKB3Advr4mDuFqSuu1S5MOAwBkr4kJXOtDOBR bZShfynod825TdC88iihDGli1DugE7yHoRozNFSAyQO57Wl8QKJvCx9upMSj/DX0U5fX D8K4ulf5zKy0t0vEgnFdiylPodiActFOUjYOg2695km6ub0WqE8FuNxv0qtWXwPnWA8X yRaZSyb3UkoMndvsXBujNIF9F7CTeK5/d8DetXx4l+zPu8g1fGLl6ykKmlVYoHmpca+T DnyD9EeLv+1oN+32NgZeKUAqQi8Ck6aay+Rwou9gd2VUEHgOrhVzLUEcMkzj7cqER5Rq jOog== X-Gm-Message-State: AOAM530K0/RLcbYScmFupZyi8do6Mbxi0Qgg8m1k0b5w+vielKFDCdGy yL7XTWrbTwZeRRyAdn8/DYaz9u7c7Aa0tCH1mng= X-Google-Smtp-Source: ABdhPJwnmDU1Cgwynrgfx6JVeigLWOC2f9G2oU962i2+072e1fw6/NK+SHGTPwurR8Kv7xwrKaJ+VTzT2sQncnLfgrU= X-Received: by 2002:aa7:cb09:: with SMTP id s9mr55677908edt.359.1636985703391; Mon, 15 Nov 2021 06:15:03 -0800 (PST) MIME-Version: 1.0 References: <20211115112000.23693-1-andriy.shevchenko@linux.intel.com> <94d3f4e5-a698-134c-8264-55d31d3eafa6@arm.com> In-Reply-To: <94d3f4e5-a698-134c-8264-55d31d3eafa6@arm.com> From: Andy Shevchenko Date: Mon, 15 Nov 2021 16:14:21 +0200 Message-ID: Subject: Re: [PATCH v2 1/1] PCI: brcmstb: Use BIT() as __GENMASK() is for internal use only To: Robin Murphy Cc: Andy Shevchenko , 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 , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_061505_239343_15CCBDD5 X-CRM114-Status: GOOD ( 14.54 ) 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 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)? :-) > 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