Merge tag 'devprop-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties framework updates from Rafael Wysocki:
"These unify device properties access in some pieces of code and make
related changes.
Specifics:
- Handle device properties with software node API in the ACPI IORT
table parsing code (Heikki Krogerus).
- Unify of_node access in the common device properties code, constify
the acpi_dma_supported() argument pointer and fix up CONFIG_ACPI=n
stubs of some functions related to device properties (Andy
Shevchenko)"
* tag 'devprop-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
device property: Unify access to of_node
ACPI: scan: Constify acpi_dma_supported() helper function
ACPI: property: Constify stubs for CONFIG_ACPI=n case
ACPI: IORT: Handle device properties with software node API
device property: Retrieve fwnode from of_node via accessor
This commit is contained in:
@@ -976,7 +976,7 @@ static void iort_named_component_init(struct device *dev,
|
|||||||
FIELD_GET(ACPI_IORT_NC_PASID_BITS,
|
FIELD_GET(ACPI_IORT_NC_PASID_BITS,
|
||||||
nc->node_flags));
|
nc->node_flags));
|
||||||
|
|
||||||
if (device_add_properties(dev, props))
|
if (device_create_managed_software_node(dev, props, NULL))
|
||||||
dev_warn(dev, "Could not add device properties\n");
|
dev_warn(dev, "Could not add device properties\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1411,7 +1411,7 @@ void acpi_free_pnp_ids(struct acpi_device_pnp *pnp)
|
|||||||
*
|
*
|
||||||
* Return false if DMA is not supported. Otherwise, return true
|
* Return false if DMA is not supported. Otherwise, return true
|
||||||
*/
|
*/
|
||||||
bool acpi_dma_supported(struct acpi_device *adev)
|
bool acpi_dma_supported(const struct acpi_device *adev)
|
||||||
{
|
{
|
||||||
if (!adev)
|
if (!adev)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
struct fwnode_handle *dev_fwnode(struct device *dev)
|
struct fwnode_handle *dev_fwnode(struct device *dev)
|
||||||
{
|
{
|
||||||
return IS_ENABLED(CONFIG_OF) && dev->of_node ?
|
return IS_ENABLED(CONFIG_OF) && dev->of_node ?
|
||||||
&dev->of_node->fwnode : dev->fwnode;
|
of_fwnode_handle(dev->of_node) : dev->fwnode;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dev_fwnode);
|
EXPORT_SYMBOL_GPL(dev_fwnode);
|
||||||
|
|
||||||
@@ -759,13 +759,8 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_available_child_node);
|
|||||||
struct fwnode_handle *device_get_next_child_node(struct device *dev,
|
struct fwnode_handle *device_get_next_child_node(struct device *dev,
|
||||||
struct fwnode_handle *child)
|
struct fwnode_handle *child)
|
||||||
{
|
{
|
||||||
struct acpi_device *adev = ACPI_COMPANION(dev);
|
const struct fwnode_handle *fwnode = dev_fwnode(dev);
|
||||||
struct fwnode_handle *fwnode = NULL, *next;
|
struct fwnode_handle *next;
|
||||||
|
|
||||||
if (dev->of_node)
|
|
||||||
fwnode = &dev->of_node->fwnode;
|
|
||||||
else if (adev)
|
|
||||||
fwnode = acpi_fwnode_handle(adev);
|
|
||||||
|
|
||||||
/* Try to find a child in primary fwnode */
|
/* Try to find a child in primary fwnode */
|
||||||
next = fwnode_get_next_child_node(fwnode, child);
|
next = fwnode_get_next_child_node(fwnode, child);
|
||||||
@@ -868,28 +863,31 @@ EXPORT_SYMBOL_GPL(device_get_child_node_count);
|
|||||||
|
|
||||||
bool device_dma_supported(struct device *dev)
|
bool device_dma_supported(struct device *dev)
|
||||||
{
|
{
|
||||||
|
const struct fwnode_handle *fwnode = dev_fwnode(dev);
|
||||||
|
|
||||||
/* For DT, this is always supported.
|
/* For DT, this is always supported.
|
||||||
* For ACPI, this depends on CCA, which
|
* For ACPI, this depends on CCA, which
|
||||||
* is determined by the acpi_dma_supported().
|
* is determined by the acpi_dma_supported().
|
||||||
*/
|
*/
|
||||||
if (IS_ENABLED(CONFIG_OF) && dev->of_node)
|
if (is_of_node(fwnode))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return acpi_dma_supported(ACPI_COMPANION(dev));
|
return acpi_dma_supported(to_acpi_device_node(fwnode));
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(device_dma_supported);
|
EXPORT_SYMBOL_GPL(device_dma_supported);
|
||||||
|
|
||||||
enum dev_dma_attr device_get_dma_attr(struct device *dev)
|
enum dev_dma_attr device_get_dma_attr(struct device *dev)
|
||||||
{
|
{
|
||||||
|
const struct fwnode_handle *fwnode = dev_fwnode(dev);
|
||||||
enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED;
|
enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
|
if (is_of_node(fwnode)) {
|
||||||
if (of_dma_is_coherent(dev->of_node))
|
if (of_dma_is_coherent(to_of_node(fwnode)))
|
||||||
attr = DEV_DMA_COHERENT;
|
attr = DEV_DMA_COHERENT;
|
||||||
else
|
else
|
||||||
attr = DEV_DMA_NON_COHERENT;
|
attr = DEV_DMA_NON_COHERENT;
|
||||||
} else
|
} else
|
||||||
attr = acpi_get_dma_attr(ACPI_COMPANION(dev));
|
attr = acpi_get_dma_attr(to_acpi_device_node(fwnode));
|
||||||
|
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
@@ -1007,14 +1005,13 @@ EXPORT_SYMBOL(device_get_mac_address);
|
|||||||
* Returns Linux IRQ number on success. Other values are determined
|
* Returns Linux IRQ number on success. Other values are determined
|
||||||
* accordingly to acpi_/of_ irq_get() operation.
|
* accordingly to acpi_/of_ irq_get() operation.
|
||||||
*/
|
*/
|
||||||
int fwnode_irq_get(struct fwnode_handle *fwnode, unsigned int index)
|
int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
|
||||||
{
|
{
|
||||||
struct device_node *of_node = to_of_node(fwnode);
|
|
||||||
struct resource res;
|
struct resource res;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_OF) && of_node)
|
if (is_of_node(fwnode))
|
||||||
return of_irq_get(of_node, index);
|
return of_irq_get(to_of_node(fwnode), index);
|
||||||
|
|
||||||
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
|
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ struct acpi_pci_root {
|
|||||||
|
|
||||||
/* helper */
|
/* helper */
|
||||||
|
|
||||||
bool acpi_dma_supported(struct acpi_device *adev);
|
bool acpi_dma_supported(const struct acpi_device *adev);
|
||||||
enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev);
|
enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev);
|
||||||
int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,
|
int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,
|
||||||
u64 *size);
|
u64 *size);
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
|
static inline struct acpi_device *to_acpi_device_node(const struct fwnode_handle *fwnode)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -776,12 +776,12 @@ static inline bool is_acpi_data_node(const struct fwnode_handle *fwnode)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode)
|
static inline struct acpi_data_node *to_acpi_data_node(const struct fwnode_handle *fwnode)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool acpi_data_node_match(struct fwnode_handle *fwnode,
|
static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -912,7 +912,7 @@ acpi_create_platform_device(struct acpi_device *adev,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool acpi_dma_supported(struct acpi_device *adev)
|
static inline bool acpi_dma_supported(const struct acpi_device *adev)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ struct fwnode_handle *device_get_named_child_node(struct device *dev,
|
|||||||
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
|
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
|
||||||
void fwnode_handle_put(struct fwnode_handle *fwnode);
|
void fwnode_handle_put(struct fwnode_handle *fwnode);
|
||||||
|
|
||||||
int fwnode_irq_get(struct fwnode_handle *fwnode, unsigned int index);
|
int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
|
||||||
|
|
||||||
unsigned int device_get_child_node_count(struct device *dev);
|
unsigned int device_get_child_node_count(struct device *dev);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user