@@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t
207
207
/* read conf file -> output card info data */
208
208
/*******************************************/
209
209
static ssize_t
210
- hysdn_conf_read (struct file * file , char __user * buf , size_t count , loff_t * off )
210
+ hysdn_conf_read (struct file * file , char __user * buf , size_t count , loff_t * off )
211
211
{
212
212
char * cp ;
213
- int i ;
214
213
215
- if (file -> f_mode & FMODE_READ ) {
216
- if (!(cp = file -> private_data ))
217
- return (- EFAULT ); /* should never happen */
218
- i = strlen (cp ); /* get total string length */
219
- if (* off < i ) {
220
- /* still bytes to transfer */
221
- cp += * off ; /* point to desired data offset */
222
- i -= * off ; /* remaining length */
223
- if (i > count )
224
- i = count ; /* limit length to transfer */
225
- if (copy_to_user (buf , cp , i ))
226
- return (- EFAULT ); /* copy error */
227
- * off += i ; /* adjust offset */
228
- } else
229
- return (0 );
230
- } else
231
- return (- EPERM ); /* no permission to read */
232
-
233
- return (i );
214
+ if (!(file -> f_mode & FMODE_READ ))
215
+ return - EPERM ; /* no permission to read */
216
+
217
+ if (!(cp = file -> private_data ))
218
+ return - EFAULT ; /* should never happen */
219
+
220
+ return simple_read_from_buffer (buf , count , off , cp , strlen (cp ));
234
221
} /* hysdn_conf_read */
235
222
236
223
/******************/
0 commit comments