Skip to content

Commit

Permalink
drivers epprom_simulator: Set standard source macro appropriately
Browse files Browse the repository at this point in the history
This file uses several functions which are extensions to the the
std C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

(cherry picked from commit 1b94864)

Original-Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
GitOrigin-RevId: 1b94864
Change-Id: Ic66b060403b9dac5124fff98ea324aea96da3c74
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5242622
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Tested-by: Tristan Honscheid <honscheid@google.com>
Tested-by: Al Semjonovs <asemjonovs@google.com>
Commit-Queue: Al Semjonovs <asemjonovs@google.com>
  • Loading branch information
aescolar authored and Chromeos LUCI committed Feb 5, 2024
1 parent 0526982 commit bc0c551
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions drivers/eeprom/eeprom_simulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@

#define DT_DRV_COMPAT zephyr_sim_eeprom

#ifdef CONFIG_ARCH_POSIX
#undef _POSIX_C_SOURCE
/* Note: This is used only for interaction with the host C library, and is therefore exempt of
* coding guidelines rule A.4&5 which applies to the embedded code using embedded libraries
*/
#define _POSIX_C_SOURCE 200809L
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include "cmdline.h"
#include "soc.h"
#endif

#include <zephyr/device.h>
#include <zephyr/drivers/eeprom.h>

Expand All @@ -17,15 +31,6 @@
#include <string.h>
#include <errno.h>

#ifdef CONFIG_ARCH_POSIX
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include "cmdline.h"
#include "soc.h"
#endif

#define LOG_LEVEL CONFIG_EEPROM_LOG_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(eeprom_simulator);
Expand Down

0 comments on commit bc0c551

Please sign in to comment.