/* * PCI Backend - Common data structures for overriding the configuration space * * Author: Ryan Wilson */ #ifndef __XEN_PCIBACK_CONF_SPACE_H__ #define __XEN_PCIBACK_CONF_SPACE_H__ #include #include /* conf_field_init can return an errno in a ptr with ERR_PTR() */ typedef void *(*conf_field_init) (struct pci_dev *dev, int offset); typedef void (*conf_field_reset) (struct pci_dev *dev, int offset, void *data); typedef void (*conf_field_free) (struct pci_dev *dev, int offset, void *data); typedef int (*conf_dword_write) (struct pci_dev *dev, int offset, u32 value, void *data); typedef int (*conf_word_write) (struct pci_dev *dev, int offset, u16 value, void *data); typedef int (*conf_byte_write) (struct pci_dev *dev, int offset, u8 value, void *data); typedef int (*conf_dword_read) (struct pci_dev *dev, int offset, u32 *value, void *data); typedef int (*conf_word_read) (struct pci_dev *dev, int offset, u16 *value, void *data); typedef int (*conf_byte_read) (struct pci_dev *dev, int offset, u8 *value, void *data); /* These are the fields within the configuration space which we * are interested in intercepting reads/writes to and changing their * values. */ struct config_field { unsigned int offset; unsigned int size; unsigned int mask; conf_field_init init; conf_field_reset reset; conf_field_free release; void (*clean) (struct config_field *field); union { struct { conf_dword_write write; conf_dword_read read; } dw; struct { conf_word_write write; conf_word_read read; } w; struct { conf_byte_write write; conf_byte_read read; } b; } u; struct list_head list; }; struct config_field_entry { struct list_head list; const struct config_field *field; unsigned int base_offset; void *data; }; extern bool xen_pcibk_permissive; #define OFFSET(cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset) /* Add fields to a device - the add_fields macro expects to get a pointer to * the first entry in an array (of which the ending is marked by size==0) */ int xen_pcibk_config_add_field_offset(struct pci_dev *dev, const struct config_field *field, unsigned int offset); static inline int xen_pcibk_config_add_field(struct pci_dev *dev, const struct config_field *field) { return xen_pcibk_config_add_field_offset(dev, field, 0); } static inline int xen_pcibk_config_add_fields(struct pci_dev *dev, const struct config_field *field) { int i, err = 0; for (i = 0; field[i].size != 0; i++) { err = xen_pcibk_config_add_field(dev, &field[i]); if (err) break; } return err; } static inline int xen_pcibk_config_add_fields_offset(struct pci_dev *dev, const struct config_field *field, unsigned int offset) { int i, err = 0; for (i = 0; field[i].size != 0; i++) { err = xen_pcibk_config_add_field_offset(dev, &field[i], offset); if (err) break; } return err; } /* Read/Write the real configuration space */ int xen_pcibk_read_config_byte(struct pci_dev *dev, int offset, u8 *value, void *data); int xen_pcibk_read_config_word(struct pci_dev *dev, int offset, u16 *value, void *data); int xen_pcibk_read_config_dword(struct pci_dev *dev, int offset, u32 *value, void *data); int xen_pcibk_write_config_byte(struct pci_dev *dev, int offset, u8 value, void *data); int xen_pcibk_write_config_word(struct pci_dev *dev, int offset, u16 value, void *data); int xen_pcibk_write_config_dword(struct pci_dev *dev, int offset, u32 value, void *data); int xen_pcibk_config_capability_init(void); int xen_pcibk_config_header_add_fields(struct pci_dev *dev); int xen_pcibk_config_capability_add_fields(struct pci_dev *dev); #endif /* __XEN_PCIBACK_CONF_SPACE_H__ */ e='35'>35space:mode:
authorJisheng Zhang <jszhang@marvell.com>2016-11-10 17:21:29 +0800
committerMark Brown <broonie@kernel.org>2016-11-11 15:38:08 +0000
commit09f2ba0b0b7c44ecea49cf69a708203b76ba5535 (patch)
tree042df33ac99f77d8b86ac427431e267c33561c35 /net/decnet/Kconfig
parent1001354ca34179f3db924eb66672442a173147dc (diff)
regulator: gpio: properly check return value of of_get_named_gpio
The function of_get_named_gpio() could return -ENOENT, -EPROBE_DEFER -EINVAL and so on. Currently, for the optional property "enable-gpio", we only check -EPROBE_DEFER, this is not enough since there may be misconfigured "enable-gpio" in the DTB, of_get_named_gpio() will return -EINVAL in this case, we should return immediately here. And for the optional property "gpios", we didn't check the return value, the driver will continue to the point where gpio_request_array() is called, it doesn't make sense to continue if we got -EPROBE_DEFER or -EINVAL here. This patch tries to address these two issues by properly checking the return value of of_get_named_gpio. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'net/decnet/Kconfig')