All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 08/10] PCI: Deprecate of_pci_get_host_bridge_resources()
Date: Mon, 30 Apr 2018 07:48:42 +0200	[thread overview]
Message-ID: <aca0d89cd8c1551a83b87ffab29fcd6e1d59a61c.1525067324.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1525067324.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1525067324.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

There are no in-tree users remaining, all are converted to the managed
variant. And it is unlikely that any out-of-tree user got the resource
management right as well. So deprecate the interface and push users to
the managed version instead.

To avoid raising a warning when exporting a deprecated symbol, wrap the
API with an inline and export an internal name.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 drivers/pci/of.c       | 23 ++---------------------
 include/linux/of_pci.h | 36 ++++++++++++++++++++++++++++++++----
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 5a88d46a41b7..ccf8c7544e10 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -351,33 +351,14 @@ static int __of_pci_get_host_bridge_resources(struct device *dev,
 	return err;
 }
 
-/**
- * of_pci_get_host_bridge_resources() - Parse PCI host bridge resources from DT
- * @dev_node: device node of the host bridge having the range property
- * @busno: bus number associated with the bridge root bus
- * @bus_max: maximum number of buses for this bridge
- * @resources: list where the range of resources will be added after DT parsing
- * @io_base: pointer to a variable that will contain on return the physical
- * address for the start of the I/O range. Can be NULL if the caller doesn't
- * expect I/O ranges to be present in the device tree.
- *
- * It is the caller's job to free the @resources list.
- *
- * This function will parse the "ranges" property of a PCI host bridge device
- * node and setup the resource mapping based on its content. It is expected
- * that the property conforms with the Power ePAPR document.
- *
- * It returns zero if the range parsing has been successful or a standard error
- * value if it failed.
- */
-int of_pci_get_host_bridge_resources(struct device_node *dev_node,
+int __of_pci_get_host_bridge_resources_deprecated(struct device_node *dev_node,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base)
 {
 	return __of_pci_get_host_bridge_resources(NULL, dev_node, busno,
 						  bus_max, resources, io_base);
 }
-EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
+EXPORT_SYMBOL_GPL(__of_pci_get_host_bridge_resources_deprecated);
 
 /**
  * of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI host
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 08b8f02426a5..c6408bd6f862 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -71,26 +71,54 @@ of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
 #endif
 
 #if defined(CONFIG_OF_ADDRESS)
-int of_pci_get_host_bridge_resources(struct device_node *dev_node,
+int __of_pci_get_host_bridge_resources_deprecated(struct device_node *dev_node,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base);
 int devm_of_pci_get_host_bridge_resources(struct device *dev,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base);
 #else
-static inline int of_pci_get_host_bridge_resources(struct device_node *dev_node,
+static inline int devm_of_pci_get_host_bridge_resources(struct device *dev,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base)
 {
 	return -EINVAL;
 }
+#endif
 
-static inline int devm_of_pci_get_host_bridge_resources(struct device *dev,
+/**
+ * of_pci_get_host_bridge_resources() - Parse PCI host bridge resources from DT
+ * @dev_node: device node of the host bridge having the range property
+ * @busno: bus number associated with the bridge root bus
+ * @bus_max: maximum number of buses for this bridge
+ * @resources: list where the range of resources will be added after DT parsing
+ * @io_base: pointer to a variable that will contain on return the physical
+ * address for the start of the I/O range. Can be NULL if the caller doesn't
+ * expect I/O ranges to be present in the device tree.
+ *
+ * It is the caller's job to free the @resources list.
+ *
+ * This function will parse the "ranges" property of a PCI host bridge device
+ * node and setup the resource mapping based on its content. It is expected
+ * that the property conforms with the Power ePAPR document.
+ *
+ * It returns zero if the range parsing has been successful or a standard error
+ * value if it failed.
+ *
+ * Note: This function is deprecated and will eventually be removed. Use
+ * devm_of_pci_get_host_bridge_resources() instead.
+ */
+static inline int __deprecated of_pci_get_host_bridge_resources(
+			struct device_node *dev_node,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base)
 {
+#if defined(CONFIG_OF_ADDRESS)
+	return __of_pci_get_host_bridge_resources_deprecated(dev_node, busno,
+			bus_max, resources, io_base);
+#else
 	return -EINVAL;
-}
 #endif
+}
 
 #endif
-- 
2.13.6

WARNING: multiple messages have this Message-ID (diff)
From: jan.kiszka@siemens.com (Jan Kiszka)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 08/10] PCI: Deprecate of_pci_get_host_bridge_resources()
Date: Mon, 30 Apr 2018 07:48:42 +0200	[thread overview]
Message-ID: <aca0d89cd8c1551a83b87ffab29fcd6e1d59a61c.1525067324.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1525067324.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

There are no in-tree users remaining, all are converted to the managed
variant. And it is unlikely that any out-of-tree user got the resource
management right as well. So deprecate the interface and push users to
the managed version instead.

To avoid raising a warning when exporting a deprecated symbol, wrap the
API with an inline and export an internal name.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 drivers/pci/of.c       | 23 ++---------------------
 include/linux/of_pci.h | 36 ++++++++++++++++++++++++++++++++----
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 5a88d46a41b7..ccf8c7544e10 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -351,33 +351,14 @@ static int __of_pci_get_host_bridge_resources(struct device *dev,
 	return err;
 }
 
-/**
- * of_pci_get_host_bridge_resources() - Parse PCI host bridge resources from DT
- * @dev_node: device node of the host bridge having the range property
- * @busno: bus number associated with the bridge root bus
- * @bus_max: maximum number of buses for this bridge
- * @resources: list where the range of resources will be added after DT parsing
- * @io_base: pointer to a variable that will contain on return the physical
- * address for the start of the I/O range. Can be NULL if the caller doesn't
- * expect I/O ranges to be present in the device tree.
- *
- * It is the caller's job to free the @resources list.
- *
- * This function will parse the "ranges" property of a PCI host bridge device
- * node and setup the resource mapping based on its content. It is expected
- * that the property conforms with the Power ePAPR document.
- *
- * It returns zero if the range parsing has been successful or a standard error
- * value if it failed.
- */
-int of_pci_get_host_bridge_resources(struct device_node *dev_node,
+int __of_pci_get_host_bridge_resources_deprecated(struct device_node *dev_node,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base)
 {
 	return __of_pci_get_host_bridge_resources(NULL, dev_node, busno,
 						  bus_max, resources, io_base);
 }
-EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
+EXPORT_SYMBOL_GPL(__of_pci_get_host_bridge_resources_deprecated);
 
 /**
  * of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI host
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 08b8f02426a5..c6408bd6f862 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -71,26 +71,54 @@ of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
 #endif
 
 #if defined(CONFIG_OF_ADDRESS)
-int of_pci_get_host_bridge_resources(struct device_node *dev_node,
+int __of_pci_get_host_bridge_resources_deprecated(struct device_node *dev_node,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base);
 int devm_of_pci_get_host_bridge_resources(struct device *dev,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base);
 #else
-static inline int of_pci_get_host_bridge_resources(struct device_node *dev_node,
+static inline int devm_of_pci_get_host_bridge_resources(struct device *dev,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base)
 {
 	return -EINVAL;
 }
+#endif
 
-static inline int devm_of_pci_get_host_bridge_resources(struct device *dev,
+/**
+ * of_pci_get_host_bridge_resources() - Parse PCI host bridge resources from DT
+ * @dev_node: device node of the host bridge having the range property
+ * @busno: bus number associated with the bridge root bus
+ * @bus_max: maximum number of buses for this bridge
+ * @resources: list where the range of resources will be added after DT parsing
+ * @io_base: pointer to a variable that will contain on return the physical
+ * address for the start of the I/O range. Can be NULL if the caller doesn't
+ * expect I/O ranges to be present in the device tree.
+ *
+ * It is the caller's job to free the @resources list.
+ *
+ * This function will parse the "ranges" property of a PCI host bridge device
+ * node and setup the resource mapping based on its content. It is expected
+ * that the property conforms with the Power ePAPR document.
+ *
+ * It returns zero if the range parsing has been successful or a standard error
+ * value if it failed.
+ *
+ * Note: This function is deprecated and will eventually be removed. Use
+ * devm_of_pci_get_host_bridge_resources() instead.
+ */
+static inline int __deprecated of_pci_get_host_bridge_resources(
+			struct device_node *dev_node,
 			unsigned char busno, unsigned char bus_max,
 			struct list_head *resources, resource_size_t *io_base)
 {
+#if defined(CONFIG_OF_ADDRESS)
+	return __of_pci_get_host_bridge_resources_deprecated(dev_node, busno,
+			bus_max, resources, io_base);
+#else
 	return -EINVAL;
-}
 #endif
+}
 
 #endif
-- 
2.13.6

  parent reply	other threads:[~2018-04-30  5:49 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30  5:48 [PATCH v2 00/10] PCI: leak fixes, removable generic PCI host, assorted stuff Jan Kiszka
2018-04-30  5:48 ` Jan Kiszka
2018-04-30  5:48 ` [PATCH v2 01/10] PCI: Make pci_get_new_domain_nr() static Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-04-30  5:48 ` [PATCH v2 02/10] PCI: Fix memory leak of devm_pci_alloc_host_bridge() Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-04-30  5:48 ` [PATCH v2 03/10] PCI: Factor out __of_pci_get_host_bridge_resources() Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-05-03  7:14   ` Vladimir Zapolskiy
2018-05-03  7:14     ` Vladimir Zapolskiy
2018-04-30  5:48 ` [PATCH v2 04/10] PCI: Add dev parameter to __of_pci_get_host_bridge_resources() Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-05-03  7:14   ` Vladimir Zapolskiy
2018-05-03  7:14     ` Vladimir Zapolskiy
2018-04-30  5:48 ` [PATCH v2 05/10] PCI: Replace pr_*() with dev_*() in __of_pci_get_host_bridge_resources() Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-05-03  7:15   ` Vladimir Zapolskiy
2018-05-03  7:15     ` Vladimir Zapolskiy
2018-05-03  7:15     ` Vladimir Zapolskiy
2018-04-30  5:48 ` [PATCH v2 06/10] PCI: Introduce devm_of_pci_get_host_bridge_resources() Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-05-03  7:15   ` Vladimir Zapolskiy
2018-05-03  7:15     ` Vladimir Zapolskiy
2018-04-30  5:48 ` [PATCH v2 07/10] PCI: Convert of_pci_get_host_bridge_resources() users to devm variant Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-05-03  7:18   ` Vladimir Zapolskiy
2018-05-03  7:18     ` Vladimir Zapolskiy
2018-05-04 16:44     ` Lorenzo Pieralisi
2018-05-04 16:44       ` Lorenzo Pieralisi
2018-05-04 16:44       ` Lorenzo Pieralisi
2018-05-05  7:42       ` Vladimir Zapolskiy
2018-05-05  7:42         ` Vladimir Zapolskiy
2018-05-05  7:42         ` Vladimir Zapolskiy
2018-04-30  5:48 ` Jan Kiszka [this message]
2018-04-30  5:48   ` [PATCH v2 08/10] PCI: Deprecate of_pci_get_host_bridge_resources() Jan Kiszka
2018-05-02 12:39   ` Christoph Hellwig
2018-05-02 12:39     ` Christoph Hellwig
2018-05-02 12:39     ` Christoph Hellwig
2018-05-03  7:53     ` Jan Kiszka
2018-05-03  7:53       ` Jan Kiszka
2018-05-03  7:53       ` Jan Kiszka
2018-05-08 13:29       ` Bjorn Helgaas
2018-05-08 13:29         ` Bjorn Helgaas
2018-05-08 13:29         ` Bjorn Helgaas
2018-05-09 19:03         ` [PATCH v3 08/10] PCI: Remove of_pci_get_host_bridge_resources() Jan Kiszka
2018-05-09 19:03           ` Jan Kiszka
2018-04-30  5:48 ` [PATCH v2 09/10] PCI: Add support for unbinding the generic PCI host controller Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-04-30  5:48 ` [PATCH v2 10/10] PCI: Enable PCI_DOMAINS along with " Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-04-30  5:48   ` Jan Kiszka
2018-05-03  7:12 ` [PATCH v2 00/10] PCI: leak fixes, removable generic PCI host, assorted stuff Vladimir Zapolskiy
2018-05-03  7:12   ` Vladimir Zapolskiy
2018-05-03  7:12   ` Vladimir Zapolskiy
2018-05-03  7:52   ` Jan Kiszka
2018-05-03  7:52     ` Jan Kiszka
2018-05-03  7:52     ` Jan Kiszka
2018-05-10 22:51 ` Bjorn Helgaas
2018-05-10 22:51   ` Bjorn Helgaas
2018-05-10 22:51   ` 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=aca0d89cd8c1551a83b87ffab29fcd6e1d59a61c.1525067324.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=bhelgaas@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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.