All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	linux-i2c@vger.kernel.org, Sanket.Goswami@amd.com,
	Patil.Reddy@amd.com
Subject: Re: [PATCH v5 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller
Date: Fri, 13 Sep 2024 22:18:29 +0300	[thread overview]
Message-ID: <ZuSQBcWDOk7gXY4Z@smile.fi.intel.com> (raw)
In-Reply-To: <20240913121110.1611340-5-Shyam-sundar.S-k@amd.com>

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



  reply	other threads:[~2024-09-13 19:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 12:11 [PATCH v5 0/8] Introduce initial AMD ASF Controller driver support Shyam Sundar S K
2024-09-13 12:11 ` [PATCH v5 1/8] i2c: piix4: Change the parameter list of piix4_transaction function Shyam Sundar S K
2024-09-13 19:21   ` Andy Shevchenko
2024-09-13 12:11 ` [PATCH v5 2/8] i2c: piix4: Move i2c_piix4 macros and structures to common header Shyam Sundar S K
2024-09-13 18:44   ` Andy Shevchenko
2024-09-13 12:11 ` [PATCH v5 3/8] i2c: piix4: Export i2c_piix4 driver functions as library Shyam Sundar S K
2024-09-13 18:54   ` Andy Shevchenko
2024-09-17 18:14     ` Shyam Sundar S K
2024-09-18  9:56       ` Andy Shevchenko
2024-09-18 10:14         ` Shyam Sundar S K
2024-09-18 20:50       ` Andi Shyti
2024-09-13 12:11 ` [PATCH v5 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller Shyam Sundar S K
2024-09-13 19:18   ` Andy Shevchenko [this message]
2024-09-13 22:45   ` kernel test robot
2024-09-19 19:44   ` kernel test robot
2024-09-13 12:11 ` [PATCH v5 5/8] i2c: amd-asf: Add i2c_algorithm operations to support AMD ASF with SMBus Shyam Sundar S K
2024-09-13 19:08   ` Andy Shevchenko
2024-09-17 18:17     ` Shyam Sundar S K
2024-09-18  9:58       ` Andy Shevchenko
2024-09-18 10:24         ` Shyam Sundar S K
2024-09-13 12:11 ` [PATCH v5 6/8] i2c: amd-asf: Add routine to handle the ASF slave process Shyam Sundar S K
2024-09-13 19:17   ` Andy Shevchenko
2024-09-17 18:21     ` Shyam Sundar S K
2024-09-18 10:00       ` Andy Shevchenko
2024-09-13 12:11 ` [PATCH v5 7/8] i2c: amd-asf: Clear remote IRR bit to get successive interrupt Shyam Sundar S K
2024-09-13 19:19   ` Andy Shevchenko
2024-09-17 18:31     ` Shyam Sundar S K
2024-09-18 10:03       ` Andy Shevchenko
2024-09-18 10:28         ` Shyam Sundar S K
2024-09-18 14:05           ` Andy Shevchenko
2024-09-13 12:11 ` [PATCH v5 8/8] MAINTAINERS: Add AMD ASF driver entry Shyam Sundar S K
2024-09-13 19:20 ` [PATCH v5 0/8] Introduce initial AMD ASF Controller driver support Andy Shevchenko
2024-09-17 18:11   ` Shyam Sundar S K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZuSQBcWDOk7gXY4Z@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Patil.Reddy@amd.com \
    --cc=Sanket.Goswami@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=andi.shyti@kernel.org \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.