Skip to content

Commit

Permalink
Merge branch 'for-next/gc-section'
Browse files Browse the repository at this point in the history
  • Loading branch information
saschahauer committed Dec 10, 2024
2 parents 4708cf9 + 7e45a45 commit 19053e1
Show file tree
Hide file tree
Showing 34 changed files with 293 additions and 35 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/romapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const u32 *imx8m_get_bootrom_log(void)
return (u32 *)rom_log_addr;
}

if (!IN_PBL)
if (IN_PROPER)
return imx8m_scratch_get_bootrom_log();

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap/omap3_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ const struct gpmc_config omap3_nand_cfg = {
.size = GPMC_SIZE_16M,
};

#ifndef __PBL__
#if IN_PROPER
static int omap3_gpio_init(void)
{
add_generic_device("omap-gpio", 0, NULL, OMAP3_GPIO1_BASE,
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/include/asm/unwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

struct pt_regs;

#if defined CONFIG_RISCV_UNWIND && !defined __PBL__
#if defined CONFIG_RISCV_UNWIND && IN_PROPER
void unwind_backtrace(const struct pt_regs *regs);
#else
static inline void unwind_backtrace(const struct pt_regs *regs)
Expand Down
2 changes: 1 addition & 1 deletion common/bootsource.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int bootsource_of_alias_xlate(enum bootsource src, int instance)
struct device_node *np;
int alias_id;

if (!IS_ENABLED(CONFIG_OFDEVICE))
if (!IS_ENABLED(CONFIG_OFDEVICE) || IN_PBL)
return BOOTSOURCE_INSTANCE_UNKNOWN;

if (src == BOOTSOURCE_UNKNOWN ||
Expand Down
2 changes: 1 addition & 1 deletion crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ obj-$(CONFIG_DIGEST_SHA256_GENERIC) += sha2.o
pbl-y += sha2.o digest.o
obj-$(CONFIG_DIGEST_SHA384_GENERIC) += sha4.o
obj-$(CONFIG_DIGEST_SHA512_GENERIC) += sha4.o
obj-y += memneq.o
obj-pbl-y += memneq.o

obj-$(CONFIG_CRYPTO_PBKDF2) += pbkdf2.o
obj-$(CONFIG_CRYPTO_RSA) += rsa.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/pinctrl/imx-iomux-v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void imx_gpio_mode(void __iomem *base, int gpio_mode)
}
}

#ifndef __PBL__
#if IN_PROPER

/*
* MUX_ID format defines
Expand Down
2 changes: 1 addition & 1 deletion fs/fat/ff.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef _FATFS
#define _FATFS 8237 /* Revision ID */

#ifndef __PBL__
#if IN_PROPER

#ifdef CONFIG_FS_FAT_LFN
#define FS_FAT_LFN 1
Expand Down
2 changes: 1 addition & 1 deletion include/abort.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef __ABORT_H
#define __ABORT_H

#if defined CONFIG_ARCH_HAS_DATA_ABORT_MASK && !defined __PBL__
#if defined CONFIG_ARCH_HAS_DATA_ABORT_MASK && IN_PROPER

/*
* data_abort_mask - ignore data aborts
Expand Down
2 changes: 1 addition & 1 deletion include/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void arch_sync_dma_for_device(void *vaddr, size_t size,
enum dma_data_direction dir);
#endif

#ifndef __PBL__
#if IN_PROPER
void dma_sync_single_for_cpu(struct device *dev, dma_addr_t address,
size_t size, enum dma_data_direction dir);

Expand Down
24 changes: 22 additions & 2 deletions include/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <device.h>
#include <of.h>
#include <init.h>
#include <errno.h>
#include <filetype.h>

#define FORMAT_DRIVER_NAME_ID "%s%d"
Expand Down Expand Up @@ -514,21 +515,40 @@ int devfs_create_link(struct cdev *, const char *name);
int devfs_remove(struct cdev *);
int cdev_find_free_index(const char *);
struct cdev *device_find_partition(struct device *dev, const char *name);
struct cdev *cdev_by_name(const char *filename);
struct cdev *lcdev_by_name(const char *filename);
struct cdev *cdev_readlink(struct cdev *cdev);
struct cdev *cdev_by_device_node(struct device_node *node);
struct cdev *cdev_by_partuuid(const char *partuuid);
struct cdev *cdev_by_diskuuid(const char *partuuid);
struct cdev *cdev_open_by_name(const char *name, unsigned long flags);
struct cdev *cdev_create_loop(const char *path, ulong flags, loff_t offset);
void cdev_remove_loop(struct cdev *cdev);
int cdev_open(struct cdev *, unsigned long flags);
int cdev_fdopen(struct cdev *cdev, unsigned long flags);
int cdev_close(struct cdev *cdev);
int cdev_flush(struct cdev *cdev);
#if IN_PROPER
ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags);
ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags);
struct cdev *cdev_by_name(const char *filename);
struct cdev *cdev_open_by_name(const char *name, unsigned long flags);
#else
static inline ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
{
return -ENOSYS;
}
static inline ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
{
return -ENOSYS;
}
static inline struct cdev *cdev_by_name(const char *filename)
{
return NULL;
}
static inline struct cdev *cdev_open_by_name(const char *name, unsigned long flags)
{
return NULL;
}
#endif
int cdev_ioctl(struct cdev *cdev, unsigned int cmd, void *buf);
int cdev_erase(struct cdev *cdev, loff_t count, loff_t offset);
int cdev_lseek(struct cdev*, loff_t);
Expand Down
2 changes: 1 addition & 1 deletion include/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct env_context *get_current_context(void);
char *var_val(struct variable_d *);
char *var_name(struct variable_d *);

#ifdef CONFIG_ENVIRONMENT_VARIABLES
#if IS_ENABLED(CONFIG_ENVIRONMENT_VARIABLES) && IN_PROPER
const char *getenv(const char *);
int setenv(const char *, const char *);
int pr_setenv(const char *, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
Expand Down
10 changes: 10 additions & 0 deletions include/errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@

extern int errno;

#if IN_PROPER
void perror(const char *s);
const char *strerror(int errnum);
#else
static inline void perror(const char *s)
{
}
static inline const char *strerror(int errnum)
{
return "unknown error";
}
#endif

static inline int errno_set(int err)
{
Expand Down
8 changes: 8 additions & 0 deletions include/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define __FCNTL_H

#include <linux/types.h>
#include <errno.h>

#define AT_FDCWD -100 /* Special value used to indicate
openat should use the current
Expand Down Expand Up @@ -38,7 +39,14 @@

#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)

#if IN_PROPER
int openat(int dirfd, const char *pathname, int flags);
#else
static inline int openat(int dirfd, const char *pathname, int flags, ...)
{
return -ENOSYS;
}
#endif

static inline int open(const char *pathname, int flags, ...)
{
Expand Down
7 changes: 7 additions & 0 deletions include/libfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ int copy_recursive(const char *src, const char *dst);

int compare_file(const char *f1, const char *f2);

#if IN_PROPER
int open_and_lseek(const char *filename, int mode, loff_t pos);
#else
static inline int open_and_lseek(const char *filename, int mode, loff_t pos)
{
return -ENOSYS;
}
#endif

/* Create a directory and its parents */
int make_directory(const char *pathname);
Expand Down
4 changes: 2 additions & 2 deletions include/linux/iopoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
#define read_poll_timeout(op, val, cond, timeout_us, args...) \
({ \
uint64_t start = 0; \
if (!IN_PBL && (timeout_us) != 0) \
if (IN_PROPER && (timeout_us) != 0) \
start = get_time_ns(); \
for (;;) { \
(val) = op(args); \
if (cond) \
break; \
if (!IN_PBL && (timeout_us) != 0 && \
if (IN_PROPER && (timeout_us) != 0 && \
is_timeout(start, ((timeout_us) * USECOND))) { \
(val) = op(args); \
break; \
Expand Down
2 changes: 1 addition & 1 deletion include/linux/kasan.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
extern unsigned long kasan_shadow_start;
extern unsigned long kasan_shadow_base;

#if defined(CONFIG_KASAN) && !defined(__PBL__)
#if defined(CONFIG_KASAN) && IN_PROPER

static inline void *kasan_mem_to_shadow(const void *addr)
{
Expand Down
8 changes: 8 additions & 0 deletions include/linux/kconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@
*/
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))

#ifdef __PBL__
#define IN_PBL 1
#define IN_PROPER 0
#else
#define IN_PBL 0
#define IN_PROPER 1
#endif

#endif /* __LINUX_KCONFIG_H */
2 changes: 1 addition & 1 deletion include/linux/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
list->prev = list;
}

#if defined(CONFIG_DEBUG_LIST) && !defined(__PBL__)
#if defined(CONFIG_DEBUG_LIST) && IN_PROPER
extern bool __list_add_valid_or_report(struct list_head *new,
struct list_head *prev,
struct list_head *next);
Expand Down
4 changes: 2 additions & 2 deletions include/linux/printk.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ static inline int dev_printf(int level, const struct device *dev,
}
#endif

#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
#if (IN_PROPER && !defined(CONFIG_CONSOLE_NONE)) || \
(IN_PBL && defined(CONFIG_PBL_CONSOLE))
int pr_print(int level, const char *format, ...)
__attribute__ ((format(__printf__, 2, 3)));
#else
Expand Down
7 changes: 7 additions & 0 deletions include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ static inline const char *kbasename(const char *path)
}
#endif

#if IN_PROPER
void *memdup(const void *, size_t);
#else
static inline void *memdup(const void *buf, size_t size)
{
return NULL;
}
#endif

#define memdup_array(arr, count) memdup(arr, array_size(count, sizeof(*arr)));

Expand Down
37 changes: 37 additions & 0 deletions include/malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/compiler.h>
#include <types.h>

#if IN_PROPER
void *malloc(size_t) __alloc_size(1);
size_t malloc_usable_size(void *);
void free(void *);
Expand All @@ -16,5 +17,41 @@ void malloc_stats(void);
void *sbrk(ptrdiff_t increment);

int mem_malloc_is_initialized(void);
#else
static inline void *malloc(size_t nbytes)
{
return NULL;
}
static inline void free(void *buf)
{
}
static inline void free_sensitive(void *buf)
{
}
static inline void *realloc(void *orig, size_t nbytes)
{
return NULL;
}
static inline void *memalign(size_t align, size_t size)
{
return NULL;
}
static inline void *calloc(size_t num, size_t size)
{
return NULL;
}
static inline void malloc_stats(void)
{
}
static inline void *sbrk(ptrdiff_t increment)
{
return NULL;
}

static inline int mem_malloc_is_initialized(void)
{
return 0;
}
#endif

#endif /* __MALLOC_H */
10 changes: 10 additions & 0 deletions include/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,18 @@ static inline u64 memory_sdram_size(unsigned int cols,

void register_barebox_area(resource_size_t start, resource_size_t size);

#if IN_PROPER
struct resource *request_barebox_region(const char *name,
resource_size_t start,
resource_size_t size);
#else
static inline struct resource *request_barebox_region(const char *name,
resource_size_t start,
resource_size_t size)
{

return ERR_PTR(-ENOSYS);
}
#endif

#endif
2 changes: 1 addition & 1 deletion include/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct cdev;
/* Maximum score returned by of_device_is_compatible() */
#define OF_DEVICE_COMPATIBLE_MAX_SCORE (INT_MAX / 2)

#ifdef CONFIG_OFTREE
#if IS_ENABLED(CONFIG_OFTREE) && IN_PROPER
extern struct device_node *of_read_file(const char *filename);
extern struct of_reserve_map *of_get_reserve_map(void);
extern int of_bus_n_addr_cells(struct device_node *np);
Expand Down
6 changes: 0 additions & 6 deletions include/pbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
#ifndef __PBL_H__
#define __PBL_H__

#ifdef __PBL__
#define IN_PBL 1
#else
#define IN_PBL 0
#endif

#ifndef __ASSEMBLY__

#include <linux/types.h>
Expand Down
4 changes: 2 additions & 2 deletions include/printk.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ struct device;
#define KERN_DEBUG "" /* debug-level messages */
#define KERN_CONT ""

#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
#if (IN_PROPER && !defined(CONFIG_CONSOLE_NONE)) || \
(IN_PBL && defined(CONFIG_PBL_CONSOLE))
int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
#else
static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
Expand Down
Loading

0 comments on commit 19053e1

Please sign in to comment.