File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 3
3
#define LINUX_MSI_H
4
4
5
5
#include <linux/cpumask.h>
6
+ #include <linux/mutex.h>
6
7
#include <linux/list.h>
7
8
#include <asm/msi.h>
8
9
@@ -145,17 +146,21 @@ struct msi_desc {
145
146
* @attrs: Pointer to the sysfs attribute group
146
147
* @platform_data: Platform-MSI specific data
147
148
* @list: List of MSI descriptors associated to the device
149
+ * @mutex: Mutex protecting the MSI list
148
150
*/
149
151
struct msi_device_data {
150
152
unsigned long properties ;
151
153
const struct attribute_group * * attrs ;
152
154
struct platform_msi_priv_data * platform_data ;
153
155
struct list_head list ;
156
+ struct mutex mutex ;
154
157
};
155
158
156
159
int msi_setup_device_data (struct device * dev );
157
160
158
161
unsigned int msi_get_virq (struct device * dev , unsigned int index );
162
+ void msi_lock_descs (struct device * dev );
163
+ void msi_unlock_descs (struct device * dev );
159
164
160
165
/* Helpers to hide struct msi_desc implementation details */
161
166
#define msi_desc_to_dev (desc ) ((desc)->dev)
Original file line number Diff line number Diff line change @@ -103,11 +103,32 @@ int msi_setup_device_data(struct device *dev)
103
103
return - ENOMEM ;
104
104
105
105
INIT_LIST_HEAD (& md -> list );
106
+ mutex_init (& md -> mutex );
106
107
dev -> msi .data = md ;
107
108
devres_add (dev , md );
108
109
return 0 ;
109
110
}
110
111
112
+ /**
113
+ * msi_lock_descs - Lock the MSI descriptor storage of a device
114
+ * @dev: Device to operate on
115
+ */
116
+ void msi_lock_descs (struct device * dev )
117
+ {
118
+ mutex_lock (& dev -> msi .data -> mutex );
119
+ }
120
+ EXPORT_SYMBOL_GPL (msi_lock_descs );
121
+
122
+ /**
123
+ * msi_unlock_descs - Unlock the MSI descriptor storage of a device
124
+ * @dev: Device to operate on
125
+ */
126
+ void msi_unlock_descs (struct device * dev )
127
+ {
128
+ mutex_unlock (& dev -> msi .data -> mutex );
129
+ }
130
+ EXPORT_SYMBOL_GPL (msi_unlock_descs );
131
+
111
132
/**
112
133
* msi_get_virq - Return Linux interrupt number of a MSI interrupt
113
134
* @dev: Device to operate on
You can’t perform that action at this time.
0 commit comments