public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Pete Batard <pete@akeo.ie>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH v2 edk2-platforms 03/20] Platform/Broadcom/RPi3: Add GPIO and RTC libraries
Date: Thu, 13 Dec 2018 10:55:20 +0000	[thread overview]
Message-ID: <20181213105520.kgvssgdmdtk3i6tr@bivouac.eciton.net> (raw)
In-Reply-To: <ac4e4abf-44d0-f2a7-af1f-b38a0d5120a4@akeo.ie>

On Thu, Dec 13, 2018 at 10:49:05AM +0000, Pete Batard wrote:
> > > diff --git a/Platform/Broadcom/Bcm283x/Include/Utils.h b/Platform/Broadcom/Bcm283x/Include/Utils.h
> > > new file mode 100644
> > > index 000000000000..47713275de3f
> > > --- /dev/null
> > > +++ b/Platform/Broadcom/Bcm283x/Include/Utils.h
> > > @@ -0,0 +1,33 @@
> > > +/** @file
> > > + *
> > > + *  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
> > > + *
> > > + *  This program and the accompanying materials
> > > + *  are licensed and made available under the terms and conditions of the BSD License
> > > + *  which accompanies this distribution.  The full text of the license may be found at
> > > + *  http://opensource.org/licenses/bsd-license.php
> > > + *
> > > + *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > > + *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > > + *
> > > + **/
> > > +
> > > +#ifndef UTILS_H
> > > +#define UTILS_H
> > > +
> > > +#define _IX_BITS(sm, bg) ((bg) - (sm) + 1)
> > > +#define _IX_MASK(sm, bg) ((1ul << _IX_BITS((sm), (bg))) - 1)
> > > +#define _X(val, sm, bg) ((val) >> (sm)) & _IX_MASK((sm), (bg))
> > > +#define X(val, ix1, ix2) (((ix1) < (ix2)) ? _X((val), (ix1), (ix2)) :   \
> > > +                          _X((val), (ix2), (ix1)))
> > > +
> > > +#define _I(val, sm, bg)  (((val) & _IX_MASK((sm), (bg))) << (sm))
> > > +#define I(val, ix1, ix2) (((ix1) < (ix2)) ? _I((val), (ix1), (ix2)) :   \
> > > +                          _I((val), (ix2), (ix1)))
> > > +#define _M(val, sm, bg)  ((val) & (_IX_MASK((sm), (bg)) << (sm)))
> > > +#define M(val, ix1, ix2) (((ix1) < (ix2)) ? _M((val), (ix1), (ix2)) :   \
> > > +                          _M((val), (ix2), (ix1)))
> > > +
> > > +#define ELES(x) (sizeof((x)) / sizeof((x)[0]))
> > > +
> > 
> > The name of the file suggests that these are generic utility macros,
> > and they use single letter identifiers. Not great for grep, so please
> > improve the names (assuming that they are actually used anywhere)
> 
> These macros are used. But I agree their naming should be better.
> 
> Also, I'll double check if these macros are actually used in more than one
> source, or if we can remove utils.h altogether and just move these macros
> into the driver/library that requires them.

ELES (if used) can be replaced with ARRAY_SIZE from Base.h.

/
    Leif


  reply	other threads:[~2018-12-13 10:55 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 12:38 [PATCH v2 edk2-platforms 00/20] Platform/Broadcom: Add Raspberry Pi 3 support Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 01/20] Platform/Broadcom/RPi3: Add Reset and Memory Init libraries Pete Batard
2018-12-12 20:43   ` Ard Biesheuvel
2018-12-13 10:48     ` Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 02/20] Platform/Broadcom/RPi3: Add Platform library Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 03/20] Platform/Broadcom/RPi3: Add GPIO and RTC libraries Pete Batard
2018-12-12 20:50   ` Ard Biesheuvel
2018-12-13 10:49     ` Pete Batard
2018-12-13 10:55       ` Leif Lindholm [this message]
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 04/20] Platform/Broadcom/RPi3: Add ACPI Tables Pete Batard
2018-12-12 20:52   ` Ard Biesheuvel
2018-12-13 10:49     ` Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 05/20] Platform/Broadcom/RPi3: Add Boot Manager library Pete Batard
2018-12-12 20:56   ` Ard Biesheuvel
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 06/20] Platform/Broadcom/RPi3: Add Interrupt and Device Tree drivers Pete Batard
2018-12-12 21:09   ` Ard Biesheuvel
2018-12-13 10:49     ` Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 07/20] Platform/Broadcom/RPi3: Add Firmware driver Pete Batard
2018-12-12 21:17   ` Ard Biesheuvel
2018-12-13 10:49     ` Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 08/20] Platform/Broadcom/RPi3: Add Display driver Pete Batard
2018-12-14 15:06   ` Ard Biesheuvel
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 09/20] Platform/Broadcom/RPi3: Add Graphic Console driver Pete Batard
2018-12-14 15:31   ` Ard Biesheuvel
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 10/20] Platform/Broadcom/RPi3: Add Base MMC driver Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 11/20] Platform/Broadcom/RPi3: Add Arasan " Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 12/20] Platform/Broadcom/RPi3: Add SD Host driver Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 13/20] Platform/Broadcom/RPi3: Add SMBIOS driver Pete Batard
2018-12-14 15:36   ` Ard Biesheuvel
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 14/20] Platform/Broadcom/RPi3: Add NV Storage driver Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 15/20] Platform/Broadcom/RPi3: Add Platform Config driver Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 16/20] Platform/Broadcom/RPi3: Add Raspberry Pi 3 Platform Pete Batard
2018-12-14 15:39   ` Ard Biesheuvel
2018-12-14 16:21     ` Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 17/20] Platform/Broadcom/RPi3 *NON-OSI*: Add ATF binaries Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 18/20] Platform/Broadcom/RPi3 *NON-OSI*: Add Device Tree binaries Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 19/20] Platform/Broadcom/RPi3 *NON-OSI*: Add USB Host driver Pete Batard
2018-12-10 12:38 ` [PATCH v2 edk2-platforms 20/20] Platform/Broadcom/RPi3 *NON-OSI*: Add Logo driver Pete Batard
2018-12-11 18:10 ` [PATCH v2 edk2-platforms 00/20] Platform/Broadcom: Add Raspberry Pi 3 support Leif Lindholm
2018-12-11 20:16   ` Pete Batard
2018-12-11 21:20     ` Ard Biesheuvel
2018-12-12 18:32     ` Leif Lindholm
2018-12-12 19:53       ` Pete Batard
2018-12-12 20:01         ` Leif Lindholm
2018-12-14 16:14           ` Philippe Mathieu-Daudé
2018-12-14 16:36             ` Leif Lindholm
2018-12-14 17:08               ` Pete Batard
2018-12-14 18:41                 ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181213105520.kgvssgdmdtk3i6tr@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox