When opening a legacy rawmidi device for a UMP, it may re-open an existing rawmidi device for appending to a substream, leading to a lockdep warning due to rmidi->open_mutex taken twice -- but the rawmidi devices are completely individual, hence it's a false-positive. For avoiding the warning, modify the helper to open a rawmidi instance with a proper locking subclass from the UMP legacy open. Unfortunately, there is no good way to achieve it with guard(), so reverted to the manual mutex calls again.
Showing the changes to include (1 of 3 files). Show all
Unified · Split
| @@ -176,8 +176,9 @@ int snd_rawmidi_proceed(struct snd_rawmidi_substream *substream); · 175 unmodified lines | |||
| 176 | /* main midi functions */ | 176 | /* main midi functions */ |
| 177 | 177 | ||
| 178 | int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info); | 178 | int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info); |
| 179 | int snd_rawmidi_kernel_open(struct snd_rawmidi *rmidi, int subdevice, | 179 | int snd_rawmidi_kernel_open_nested(struct snd_rawmidi *rmidi, int subdevice, |
| 180 | int mode, struct snd_rawmidi_file *rfile); | 180 | int mode, struct snd_rawmidi_file *rfile, |
| 181 | int depth); | ||
| 181 | int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile); | 182 | int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile); |
| 182 | int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, | 183 | int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, |
| 183 | struct snd_rawmidi_params *params); | 184 | struct snd_rawmidi_params *params); |
| @@ -191,6 +192,15 @@ long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream, · 7 unmodified lines | |||
| 191 | long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream, | 192 | long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream, |
| 192 | const unsigned char *buf, long count); | 193 | const unsigned char *buf, long count); |
| 193 | 194 | ||
| 195 | /* non-nested version */ | ||
| 196 | static inline int snd_rawmidi_kernel_open(struct snd_rawmidi *rmidi, | ||
| 197 | int subdevice, | ||
| 198 | int mode, | ||
| 199 | struct snd_rawmidi_file *rfile) | ||
| 200 | { | ||
| 201 | return snd_rawmidi_kernel_open_nested(rmidi, subdevice, mode, rfile, 0); | ||
| 202 | } | ||
| 203 | |||
| 194 | /* set up the tied devices */ | 204 | /* set up the tied devices */ |
| 195 | static inline void snd_rawmidi_tie_devices(struct snd_rawmidi *r1, | 205 | static inline void snd_rawmidi_tie_devices(struct snd_rawmidi *r1, |
| 196 | struct snd_rawmidi *r2) | 206 | struct snd_rawmidi *r2) |