linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Aaron Durbin <adurbin@google.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Bjorn Helgaas <helgaas@kernel.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	 Linux PCI <linux-pci@vger.kernel.org>
Subject: Re: ACPI device using sub-resource of PCI device
Date: Tue, 16 Aug 2016 14:23:24 +0300	[thread overview]
Message-ID: <1471346604.4887.120.camel@linux.intel.com> (raw)
In-Reply-To: <20160816091502.GB1751@lahna.fi.intel.com>

On Tue, 2016-08-16 at 12:15 +0300, Mika Westerberg wrote:
> On Fri, Aug 12, 2016 at 11:45:30AM -0500, Aaron Durbin wrote:
> > 
> > Was anyone able to take a look into a solution for the current
> > problem?  Again, please feel free to ask if anyone would like help
> > testing potential solutions.
> 
> Below is one proposal for fixing the issue. It is just a prototype and
> I'm not sure if it takes everything needed into account. Would you be
> able to try it out and let us know if it works for you?

Just style comments below.

> --- a/drivers/acpi/acpi_platform.c
> +++ b/drivers/acpi/acpi_platform.c
> @@ -18,6 +18,7 @@
>  #include <linux/module.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/platform_device.h>
> +#include <linux/pci.h>

I would keep trying to arrange them in alphabetical order, i.e. put
before platform_device.h.

>  
>  #include "internal.h"
>  
> @@ -30,6 +31,35 @@ static const struct acpi_device_id
> forbidden_id_list[] = {
>  	{"", 0},
>  };
>  
> +static struct resource *acpi_find_parent_resource(struct acpi_device
> *adev,
> +						  struct resource
> *res)
> +{
> +	struct device *parent;
> +
> +	parent = acpi_get_first_physical_node(adev->parent);
> +	if (!parent)
> +		return NULL;
> +
> +#if IS_ENABLED(CONFIG_PCI)

Oh.

> +	if (dev_is_pci(parent)) {

Has a stub.

> +		struct pci_dev *pdev = to_pci_dev(parent);

Not needed an ugly define.

> +
> +		if (!pci_is_bridge(pdev)) {

Ditto.

> +			int i;
> +
> +			for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {

Ditto.

> +				struct resource *r = &pdev-
> >resource[i];
> +
> +				if (r->start && resource_contains(r,
> res))
> +					return r;
> +			}
> +		}
> +	}
> +#endif
> +
> +	return NULL;
> +}
> +


-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2016-08-16 11:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAE2855tofJV=HV2dYuC+1=pi2mb942zrRF7f0+wqxPPay44RGA@mail.gmail.com>
     [not found] ` <CAE2855t5M2=OVXTBfosdNjqg6jUpM-PK02eP6KHC82eKk71-4w@mail.gmail.com>
     [not found]   ` <20160720193543.GA4186@localhost>
2016-07-20 22:46     ` ACPI device using sub-resource of PCI device Rafael J. Wysocki
2016-07-20 23:02       ` Aaron Durbin
2016-07-21  0:40         ` Rafael J. Wysocki
2016-07-21  1:58           ` Aaron Durbin
2016-07-22  0:55             ` Rafael J. Wysocki
2016-07-22 17:26               ` Aaron Durbin
2016-07-22 21:04                 ` Rafael J. Wysocki
2016-07-25 19:11                   ` Aaron Durbin
2016-07-28  0:09                     ` Rafael J. Wysocki
2016-07-28  4:02                       ` Aaron Durbin
2016-08-12 16:45                         ` Aaron Durbin
2016-08-16  9:15                           ` Mika Westerberg
2016-08-16 11:23                             ` Andy Shevchenko [this message]
2016-08-16 11:27                               ` Rafael J. Wysocki
2016-08-16 12:20                               ` Mika Westerberg
2016-08-17 23:02                             ` Aaron Durbin
2016-09-09 14:12                               ` Aaron Durbin
2016-09-09 14:16                                 ` Aaron Durbin
2016-09-12  8:10                                 ` Mika Westerberg
2016-09-12 12:26                                   ` Rafael J. Wysocki
2016-09-13 12:19                                     ` [PATCH 1/2] PCI: Add pci_find_resource() Mika Westerberg
2016-09-13 12:19                                       ` [PATCH 2/2] ACPI / platform: Pay attention to parent device's resources Mika Westerberg
2016-09-13 14:11                                       ` [PATCH 1/2] PCI: Add pci_find_resource() Andy Shevchenko
2016-09-14  7:45                                         ` Mika Westerberg
2016-09-14 22:16                                       ` Bjorn Helgaas
2016-09-14 22:47                                         ` Rafael J. Wysocki
2016-09-15  8:07                                           ` [PATCH v2 " Mika Westerberg
2016-09-15  8:07                                             ` [PATCH v2 2/2] ACPI / platform: Pay attention to parent device's resources Mika Westerberg
2016-07-22 16:40       ` ACPI device using sub-resource of PCI device Bjorn Helgaas

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=1471346604.4887.120.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=adurbin@google.com \
    --cc=helgaas@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).