Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2016 13:47:50 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309732 - in head/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201612091347.uB9DloCF083429@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Dec  9 13:47:50 2016
New Revision: 309732
URL: https://svnweb.freebsd.org/changeset/base/309732

Log:
  Prefix some _pci_xxx() functions in the Linux KPI with linux_ and make
  sure the IRQ number used by these functions is unsigned.
  
  Sponsored by:           Mellanox Technologies
  MFC after:		1 week

Modified:
  head/sys/compat/linuxkpi/common/include/linux/interrupt.h
  head/sys/compat/linuxkpi/common/include/linux/pci.h
  head/sys/compat/linuxkpi/common/src/linux_pci.c

Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/interrupt.h	Fri Dec  9 13:41:26 2016	(r309731)
+++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h	Fri Dec  9 13:47:50 2016	(r309732)
@@ -50,11 +50,11 @@ struct irq_ent {
 	void		*arg;
 	irqreturn_t	(*handler)(int, void *);
 	void		*tag;
-	int		 irq;
+	unsigned int	irq;
 };
 
 static inline int
-linux_irq_rid(struct device *dev, int irq)
+linux_irq_rid(struct device *dev, unsigned int irq)
 {
 	if (irq == dev->irq)
 		return (0);
@@ -64,7 +64,7 @@ linux_irq_rid(struct device *dev, int ir
 extern void linux_irq_handler(void *);
 
 static inline struct irq_ent *
-linux_irq_ent(struct device *dev, int irq)
+linux_irq_ent(struct device *dev, unsigned int irq)
 {
 	struct irq_ent *irqe;
 
@@ -85,7 +85,7 @@ request_irq(unsigned int irq, irq_handle
 	int error;
 	int rid;
 
-	dev = _pci_find_irq_dev(irq);
+	dev = linux_pci_find_irq_dev(irq);
 	if (dev == NULL)
 		return -ENXIO;
 	rid = linux_irq_rid(dev, irq);
@@ -117,7 +117,7 @@ bind_irq_to_cpu(unsigned int irq, int cp
 	struct irq_ent *irqe;
 	struct device *dev;
 
-	dev = _pci_find_irq_dev(irq);
+	dev = linux_pci_find_irq_dev(irq);
 	if (dev == NULL)
 		return (-ENOENT);
 
@@ -135,7 +135,7 @@ free_irq(unsigned int irq, void *device)
 	struct device *dev;
 	int rid;
 
-	dev = _pci_find_irq_dev(irq);
+	dev = linux_pci_find_irq_dev(irq);
 	if (dev == NULL)
 		return;
 	rid = linux_irq_rid(dev, irq);

Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/pci.h	Fri Dec  9 13:41:26 2016	(r309731)
+++ head/sys/compat/linuxkpi/common/include/linux/pci.h	Fri Dec  9 13:47:50 2016	(r309732)
@@ -171,7 +171,7 @@ struct pci_dev {
 };
 
 static inline struct resource_list_entry *
-_pci_get_rle(struct pci_dev *pdev, int type, int rid)
+linux_pci_get_rle(struct pci_dev *pdev, int type, int rid)
 {
 	struct pci_devinfo *dinfo;
 	struct resource_list *rl;
@@ -182,18 +182,18 @@ _pci_get_rle(struct pci_dev *pdev, int t
 }
 
 static inline struct resource_list_entry *
-_pci_get_bar(struct pci_dev *pdev, int bar)
+linux_pci_get_bar(struct pci_dev *pdev, int bar)
 {
 	struct resource_list_entry *rle;
 
 	bar = PCIR_BAR(bar);
-	if ((rle = _pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL)
-		rle = _pci_get_rle(pdev, SYS_RES_IOPORT, bar);
+	if ((rle = linux_pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL)
+		rle = linux_pci_get_rle(pdev, SYS_RES_IOPORT, bar);
 	return (rle);
 }
 
 static inline struct device *
-_pci_find_irq_dev(unsigned int irq)
+linux_pci_find_irq_dev(unsigned int irq)
 {
 	struct pci_dev *pdev;
 
@@ -215,7 +215,7 @@ pci_resource_start(struct pci_dev *pdev,
 {
 	struct resource_list_entry *rle;
 
-	if ((rle = _pci_get_bar(pdev, bar)) == NULL)
+	if ((rle = linux_pci_get_bar(pdev, bar)) == NULL)
 		return (0);
 	return rle->start;
 }
@@ -225,7 +225,7 @@ pci_resource_len(struct pci_dev *pdev, i
 {
 	struct resource_list_entry *rle;
 
-	if ((rle = _pci_get_bar(pdev, bar)) == NULL)
+	if ((rle = linux_pci_get_bar(pdev, bar)) == NULL)
 		return (0);
 	return rle->count;
 }
@@ -331,7 +331,7 @@ pci_release_region(struct pci_dev *pdev,
 {
 	struct resource_list_entry *rle;
 
-	if ((rle = _pci_get_bar(pdev, bar)) == NULL)
+	if ((rle = linux_pci_get_bar(pdev, bar)) == NULL)
 		return;
 	bus_release_resource(pdev->dev.bsddev, rle->type, rle->rid, rle->res);
 }
@@ -477,7 +477,7 @@ pci_enable_msix(struct pci_dev *pdev, st
 		pci_release_msi(pdev->dev.bsddev);
 		return avail;
 	}
-	rle = _pci_get_rle(pdev, SYS_RES_IRQ, 1);
+	rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1);
 	pdev->dev.msix = rle->start;
 	pdev->dev.msix_max = rle->start + avail;
 	for (i = 0; i < nreq; i++)

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_pci.c	Fri Dec  9 13:41:26 2016	(r309731)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c	Fri Dec  9 13:47:50 2016	(r309732)
@@ -140,8 +140,8 @@ linux_pci_attach(device_t dev)
 	kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev));
 	kobject_add(&pdev->dev.kobj, &linux_root_device.kobj,
 	    kobject_name(&pdev->dev.kobj));
-	rle = _pci_get_rle(pdev, SYS_RES_IRQ, 0);
-	if (rle)
+	rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 0);
+	if (rle != NULL)
 		pdev->dev.irq = rle->start;
 	else
 		pdev->dev.irq = 255;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612091347.uB9DloCF083429>