diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-06 08:23:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-06 08:23:39 -0400 |
commit | 68083e05d72d94f347293d8cc0067050ba904bfa (patch) | |
tree | 842e71365bd90866be7add181661a4039d891564 /drivers/isdn/hysdn | |
parent | 7baac8b91f9871ba8cb09af84de4ae1d86d07812 (diff) | |
parent | b7279469d66b55119784b8b9529c99c1955fe747 (diff) |
Merge commit 'v2.6.26-rc9' into cpus4096
Diffstat (limited to 'drivers/isdn/hysdn')
-rw-r--r-- | drivers/isdn/hysdn/hycapi.c | 6 | ||||
-rw-r--r-- | drivers/isdn/hysdn/hysdn_procconf.c | 29 |
2 files changed, 11 insertions, 24 deletions
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index d3999a8e9f88..53f6ad1235db 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -462,11 +462,11 @@ static int hycapi_read_proc(char *page, char **start, off_t off, | |||
462 | default: s = "???"; break; | 462 | default: s = "???"; break; |
463 | } | 463 | } |
464 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 464 | len += sprintf(page+len, "%-16s %s\n", "type", s); |
465 | if ((s = cinfo->version[VER_DRIVER]) != 0) | 465 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); |
467 | if ((s = cinfo->version[VER_CARDTYPE]) != 0) | 467 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); |
469 | if ((s = cinfo->version[VER_SERIAL]) != 0) | 469 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); |
471 | 471 | ||
472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); | 472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 15906d005b05..484299b031f8 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t | |||
207 | /* read conf file -> output card info data */ | 207 | /* read conf file -> output card info data */ |
208 | /*******************************************/ | 208 | /*******************************************/ |
209 | static ssize_t | 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 | char *cp; | 212 | char *cp; |
213 | int i; | ||
214 | 213 | ||
215 | if (file->f_mode & FMODE_READ) { | 214 | if (!(file->f_mode & FMODE_READ)) |
216 | if (!(cp = file->private_data)) | 215 | return -EPERM; /* no permission to read */ |
217 | return (-EFAULT); /* should never happen */ | 216 | |
218 | i = strlen(cp); /* get total string length */ | 217 | if (!(cp = file->private_data)) |
219 | if (*off < i) { | 218 | return -EFAULT; /* should never happen */ |
220 | /* still bytes to transfer */ | 219 | |
221 | cp += *off; /* point to desired data offset */ | 220 | return simple_read_from_buffer(buf, count, off, cp, strlen(cp)); |
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); | ||
234 | } /* hysdn_conf_read */ | 221 | } /* hysdn_conf_read */ |
235 | 222 | ||
236 | /******************/ | 223 | /******************/ |