Commit 125282cd authored by Thomas Gleixner's avatar Thomas Gleixner

genirq/msi: Move descriptor list to struct msi_device_data

It's only required when MSI is in use.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Tested-by: default avatarNishanth Menon <nm@ti.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211206210747.650487479@linutronix.de
parent 1900c962
...@@ -2874,9 +2874,6 @@ void device_initialize(struct device *dev) ...@@ -2874,9 +2874,6 @@ void device_initialize(struct device *dev)
INIT_LIST_HEAD(&dev->devres_head); INIT_LIST_HEAD(&dev->devres_head);
device_pm_init(dev); device_pm_init(dev);
set_dev_node(dev, NUMA_NO_NODE); set_dev_node(dev, NUMA_NO_NODE);
#ifdef CONFIG_GENERIC_MSI_IRQ
INIT_LIST_HEAD(&dev->msi_list);
#endif
INIT_LIST_HEAD(&dev->links.consumers); INIT_LIST_HEAD(&dev->links.consumers);
INIT_LIST_HEAD(&dev->links.suppliers); INIT_LIST_HEAD(&dev->links.suppliers);
INIT_LIST_HEAD(&dev->links.defer_sync); INIT_LIST_HEAD(&dev->links.defer_sync);
......
...@@ -423,7 +423,6 @@ struct dev_msi_info { ...@@ -423,7 +423,6 @@ struct dev_msi_info {
* @pins: For device pin management. * @pins: For device pin management.
* See Documentation/driver-api/pin-control.rst for details. * See Documentation/driver-api/pin-control.rst for details.
* @msi: MSI related data * @msi: MSI related data
* @msi_list: Hosts MSI descriptors
* @numa_node: NUMA node this device is close to. * @numa_node: NUMA node this device is close to.
* @dma_ops: DMA mapping operations for this device. * @dma_ops: DMA mapping operations for this device.
* @dma_mask: Dma mask (if dma'ble device). * @dma_mask: Dma mask (if dma'ble device).
...@@ -519,9 +518,6 @@ struct device { ...@@ -519,9 +518,6 @@ struct device {
struct dev_pin_info *pins; struct dev_pin_info *pins;
#endif #endif
struct dev_msi_info msi; struct dev_msi_info msi;
#ifdef CONFIG_GENERIC_MSI_IRQ
struct list_head msi_list;
#endif
#ifdef CONFIG_DMA_OPS #ifdef CONFIG_DMA_OPS
const struct dma_map_ops *dma_ops; const struct dma_map_ops *dma_ops;
#endif #endif
......
...@@ -144,11 +144,13 @@ struct msi_desc { ...@@ -144,11 +144,13 @@ struct msi_desc {
* @properties: MSI properties which are interesting to drivers * @properties: MSI properties which are interesting to drivers
* @attrs: Pointer to the sysfs attribute group * @attrs: Pointer to the sysfs attribute group
* @platform_data: Platform-MSI specific data * @platform_data: Platform-MSI specific data
* @list: List of MSI descriptors associated to the device
*/ */
struct msi_device_data { struct msi_device_data {
unsigned long properties; unsigned long properties;
const struct attribute_group **attrs; const struct attribute_group **attrs;
struct platform_msi_priv_data *platform_data; struct platform_msi_priv_data *platform_data;
struct list_head list;
}; };
int msi_setup_device_data(struct device *dev); int msi_setup_device_data(struct device *dev);
...@@ -157,7 +159,7 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index); ...@@ -157,7 +159,7 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index);
/* Helpers to hide struct msi_desc implementation details */ /* Helpers to hide struct msi_desc implementation details */
#define msi_desc_to_dev(desc) ((desc)->dev) #define msi_desc_to_dev(desc) ((desc)->dev)
#define dev_to_msi_list(dev) (&(dev)->msi_list) #define dev_to_msi_list(dev) (&(dev)->msi.data->list)
#define first_msi_entry(dev) \ #define first_msi_entry(dev) \
list_first_entry(dev_to_msi_list((dev)), struct msi_desc, list) list_first_entry(dev_to_msi_list((dev)), struct msi_desc, list)
#define for_each_msi_entry(desc, dev) \ #define for_each_msi_entry(desc, dev) \
......
...@@ -75,7 +75,9 @@ EXPORT_SYMBOL_GPL(get_cached_msi_msg); ...@@ -75,7 +75,9 @@ EXPORT_SYMBOL_GPL(get_cached_msi_msg);
static void msi_device_data_release(struct device *dev, void *res) static void msi_device_data_release(struct device *dev, void *res)
{ {
WARN_ON_ONCE(!list_empty(&dev->msi_list)); struct msi_device_data *md = res;
WARN_ON_ONCE(!list_empty(&md->list));
dev->msi.data = NULL; dev->msi.data = NULL;
} }
...@@ -100,6 +102,7 @@ int msi_setup_device_data(struct device *dev) ...@@ -100,6 +102,7 @@ int msi_setup_device_data(struct device *dev)
if (!md) if (!md)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&md->list);
dev->msi.data = md; dev->msi.data = md;
devres_add(dev, md); devres_add(dev, md);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment