[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190528104208.GE2781@lahna.fi.intel.com>
Date: Tue, 28 May 2019 13:42:08 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Ruslan Babayev <ruslan@...ayev.com>
Cc: wsa@...-dreams.de, linux@...linux.org.uk, andrew@...n.ch,
f.fainelli@...il.com, hkallweit1@...il.com, davem@...emloft.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-acpi@...r.kernel.org,
xe-linux-external@...co.com
Subject: Re: [net-next,v3 2/2] net: phy: sfp: enable i2c-bus detection on
ACPI based systems
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.westerberg@...ux.intel.com>
Powered by blists - more mailing lists