Device properties framework updates for 5.14-rc1

- 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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmDbazMSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxufIQAJ0GTk++XTFOk5TBi2NG0fs+t9tSkOAm
 /RsBopzQMUsTQIcw1tmb/U/Vhtsg/HPnQ7YyWIIc4xz4+UVDLSmDvW1I49+UpVq8
 anNaZuWg0vI/Hk5677pxUCDLnA+WmL9q92JOKB44ItFGONMalm39JRPSDc+sqP+b
 cr6e2EY22r1hgcTaOAGmfF1UGFEAQTNbcVX7jwIZOhjGT7SuaZA63Q9Vi1x3oNba
 3r5qY9mMPT6QaS/DO1pqZRf9j4WCq6rbc+LyMJqbTlnPJyWT+Yb1vymXn8wWZR2K
 Z9XOiUoiujg4ibS5m73W6yAT9qn90kDy3xQW7TiZXN3AbD7K68HRg+vApMAjKve9
 FxiXYZPykihAeuGWyTytCIm+55RKsaXgy1Tb5rY9mX8VU9tTpVB2MnQt0Sc+hzMH
 nFoa6/BQgdLnn3sz7R2Jg4VKIqb7hMkO4q4E9CtVRM4im5EE2LkfZWh4BCZ93uSg
 OqGW/CweLHi8SeJocmeuD8/D7vZ29G5fYKZrDeK0GBdKnS2UEBu4OTyM1+4I9RE8
 GGe90OQDI/6y2HyT27xef1JagciXOJzx55C/daNuLZmWI8Hdc4GeJ4Ppj8R6RiqS
 WIo4Ah4YWa7/oxcTEqg9yt+vDF1irZcIr0Szx8bBwaCXBMZICg/J2JE51XEtgbE2
 bOabPfKesD78
 =aq5E
 -----END PGP SIGNATURE-----

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:
Linus Torvalds 2021-06-29 14:04:37 -07:00
commit 349a2d52ff
6 changed files with 22 additions and 25 deletions

View File

@ -976,7 +976,7 @@ static void iort_named_component_init(struct device *dev,
FIELD_GET(ACPI_IORT_NC_PASID_BITS,
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");
}

View File

@ -1411,7 +1411,7 @@ void acpi_free_pnp_ids(struct acpi_device_pnp *pnp)
*
* 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)
return false;

View File

@ -21,7 +21,7 @@
struct fwnode_handle *dev_fwnode(struct device *dev)
{
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);
@ -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 *child)
{
struct acpi_device *adev = ACPI_COMPANION(dev);
struct fwnode_handle *fwnode = NULL, *next;
if (dev->of_node)
fwnode = &dev->of_node->fwnode;
else if (adev)
fwnode = acpi_fwnode_handle(adev);
const struct fwnode_handle *fwnode = dev_fwnode(dev);
struct fwnode_handle *next;
/* Try to find a child in primary fwnode */
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)
{
const struct fwnode_handle *fwnode = dev_fwnode(dev);
/* For DT, this is always supported.
* For ACPI, this depends on CCA, which
* is determined by the acpi_dma_supported().
*/
if (IS_ENABLED(CONFIG_OF) && dev->of_node)
if (is_of_node(fwnode))
return true;
return acpi_dma_supported(ACPI_COMPANION(dev));
return acpi_dma_supported(to_acpi_device_node(fwnode));
}
EXPORT_SYMBOL_GPL(device_dma_supported);
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;
if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
if (of_dma_is_coherent(dev->of_node))
if (is_of_node(fwnode)) {
if (of_dma_is_coherent(to_of_node(fwnode)))
attr = DEV_DMA_COHERENT;
else
attr = DEV_DMA_NON_COHERENT;
} else
attr = acpi_get_dma_attr(ACPI_COMPANION(dev));
attr = acpi_get_dma_attr(to_acpi_device_node(fwnode));
return attr;
}
@ -1007,14 +1005,13 @@ EXPORT_SYMBOL(device_get_mac_address);
* Returns Linux IRQ number on success. Other values are determined
* 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;
int ret;
if (IS_ENABLED(CONFIG_OF) && of_node)
return of_irq_get(of_node, index);
if (is_of_node(fwnode))
return of_irq_get(to_of_node(fwnode), index);
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
if (ret)

View File

@ -590,7 +590,7 @@ struct acpi_pci_root {
/* 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);
int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,
u64 *size);

View File

@ -766,7 +766,7 @@ static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
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;
}
@ -776,12 +776,12 @@ static inline bool is_acpi_data_node(const struct fwnode_handle *fwnode)
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;
}
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)
{
return false;
@ -912,7 +912,7 @@ acpi_create_platform_device(struct acpi_device *adev,
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;
}

View File

@ -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);
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);