Skip to content

Commit 125282c

Browse files
committed
genirq/msi: Move descriptor list to struct msi_device_data
It's only required when MSI is in use. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Nishanth Menon <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1900c96 commit 125282c

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

drivers/base/core.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,9 +2874,6 @@ void device_initialize(struct device *dev)
28742874
INIT_LIST_HEAD(&dev->devres_head);
28752875
device_pm_init(dev);
28762876
set_dev_node(dev, NUMA_NO_NODE);
2877-
#ifdef CONFIG_GENERIC_MSI_IRQ
2878-
INIT_LIST_HEAD(&dev->msi_list);
2879-
#endif
28802877
INIT_LIST_HEAD(&dev->links.consumers);
28812878
INIT_LIST_HEAD(&dev->links.suppliers);
28822879
INIT_LIST_HEAD(&dev->links.defer_sync);

include/linux/device.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ struct dev_msi_info {
423423
* @pins: For device pin management.
424424
* See Documentation/driver-api/pin-control.rst for details.
425425
* @msi: MSI related data
426-
* @msi_list: Hosts MSI descriptors
427426
* @numa_node: NUMA node this device is close to.
428427
* @dma_ops: DMA mapping operations for this device.
429428
* @dma_mask: Dma mask (if dma'ble device).
@@ -519,9 +518,6 @@ struct device {
519518
struct dev_pin_info *pins;
520519
#endif
521520
struct dev_msi_info msi;
522-
#ifdef CONFIG_GENERIC_MSI_IRQ
523-
struct list_head msi_list;
524-
#endif
525521
#ifdef CONFIG_DMA_OPS
526522
const struct dma_map_ops *dma_ops;
527523
#endif

include/linux/msi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,13 @@ struct msi_desc {
144144
* @properties: MSI properties which are interesting to drivers
145145
* @attrs: Pointer to the sysfs attribute group
146146
* @platform_data: Platform-MSI specific data
147+
* @list: List of MSI descriptors associated to the device
147148
*/
148149
struct msi_device_data {
149150
unsigned long properties;
150151
const struct attribute_group **attrs;
151152
struct platform_msi_priv_data *platform_data;
153+
struct list_head list;
152154
};
153155

154156
int msi_setup_device_data(struct device *dev);
@@ -157,7 +159,7 @@ unsigned int msi_get_virq(struct device *dev, unsigned int index);
157159

158160
/* Helpers to hide struct msi_desc implementation details */
159161
#define msi_desc_to_dev(desc) ((desc)->dev)
160-
#define dev_to_msi_list(dev) (&(dev)->msi_list)
162+
#define dev_to_msi_list(dev) (&(dev)->msi.data->list)
161163
#define first_msi_entry(dev) \
162164
list_first_entry(dev_to_msi_list((dev)), struct msi_desc, list)
163165
#define for_each_msi_entry(desc, dev) \

kernel/irq/msi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ EXPORT_SYMBOL_GPL(get_cached_msi_msg);
7575

7676
static void msi_device_data_release(struct device *dev, void *res)
7777
{
78-
WARN_ON_ONCE(!list_empty(&dev->msi_list));
78+
struct msi_device_data *md = res;
79+
80+
WARN_ON_ONCE(!list_empty(&md->list));
7981
dev->msi.data = NULL;
8082
}
8183

@@ -100,6 +102,7 @@ int msi_setup_device_data(struct device *dev)
100102
if (!md)
101103
return -ENOMEM;
102104

105+
INIT_LIST_HEAD(&md->list);
103106
dev->msi.data = md;
104107
devres_add(dev, md);
105108
return 0;

0 commit comments

Comments
 (0)