linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 02/26] powerpc/PCI: deprecate pci_get_bus_and_slot()
       [not found] <1513661883-28662-1-git-send-email-okaya@codeaurora.org>
@ 2017-12-19  5:37 ` Sinan Kaya
  2017-12-19 10:29   ` Michael Ellerman
  2017-12-19  5:37 ` [PATCH V4 12/26] powerpc/powermac: " Sinan Kaya
  1 sibling, 1 reply; 4+ messages in thread
From: Sinan Kaya @ 2017-12-19  5:37 UTC (permalink / raw)
  To: linux-pci, timur
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Tyrel Datwyler, Rob Herring, Bhumika Goyal,
	open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), open list

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

Getting ready to remove pci_get_bus_and_slot() function in favor of
pci_get_domain_bus_and_slot().

Use pci_get_domain_bus_and_slot() with a domain number of 0 as the code
is not ready to consume multiple domains and existing code used domain
number 0.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 arch/powerpc/kernel/pci_32.c              | 3 ++-
 arch/powerpc/platforms/powermac/feature.c | 2 +-
 arch/powerpc/sysdev/mv64x60_pci.c         | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 1d817f4..85ad2f7 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -96,7 +96,8 @@
 		reg = of_get_property(node, "reg", NULL);
 		if (!reg)
 			continue;
-		dev = pci_get_bus_and_slot(pci_bus, ((reg[0] >> 8) & 0xff));
+		dev = pci_get_domain_bus_and_slot(0, pci_bus,
+						  ((reg[0] >> 8) & 0xff));
 		if (!dev || !dev->subordinate) {
 			pci_dev_put(dev);
 			continue;
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 466b842..3f82cb2 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -829,7 +829,7 @@ static long core99_scc_enable(struct device_node *node, long param, long value)
 
 	if (value) {
 		if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
-			pdev = pci_get_bus_and_slot(pbus, pid);
+			pdev = pci_get_domain_bus_and_slot(0, pbus, pid);
 		if (pdev == NULL)
 			return 0;
 		rc = pci_enable_device(pdev);
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index d52b3b8..6fe9104 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -37,7 +37,7 @@ static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj,
 	if (count < MV64X60_VAL_LEN_MAX)
 		return -EINVAL;
 
-	phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	phb = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (!phb)
 		return -ENODEV;
 	pci_read_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, &v);
@@ -61,7 +61,7 @@ static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj,
 	if (sscanf(buf, "%i", &v) != 1)
 		return -EINVAL;
 
-	phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	phb = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (!phb)
 		return -ENODEV;
 	pci_write_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, v);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH V4 12/26] powerpc/powermac: deprecate pci_get_bus_and_slot()
       [not found] <1513661883-28662-1-git-send-email-okaya@codeaurora.org>
  2017-12-19  5:37 ` [PATCH V4 02/26] powerpc/PCI: deprecate pci_get_bus_and_slot() Sinan Kaya
@ 2017-12-19  5:37 ` Sinan Kaya
  1 sibling, 0 replies; 4+ messages in thread
From: Sinan Kaya @ 2017-12-19  5:37 UTC (permalink / raw)
  To: linux-pci, timur
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya,
	Benjamin Herrenschmidt, open list:LINUX FOR POWER MACINTOSH,
	open list

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

Getting ready to remove pci_get_bus_and_slot() function in favor of
pci_get_domain_bus_and_slot().

Hard-code the domain number as 0 to match the previous behavior.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/macintosh/via-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index e8b29fc..08849e3 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1799,7 +1799,7 @@ static int powerbook_sleep_grackle(void)
 	struct adb_request req;
 	struct pci_dev *grackle;
 
-	grackle = pci_get_bus_and_slot(0, 0);
+	grackle = pci_get_domain_bus_and_slot(0, 0, 0);
 	if (!grackle)
 		return -ENODEV;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V4 02/26] powerpc/PCI: deprecate pci_get_bus_and_slot()
  2017-12-19  5:37 ` [PATCH V4 02/26] powerpc/PCI: deprecate pci_get_bus_and_slot() Sinan Kaya
@ 2017-12-19 10:29   ` Michael Ellerman
  2017-12-19 12:24     ` Sinan Kaya
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2017-12-19 10:29 UTC (permalink / raw)
  To: Sinan Kaya, linux-pci, timur
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya,
	Benjamin Herrenschmidt, Paul Mackerras, Tyrel Datwyler,
	Rob Herring, Bhumika Goyal,
	open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), open list

Sinan Kaya <okaya@codeaurora.org> writes:

> pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
> where a PCI device is present. This restricts the device drivers to be
> reused for other domain numbers.
>
> Getting ready to remove pci_get_bus_and_slot() function in favor of
> pci_get_domain_bus_and_slot().
>
> Use pci_get_domain_bus_and_slot() with a domain number of 0 as the code
> is not ready to consume multiple domains and existing code used domain
> number 0.
>
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  arch/powerpc/kernel/pci_32.c              | 3 ++-
>  arch/powerpc/platforms/powermac/feature.c | 2 +-
>  arch/powerpc/sysdev/mv64x60_pci.c         | 4 ++--
>  3 files changed, 5 insertions(+), 4 deletions(-)

Looks to do what it says. I don't know if any of these call sites could
be improved to provide the domain, but that's not really your problem.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V4 02/26] powerpc/PCI: deprecate pci_get_bus_and_slot()
  2017-12-19 10:29   ` Michael Ellerman
@ 2017-12-19 12:24     ` Sinan Kaya
  0 siblings, 0 replies; 4+ messages in thread
From: Sinan Kaya @ 2017-12-19 12:24 UTC (permalink / raw)
  To: Michael Ellerman, linux-pci, timur
  Cc: linux-arm-msm, linux-arm-kernel, Benjamin Herrenschmidt,
	Paul Mackerras, Tyrel Datwyler, Rob Herring, Bhumika Goyal,
	open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), open list

On 12/19/2017 5:29 AM, Michael Ellerman wrote:
> Sinan Kaya <okaya@codeaurora.org> writes:
> 
>> pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
>> where a PCI device is present. This restricts the device drivers to be
>> reused for other domain numbers.
>>
>> Getting ready to remove pci_get_bus_and_slot() function in favor of
>> pci_get_domain_bus_and_slot().
>>
>> Use pci_get_domain_bus_and_slot() with a domain number of 0 as the code
>> is not ready to consume multiple domains and existing code used domain
>> number 0.
>>
>> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
>> ---
>>  arch/powerpc/kernel/pci_32.c              | 3 ++-
>>  arch/powerpc/platforms/powermac/feature.c | 2 +-
>>  arch/powerpc/sysdev/mv64x60_pci.c         | 4 ++--
>>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> Looks to do what it says. I don't know if any of these call sites could
> be improved to provide the domain, but that's not really your problem.
> 

I tried to fix the places where I can at the rest of the series. I even took
a stab at fixing powerpc. There were places where the domain information was
not available and I couldn't locate where to extract it. I decided to leave it
as it is and hope that someone someday may expand the powerpc PCI adaptation. 

> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> 
> cheers
> 


-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-19 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1513661883-28662-1-git-send-email-okaya@codeaurora.org>
2017-12-19  5:37 ` [PATCH V4 02/26] powerpc/PCI: deprecate pci_get_bus_and_slot() Sinan Kaya
2017-12-19 10:29   ` Michael Ellerman
2017-12-19 12:24     ` Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 12/26] powerpc/powermac: " Sinan Kaya

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).