All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Raag Jadav <raag.jadav@intel.com>
Cc: hansg@kernel.org, ilpo.jarvinen@linux.intel.com,
	linus.walleij@linaro.org, brgl@bgdev.pl,
	platform-driver-x86@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] platform/x86/intel: Introduce Intel Elkhart Lake PSE I/O
Date: Mon, 10 Nov 2025 09:25:10 +0200	[thread overview]
Message-ID: <aRGTVguXqO2oNCCW@smile.fi.intel.com> (raw)
In-Reply-To: <20251110052728.383339-2-raag.jadav@intel.com>

On Mon, Nov 10, 2025 at 10:56:40AM +0530, Raag Jadav wrote:
> Intel Elkhart Lake Programmable Service Engine (PSE) includes two PCI
> devices that expose two different capabilities of GPIO and Timed I/O
> as a single PCI function through shared MMIO with below layout.
> 
> GPIO: 0x0000 - 0x1000
> TIO:  0x1000 - 0x2000
> 
> This driver enumerates the PCI parent device and creates auxiliary child
> devices for these capabilities. The actual functionalities are provided
> by their respective auxiliary drivers.

...

> +static int ehl_pse_io_dev_add(struct pci_dev *pci, const char *name, int idx)
> +{
> +	struct auxiliary_device *aux_dev;
> +	struct device *dev = &pci->dev;
> +	struct ehl_pse_io_dev *io_dev;
> +	resource_size_t start, offset;
> +	int ret;
> +
> +	io_dev = devm_kzalloc(dev, sizeof(*io_dev), GFP_KERNEL);
> +	if (!io_dev)
> +		return -ENOMEM;
> +
> +	start = pci_resource_start(pci, 0);
> +	offset = EHL_PSE_IO_DEV_SIZE * idx;
> +
> +	io_dev->irq = pci_irq_vector(pci, idx);
> +	io_dev->mem = DEFINE_RES_MEM(start + offset, EHL_PSE_IO_DEV_SIZE);
> +
> +	aux_dev = &io_dev->aux_dev;
> +	aux_dev->name = name;
> +	aux_dev->id = (pci_domain_nr(pci->bus) << 16) | pci_dev_id(pci);
> +	aux_dev->dev.parent = dev;
> +	aux_dev->dev.release = ehl_pse_io_dev_release;
> +
> +	ret = auxiliary_device_init(aux_dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = auxiliary_device_add(aux_dev);
> +	if (ret) {
> +		auxiliary_device_uninit(aux_dev);
> +		return ret;
> +	}

Can it be now auxiliary_device_create() ?

> +	return devm_add_action_or_reset(dev, ehl_pse_io_dev_destroy, aux_dev);
> +}

...

> +#define auxiliary_dev_to_ehl_pse_io_dev(auxiliary_dev) \
> +	container_of(auxiliary_dev, struct ehl_pse_io_dev, aux_dev)

Wondering if we may use container_of_const()

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-11-10  7:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  5:26 [PATCH v2 0/2] Introduce Intel Elkhart Lake PSE I/O Raag Jadav
2025-11-10  5:26 ` [PATCH v2 1/2] platform/x86/intel: " Raag Jadav
2025-11-10  7:25   ` Andy Shevchenko [this message]
2025-11-10 11:17     ` Raag Jadav
2025-11-10  5:26 ` [PATCH v2 2/2] gpio: elkhartlake: Convert to auxiliary driver Raag Jadav

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=aRGTVguXqO2oNCCW@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=raag.jadav@intel.com \
    /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.