public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	linux-i2c@vger.kernel.org, Sanket.Goswami@amd.com
Subject: Re: [PATCH 3/5] i2c: piix4: Add ACPI support for ASF SMBus device
Date: Wed, 4 Sep 2024 16:33:07 +0530	[thread overview]
Message-ID: <b07c59dc-40bd-4c95-b897-e40ec42b6119@amd.com> (raw)
In-Reply-To: <ZtdsVvU90WOgyBNr@smile.fi.intel.com>



On 9/4/2024 01:36, Andy Shevchenko wrote:
> On Wed, Sep 04, 2024 at 01:06:16AM +0530, Shyam Sundar S K wrote:
>> +Andy (this has some ACPI handling that adds AMD ASF support to the
>> existing piix4 driver for SMBus)
> 
> Thanks.
> 
>> On 8/22/2024 19:51, Shyam Sundar S K wrote:
>>> The AMD ASF controller is presented to the operating system as an ACPI
>>> device. The piix4 driver can obtain the ASF handle through ACPI to
>>> retrieve 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 is not set up.
> 
> ...
> 
>>> +static acpi_status sb800_asf_acpi_resource_cb(struct acpi_resource *resource, void *context)
>>> +{
>>> +	struct sb800_asf_data *data = context;
>>> +
>>> +	switch (resource->type) {
>>> +	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
>>> +		data->irq = resource->data.extended_irq.interrupts[0];
>>> +		break;
>>> +	case ACPI_RESOURCE_TYPE_IO:
>>> +		data->addr = resource->data.io.minimum;
>>> +		break;
>>> +	}
>>> +
>>> +	return AE_OK;
>>> +}
>>> +
>>> +static int sb800_asf_add_adap(struct pci_dev *dev)
>>> +{
>>> +	struct i2c_piix4_adapdata *adapdata;
>>> +	struct sb800_asf_data *data;
>>> +	acpi_status status;
>>> +	acpi_handle handle;
>>> +	int ret;
> 
>>> +	status = acpi_get_handle(NULL, SB800_ASF_ACPI_PATH, &handle);
>>> +	if (ACPI_FAILURE(status))
>>> +		return -ENODEV;
> 
>>> +	data = devm_kzalloc(&dev->dev, sizeof(struct sb800_asf_data), GFP_KERNEL);
>>> +	if (!data)
>>> +		return -ENOMEM;
> 
> Why can't it be on stack?
> 
>>> +	status = acpi_walk_resources(handle, METHOD_NAME__CRS, sb800_asf_acpi_resource_cb, data);
>>> +	if (ACPI_FAILURE(status))
>>> +		return -EINVAL;
>>> +
>>> +	if (!data->addr)
>>> +		return -EINVAL;
> 
> This is reinvention of acpi_dev_get_resources(). Many drivers are using it, you
> may found a lot of examples.

Thank you for the quick feedback. I have submitted v2 addressing your
remarks. Kindly take a look.

Thanks,
Shyam


  reply	other threads:[~2024-09-04 11:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 14:21 [PATCH 0/5] Add ASF Controller Support to the i2c-piix4 driver Shyam Sundar S K
2024-08-22 14:21 ` [PATCH 1/5] i2c: piix4: Allow more than two algo selection for SMBus Shyam Sundar S K
2024-09-03 21:49   ` Andi Shyti
2024-08-22 14:21 ` [PATCH 2/5] i2c: piix4: Add i2c_algorithm operations to support AMD ASF with SMBus Shyam Sundar S K
2024-08-26 10:54   ` kernel test robot
2024-08-26 11:04   ` kernel test robot
2024-08-22 14:21 ` [PATCH 3/5] i2c: piix4: Add ACPI support for ASF SMBus device Shyam Sundar S K
2024-08-26 10:54   ` kernel test robot
2024-09-03 19:36   ` Shyam Sundar S K
2024-09-03 20:06     ` Andy Shevchenko
2024-09-04 11:03       ` Shyam Sundar S K [this message]
2024-08-22 14:21 ` [PATCH 4/5] i2c: piix4: Adjust the SMBus debug message Shyam Sundar S K
2024-09-03 21:51   ` Andi Shyti
2024-09-04 11:01     ` Shyam Sundar S K
2024-08-22 14:22 ` [PATCH 5/5] i2c: piix4: Clear remote IRR bit to get successive interrupt 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=b07c59dc-40bd-4c95-b897-e40ec42b6119@amd.com \
    --to=shyam-sundar.s-k@amd.com \
    --cc=Sanket.Goswami@amd.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox