XenevaOS
Loading...
Searching...
No Matches
property.h
Go to the documentation of this file.
1#ifndef __LINUX_PROPERTY_H__
2#define __LINUX_PROPERTY_H__
3
4/*
5 * DCL <linux/property.h> -- the software/fwnode property readers, and
6 * dev_fwnode().
7 *
8 * mainline's header is the interface to device tree, ACPI and software
9 * nodes: reading "rs485-rts-delay" out of the DT, walking fwnode graphs,
10 * fwnode_property_read_u32_array()'s many wrappers. Xeneva has no firmware
11 * description in the kernel at all -- a board's UART is compiled in -- so
12 * there is nothing to read, and all three functions answer that.
13 *
14 * The answers are chosen by looking at what serial_core.c does with them
15 * (uart_set_rs485_config, :3533-3559), rather than invented:
16 *
17 * dev_fwnode() NULL, so `if (!dev_fwnode(dev)) return 0;`
18 * takes its early exit and never claims a
19 * property exists.
20 * device_property_read_u32_array() nonzero (-ENODATA), so the `if (!ret)`
21 * that would apply rs485-rts-delay timings is
22 * skipped -- and a half-applied pair of
23 * delays would be worse than none.
24 * device_property_read_bool() 0, so SER_RS485_RX_DURING_TX is only ever
25 * set by the flags a caller passes in, never
26 * by a DT node that is not there.
27 *
28 * dev_fwnode() lives here rather than in device.h because that is where
29 * mainline declares it (include/linux/property.h), and device.h includes this
30 * header for it.
31 *
32 * upstream include/linux/property.h (mainline v7.2)
33 */
34#include <linux/errno.h> /* -ENODATA */
35#include <linux/types.h> /* u32, u8 */
36#include <linux/list.h> /* struct list_head -- fwnode_handle's supplier and consumers */
37
38struct device;
39
40/*
41 * struct fwnode_handle -- mainline's definition, at property.h:66-73 of the
42 * same header. It was a forward declaration here until drm_connector.c:3492
43 * needed it: that line reads `connector->fwnode->secondary`, and a member
44 * access needs the definition, not the promise.
45 *
46 * All seven members are carried, not only the one that is read. A struct
47 * with three of them is indistinguishable from one with seven until somebody
48 * writes the fourth, and the write would compile and land at whatever offset
49 * the compiler had computed for it -- the failure an ABI pin exists to
50 * prevent, arriving in a file that is not pinned.
51 *
52 * This layout is never persisted and never crosses a boundary: there are no
53 * fwnodes in this kernel, so dev_fwnode() below returns NULL for every
54 * device and drm_connector.c:3492's comparison is always false.
55 */
58 const struct fwnode_operations *ops;
59 struct device *dev;
63};
64
65static inline struct fwnode_handle* dev_fwnode(const struct device* dev)
66{
67 (void)dev;
68 return NULL;
69}
70
71static inline int device_property_read_u32_array(const struct device* dev,
72 const char* propname,
73 u32* values,
74 size_t nvalues)
75{
76 (void)dev;
77 (void)propname;
78 (void)values;
79 (void)nvalues;
80 return -ENODATA;
81}
82
83static inline int device_property_read_bool(const struct device* dev,
84 const char* propname)
85{
86 (void)dev;
87 (void)propname;
88 return 0;
89}
90
91#endif /* __LINUX_PROPERTY_H__ */
#define NULL
Definition actypes.h:561
const struct device * dev
Definition drm_print.h:519
#define ENODATA
Definition kernel.h:318
uint8_t u8
Definition kernel.h:14
uint32_t u32
Definition kernel.h:16
Definition fs.h:255
Definition property.h:56
const struct fwnode_operations * ops
Definition property.h:58
struct list_head supplier
Definition property.h:60
u8 flags
Definition property.h:62
struct fwnode_handle * secondary
Definition property.h:57
struct device * dev
Definition property.h:59
struct list_head consumers
Definition property.h:61
Definition list.h:11