On Mon, May 27, 2019 at 08:22:13PM -0700, Ruslan Babayev wrote:
> +     } else if (ACPI_COMPANION(&pdev->dev)) {

You can also use has_acpi_companion() here.

> +             struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
> +             struct fwnode_handle *fw = acpi_fwnode_handle(adev);
> +             struct fwnode_reference_args args;
> +             struct acpi_handle *acpi_handle;
> +             int ret;
> +
> +             ret = acpi_node_get_property_reference(fw, "i2c-bus", 0, &args);
> +             if (ACPI_FAILURE(ret) || !is_acpi_device_node(args.fwnode)) {
> +                     dev_err(&pdev->dev, "missing 'i2c-bus' property\n");
> +                     return -ENODEV;
>               }
> +
> +             acpi_handle = ACPI_HANDLE_FWNODE(args.fwnode);
> +             i2c = i2c_acpi_find_adapter_by_handle(acpi_handle);
> +     }
> +
> +     if (!i2c)
> +             return -EPROBE_DEFER;
> +
> +     err = sfp_i2c_configure(sfp, i2c);
> +     if (err < 0) {
> +             i2c_put_adapter(i2c);
> +             return err;

Reviewed-by: Mika Westerberg <mika.westerb...@linux.intel.com>

Reply via email to