+static int get_acp63_device_config(u32 config, struct pci_dev *pci, struct acp63_dev_data *acp_data) { struct acpi_device *dmic_dev;
- struct acpi_device *sdw_dev; const union acpi_object *obj; bool is_dmic_dev = false;
useless init
We are checking is_dmic_dev & is_sdw_dev flags in same code. Either we need to explicitly update value as false when no ACP PDM /SoundWire manager instances not found.
please discard my comment, I read this sideways
- bool is_sdw_dev = false;
and useless init as well...
same here.
int ret;
dmic_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0); if (dmic_dev) {
/* is_dmic_dev flag will be set when ACP PDM controller device exists */
if (!acpi_dev_get_property(dmic_dev, "acp-audio-device-type", ACPI_TYPE_INTEGER, &obj) && obj->integer.value == ACP_DMIC_DEV) is_dmic_dev = true; }
sdw_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_SDW_ADDR, 0);
if (sdw_dev) {
acp_data->sdw_fw_node = acpi_fwnode_handle(sdw_dev);
ret = sdw_amd_scan_controller(&pci->dev);
/* is_sdw_dev flag will be set when SoundWire Manager device exists */
if (!ret)
is_sdw_dev = true;
sdw_amd_scan_controller() can return -EINVAL, how is this handled? Shouldn't you stop execution and return here in the < 0 case?
As per our design, ACP PCI driver probe should be successful, even there are no ACP PDM or Soundwire Manager instance configuration related platform devices.
The ACP PCI driver is multi-use and that even if SoundWire manager instances or PDM controller is not found, it will still be used to set the hardware to proper low power states. i.e ACP should enter D3 state after successful execution of probe sequence.
Ah ok, maybe a reworded comment would make sense then, e.g.
"continue probe and discard errors if SoundWire Manager is not described in ACPI tables"
Same for DMIC above