include/linux/nvmem-provider.h

Source file repositories/reference/linux-study-clean/include/linux/nvmem-provider.h

File Facts

System
Linux kernel
Corpus path
include/linux/nvmem-provider.h
Extension
.h
Size
7352 bytes
Lines
241
Domain
Representative Device Path
Bucket
PCIe NVMe Storage Path
Inferred role
Representative Device Path: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.

Dependency Surface

Detected Declarations

Annotated Snippet

struct device_driver driver;
	int (*probe)(struct nvmem_layout *layout);
	void (*remove)(struct nvmem_layout *layout);
};

#if IS_ENABLED(CONFIG_NVMEM)

struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
void nvmem_unregister(struct nvmem_device *nvmem);

struct nvmem_device *devm_nvmem_register(struct device *dev,
					 const struct nvmem_config *cfg);

int nvmem_add_one_cell(struct nvmem_device *nvmem,
		       const struct nvmem_cell_info *info);

int nvmem_layout_register(struct nvmem_layout *layout);
void nvmem_layout_unregister(struct nvmem_layout *layout);

#define nvmem_layout_driver_register(drv) \
	__nvmem_layout_driver_register(drv, THIS_MODULE)
int __nvmem_layout_driver_register(struct nvmem_layout_driver *drv,
				   struct module *owner);
void nvmem_layout_driver_unregister(struct nvmem_layout_driver *drv);
#define module_nvmem_layout_driver(__nvmem_layout_driver)		\
	module_driver(__nvmem_layout_driver, nvmem_layout_driver_register, \
		      nvmem_layout_driver_unregister)

#else

static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
{
	return ERR_PTR(-EOPNOTSUPP);
}

static inline void nvmem_unregister(struct nvmem_device *nvmem) {}

static inline struct nvmem_device *
devm_nvmem_register(struct device *dev, const struct nvmem_config *c)
{
	return nvmem_register(c);
}

static inline int nvmem_add_one_cell(struct nvmem_device *nvmem,
				     const struct nvmem_cell_info *info)
{
	return -EOPNOTSUPP;
}

static inline int nvmem_layout_register(struct nvmem_layout *layout)
{
	return -EOPNOTSUPP;
}

static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {}

#endif /* CONFIG_NVMEM */

#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)

/**
 * of_nvmem_layout_get_container() - Get OF node of layout container
 *
 * @nvmem: nvmem device
 *
 * Return: a node pointer with refcount incremented or NULL if no
 * container exists. Use of_node_put() on it when done.
 */
struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem);

#else  /* CONFIG_NVMEM && CONFIG_OF */

static inline struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem)
{
	return NULL;
}

#endif /* CONFIG_NVMEM && CONFIG_OF */

#endif  /* ifndef _LINUX_NVMEM_PROVIDER_H */

Annotation

Implementation Notes