@@ -186,23 +186,15 @@ struct mtd_info {
186186 size_t * retlen , u_char * buf );
187187 int (* write ) (struct mtd_info * mtd , loff_t to , size_t len ,
188188 size_t * retlen , const u_char * buf );
189+ int (* panic_write ) (struct mtd_info * mtd , loff_t to , size_t len ,
190+ size_t * retlen , const u_char * buf );
189191
190192 /* Backing device capabilities for this device
191193 * - provides mmap capabilities
192194 */
193195 struct backing_dev_info * backing_dev_info ;
194196
195197
196-
197- /* In blackbox flight recorder like scenarios we want to make successful
198- writes in interrupt context. panic_write() is only intended to be
199- called when its known the kernel is about to panic and we need the
200- write to succeed. Since the kernel is not going to be running for much
201- longer, this function can break locks and delay to ensure the write
202- succeeds (but not sleep). */
203-
204- int (* panic_write ) (struct mtd_info * mtd , loff_t to , size_t len , size_t * retlen , const u_char * buf );
205-
206198 int (* read_oob ) (struct mtd_info * mtd , loff_t from ,
207199 struct mtd_oob_ops * ops );
208200 int (* write_oob ) (struct mtd_info * mtd , loff_t to ,
@@ -315,6 +307,19 @@ static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
315307 return mtd -> write (mtd , to , len , retlen , buf );
316308}
317309
310+ /*
311+ * In blackbox flight recorder like scenarios we want to make successful writes
312+ * in interrupt context. panic_write() is only intended to be called when its
313+ * known the kernel is about to panic and we need the write to succeed. Since
314+ * the kernel is not going to be running for much longer, this function can
315+ * break locks and delay to ensure the write succeeds (but not sleep).
316+ */
317+ static inline int mtd_panic_write (struct mtd_info * mtd , loff_t to , size_t len ,
318+ size_t * retlen , const u_char * buf )
319+ {
320+ return mtd -> panic_write (mtd , to , len , retlen , buf );
321+ }
322+
318323static inline struct mtd_info * dev_to_mtd (struct device * dev )
319324{
320325 return dev ? dev_get_drvdata (dev ) : NULL ;
0 commit comments