Re: [PATCH v5 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 13, 2024 at 05:41:06PM +0530, Shyam Sundar S K wrote:
> The AMD ASF controller is presented to the operating system as an ACPI
> device. The AMD ASF driver can use ACPI to obtain information about the
> ASF controller's attributes, such as the ASF address space and interrupt
> number, and to handle ASF interrupts.
> 
> Currently, the piix4 driver assumes that a specific port address is
> designated for AUX operations. However, with the introduction of ASF, the
> same port address may also be used by the ASF controller. Therefore, a
> check needs to be added to ensure that if ASF is advertised and enabled in
> ACPI, the AUX port should not be configured.

...

> +#include <linux/device.h>
> +#include <linux/errno.h>

+ gfp_types.h

> +#include <linux/io.h>
> +#include <linux/i2c.h>

Keep them ordered.

+ ioport.h // you use definitions from there

> +#include <linux/module.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/platform_device.h>
> +#include <linux/sprintf.h>

...

> +static const char *amd_asf_port_name = " port 1";

It's a bit counter intuitive to have a leading space in the constants like
this...

...

> +struct amd_asf_dev {
> +	struct i2c_adapter adap;

> +	struct device *dev;

So, this is a dup of adap.dev.parent. Do you really need this shortcut?

> +	struct sb800_mmio_cfg mmio_cfg;
> +	struct resource *port_addr;
> +};

> +static int amd_asf_probe(struct platform_device *pdev)
> +{

With

	struct device *dev = &pdev->dev;

the following lines can be made shorter.

> +	struct amd_asf_dev *asf_dev;
> +
> +	asf_dev = devm_kzalloc(&pdev->dev, sizeof(*asf_dev), GFP_KERNEL);
> +	if (!asf_dev)
> +		return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate memory\n");
> +
> +	asf_dev->dev = &pdev->dev;
> +	asf_dev->mmio_cfg.use_mmio = true;

> +	platform_set_drvdata(pdev, asf_dev);

I believe this won't be needed, see the respective email reply in the series.

> +	asf_dev->port_addr = platform_get_resource(pdev, IORESOURCE_IO, 0);
> +	if (!asf_dev->port_addr)
> +		return dev_err_probe(&pdev->dev, -EINVAL, "missing IO resources\n");
> +
> +	asf_dev->adap.owner = THIS_MODULE;
> +	asf_dev->adap.dev.parent = &pdev->dev;
> +
> +	i2c_set_adapdata(&asf_dev->adap, asf_dev);
> +	snprintf(asf_dev->adap.name, sizeof(asf_dev->adap.name),
> +		 "SMBus ASF adapter%s at 0x%llx", amd_asf_port_name, asf_dev->port_addr->start);
> +
> +	return devm_i2c_add_adapter(&pdev->dev, &asf_dev->adap);
> +}

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux