Skip to content

Commit

Permalink
drivers: gpio: gecko: Use SIZEOF_FIELD() macro
Browse files Browse the repository at this point in the history
Use the utility macro instead of bare code.

(cherry picked from commit 9f6451d)

Original-Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
GitOrigin-RevId: 9f6451d
Change-Id: I759ae0b64b2789e390089b76116094b4cdc9dee2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5611393
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
  • Loading branch information
RICCIARDI-Adrien authored and Chromeos LUCI committed Jun 10, 2024
1 parent 850a0be commit e23d9e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpio/gpio_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <errno.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/irq.h>
#include <zephyr/sys/util.h>
#include <soc.h>
#include <em_gpio.h>
#ifdef CONFIG_SOC_GECKO_DEV_INIT
Expand Down Expand Up @@ -63,9 +64,8 @@
#define GECKO_GPIO_MODEH(pin, mode) (mode << ((pin - 8) * 4))


#define member_size(type, member) sizeof(((type *)0)->member)
#define NUMBER_OF_PORTS (member_size(GPIO_TypeDef, P) / \
member_size(GPIO_TypeDef, P[0]))
#define NUMBER_OF_PORTS (SIZEOF_FIELD(GPIO_TypeDef, P) / \
SIZEOF_FIELD(GPIO_TypeDef, P[0]))

struct gpio_gecko_common_config {
};
Expand Down

0 comments on commit e23d9e9

Please sign in to comment.