@@ -122,7 +122,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
122122 memcpy (dst , s1 + s1_start , l1_cpy );
123123 memcpy (dst + l1_cpy , s2 + s2_start , l2_cpy );
124124
125- ret = psinfo -> write (PSTORE_TYPE_DMESG , & id , part ,
125+ ret = psinfo -> write (PSTORE_TYPE_DMESG , reason , & id , part ,
126126 hsize + l1_cpy + l2_cpy , psinfo );
127127 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted ())
128128 pstore_new_entry = 1 ;
@@ -207,8 +207,7 @@ void pstore_get_records(int quiet)
207207 return ;
208208
209209 mutex_lock (& psi -> read_mutex );
210- rc = psi -> open (psi );
211- if (rc )
210+ if (psi -> open && psi -> open (psi ))
212211 goto out ;
213212
214213 while ((size = psi -> read (& id , & type , & time , & buf , psi )) > 0 ) {
@@ -219,7 +218,8 @@ void pstore_get_records(int quiet)
219218 if (rc && (rc != - EEXIST || !quiet ))
220219 failed ++ ;
221220 }
222- psi -> close (psi );
221+ if (psi -> close )
222+ psi -> close (psi );
223223out :
224224 mutex_unlock (& psi -> read_mutex );
225225
@@ -243,33 +243,5 @@ static void pstore_timefunc(unsigned long dummy)
243243 mod_timer (& pstore_timer , jiffies + PSTORE_INTERVAL );
244244}
245245
246- /*
247- * Call platform driver to write a record to the
248- * persistent store.
249- */
250- int pstore_write (enum pstore_type_id type , char * buf , size_t size )
251- {
252- u64 id ;
253- int ret ;
254- unsigned long flags ;
255-
256- if (!psinfo )
257- return - ENODEV ;
258-
259- if (size > psinfo -> bufsize )
260- return - EFBIG ;
261-
262- spin_lock_irqsave (& psinfo -> buf_lock , flags );
263- memcpy (psinfo -> buf , buf , size );
264- ret = psinfo -> write (type , & id , 0 , size , psinfo );
265- if (ret == 0 && pstore_is_mounted ())
266- pstore_mkfile (PSTORE_TYPE_DMESG , psinfo -> name , id , psinfo -> buf ,
267- size , CURRENT_TIME , psinfo );
268- spin_unlock_irqrestore (& psinfo -> buf_lock , flags );
269-
270- return 0 ;
271- }
272- EXPORT_SYMBOL_GPL (pstore_write );
273-
274246module_param (backend , charp , 0444 );
275247MODULE_PARM_DESC (backend , "Pstore backend to use" );
0 commit comments