linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] microblaze/PCI: Remove pci_phys_mem_access_prot() dead code
@ 2022-01-21 20:51 Bjorn Helgaas
  2022-01-24 12:12 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Helgaas @ 2022-01-21 20:51 UTC (permalink / raw)
  To: Michal Simek; +Cc: linux-pci, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

pci_phys_mem_access_prot() is defined but never used.  Remove it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/microblaze/include/asm/pci.h |  4 ---
 arch/microblaze/pci/pci-common.c  | 49 -------------------------------
 2 files changed, 53 deletions(-)

diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index 7c4dc5d85f53..d90528064604 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -61,10 +61,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
 extern void pcibios_resource_survey(void);
 
 struct file;
-extern pgprot_t	pci_phys_mem_access_prot(struct file *file,
-					 unsigned long pfn,
-					 unsigned long size,
-					 pgprot_t prot);
 
 /* This part of code was originally in xilinx-pci.h */
 #ifdef CONFIG_PCI_XILINX
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 622a4867f9e9..33bab7eec731 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -165,55 +165,6 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
 	return 0;
 }
 
-/*
- * This one is used by /dev/mem and fbdev who have no clue about the
- * PCI device, it tries to find the PCI device first and calls the
- * above routine
- */
-pgprot_t pci_phys_mem_access_prot(struct file *file,
-				  unsigned long pfn,
-				  unsigned long size,
-				  pgprot_t prot)
-{
-	struct pci_dev *pdev = NULL;
-	struct resource *found = NULL;
-	resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
-	int i;
-
-	if (page_is_ram(pfn))
-		return prot;
-
-	prot = pgprot_noncached(prot);
-	for_each_pci_dev(pdev) {
-		for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
-			struct resource *rp = &pdev->resource[i];
-			int flags = rp->flags;
-
-			/* Active and same type? */
-			if ((flags & IORESOURCE_MEM) == 0)
-				continue;
-			/* In the range of this resource? */
-			if (offset < (rp->start & PAGE_MASK) ||
-			    offset > rp->end)
-				continue;
-			found = rp;
-			break;
-		}
-		if (found)
-			break;
-	}
-	if (found) {
-		if (found->flags & IORESOURCE_PREFETCH)
-			prot = pgprot_noncached_wc(prot);
-		pci_dev_put(pdev);
-	}
-
-	pr_debug("PCI: Non-PCI map for %llx, prot: %lx\n",
-		 (unsigned long long)offset, pgprot_val(prot));
-
-	return prot;
-}
-
 /* This provides legacy IO read access on a bus */
 int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, size_t size)
 {
-- 
2.25.1


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

* Re: [PATCH v1] microblaze/PCI: Remove pci_phys_mem_access_prot() dead code
  2022-01-21 20:51 [PATCH v1] microblaze/PCI: Remove pci_phys_mem_access_prot() dead code Bjorn Helgaas
@ 2022-01-24 12:12 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2022-01-24 12:12 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Bjorn Helgaas



On 1/21/22 21:51, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> pci_phys_mem_access_prot() is defined but never used.  Remove it.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>   arch/microblaze/include/asm/pci.h |  4 ---
>   arch/microblaze/pci/pci-common.c  | 49 -------------------------------
>   2 files changed, 53 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
> index 7c4dc5d85f53..d90528064604 100644
> --- a/arch/microblaze/include/asm/pci.h
> +++ b/arch/microblaze/include/asm/pci.h
> @@ -61,10 +61,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
>   extern void pcibios_resource_survey(void);
>   
>   struct file;
> -extern pgprot_t	pci_phys_mem_access_prot(struct file *file,
> -					 unsigned long pfn,
> -					 unsigned long size,
> -					 pgprot_t prot);
>   
>   /* This part of code was originally in xilinx-pci.h */
>   #ifdef CONFIG_PCI_XILINX
> diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
> index 622a4867f9e9..33bab7eec731 100644
> --- a/arch/microblaze/pci/pci-common.c
> +++ b/arch/microblaze/pci/pci-common.c
> @@ -165,55 +165,6 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
>   	return 0;
>   }
>   
> -/*
> - * This one is used by /dev/mem and fbdev who have no clue about the
> - * PCI device, it tries to find the PCI device first and calls the
> - * above routine
> - */
> -pgprot_t pci_phys_mem_access_prot(struct file *file,
> -				  unsigned long pfn,
> -				  unsigned long size,
> -				  pgprot_t prot)
> -{
> -	struct pci_dev *pdev = NULL;
> -	struct resource *found = NULL;
> -	resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
> -	int i;
> -
> -	if (page_is_ram(pfn))
> -		return prot;
> -
> -	prot = pgprot_noncached(prot);
> -	for_each_pci_dev(pdev) {
> -		for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
> -			struct resource *rp = &pdev->resource[i];
> -			int flags = rp->flags;
> -
> -			/* Active and same type? */
> -			if ((flags & IORESOURCE_MEM) == 0)
> -				continue;
> -			/* In the range of this resource? */
> -			if (offset < (rp->start & PAGE_MASK) ||
> -			    offset > rp->end)
> -				continue;
> -			found = rp;
> -			break;
> -		}
> -		if (found)
> -			break;
> -	}
> -	if (found) {
> -		if (found->flags & IORESOURCE_PREFETCH)
> -			prot = pgprot_noncached_wc(prot);
> -		pci_dev_put(pdev);
> -	}
> -
> -	pr_debug("PCI: Non-PCI map for %llx, prot: %lx\n",
> -		 (unsigned long long)offset, pgprot_val(prot));
> -
> -	return prot;
> -}
> -
>   /* This provides legacy IO read access on a bus */
>   int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, size_t size)
>   {

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs



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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 20:51 [PATCH v1] microblaze/PCI: Remove pci_phys_mem_access_prot() dead code Bjorn Helgaas
2022-01-24 12:12 ` Michal Simek

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