History

device: Add device:: Msi_data pointer and struct msi_device_data

Create struct msi_device_data and add a pointer of that type to struct dev_msi_info, which is part of struct device. Provide an allocator function which can be invoked from the MSI interrupt allocation code pathes. Add a properties field to the data structure as a first member so the allocation size is not zero bytes. The field will be uses later on.

Thomas Gleixner committed 4 years ago

Commit 013bd8e1 parent 34fff623 files · +55 −0Browse files

Showing the changes to include (2 of 3 files). Show all

Unified · Split

2 files
  1. include/linux/device.h +5 −0
  2. include/linux/msi.h +18 −0
include/linux/device.h+5−0
@@ -45,6 +45,7 @@ struct iommu_ops; · 44 unmodified lines
4545 struct iommu_group;
4646 struct dev_pin_info;
4747 struct dev_iommu;
48+struct msi_device_data;
4849
4950 /**
5051 * struct subsys_interface - interfaces to device functions
@@ -374,11 +375,15 @@ struct dev_links_info { · 323 unmodified lines
374375 /**
375376 * struct dev_msi_info - Device data related to MSI
376377 * @domain: The MSI interrupt domain associated to the device
378+ * @data: Pointer to MSI device data
377379 */
378380 struct dev_msi_info {
379381 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
380382 struct irq_domain *domain;
381383 #endif
384+#ifdef CONFIG_GENERIC_MSI_IRQ
385+ struct msi_device_data *data;
386+#endif
382387 };
383388
384389 /**
include/linux/msi.h+18−0
@@ -171,6 +171,16 @@ struct msi_desc { · 170 unmodified lines
171171 };
172172 };
173173
174+/**
175+ * msi_device_data - MSI per device data
176+ * @properties: MSI properties which are interesting to drivers
177+ */
178+struct msi_device_data {
179+ unsigned long properties;
180+};
181+
182+int msi_setup_device_data(struct device *dev);
183+
174184 /* Helpers to hide struct msi_desc implementation details */
175185 #define msi_desc_to_dev(desc) ((desc)->dev)
176186 #define dev_to_msi_list(dev) (&(dev)->msi_list)
@@ -233,10 +243,16 @@ void pci_msi_mask_irq(struct irq_data *data); · 56 unmodified lines
233243 void pci_msi_unmask_irq(struct irq_data *data);
234244
235245 #ifdef CONFIG_SYSFS
246+int msi_device_populate_sysfs(struct device *dev);
247+void msi_device_destroy_sysfs(struct device *dev);
248+
236249 const struct attribute_group **msi_populate_sysfs(struct device *dev);
237250 void msi_destroy_sysfs(struct device *dev,
238251 const struct attribute_group **msi_irq_groups);
239252 #else
253+static inline int msi_device_populate_sysfs(struct device *dev) { return 0; }
254+static inline void msi_device_destroy_sysfs(struct device *dev) { }
255+
240256 static inline const struct attribute_group **msi_populate_sysfs(struct device *dev)
241257 {
242258 return NULL;
@@ -384,6 +400,8 @@ enum { · 141 unmodified lines
384400 MSI_FLAG_MUST_REACTIVATE = (1 << 5),
385401 /* Is level-triggered capable, using two messages */
386402 MSI_FLAG_LEVEL_CAPABLE = (1 << 6),
403+ /* Populate sysfs on alloc() and destroy it on free() */
404+ MSI_FLAG_DEV_SYSFS = (1 << 7),
387405 };
388406
389407 int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t