On Tuesday 23 March 2010, Jiri Slaby wrote: > From: Jiri Slaby <jirislaby@xxxxxxxxx> > > Remove support of reads with offset. This means snapshot_read/write_next > now does not accept count parameter. > > /dev/snapshot handler is converted to simple_read_from_buffer/simple_write_to_buffer. Makes sense. One coding style comment, though. > Signed-off-by: Jiri Slaby <jslaby@xxxxxxx> > Cc: Nigel Cunningham <ncunningham@xxxxxxxxxxx> > Cc: "Rafael J. Wysocki" <rjw@xxxxxxx> > --- > kernel/power/power.h | 18 +----- > kernel/power/snapshot.c | 145 ++++++++++++++++++----------------------------- > kernel/power/swap.c | 8 +- > kernel/power/user.c | 39 ++++++++----- > 4 files changed, 88 insertions(+), 122 deletions(-) > ... > @@ -159,13 +160,17 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf, > res = -ENODATA; > goto Unlock; > } > - res = snapshot_read_next(&data->handle, count); > - if (res > 0) { > - if (copy_to_user(buf, data_of(data->handle), res)) > - res = -EFAULT; > - else > - *offp = data->handle.offset; > - } > + if (!pg_offp) { /* on page boundary? */ > + res = snapshot_read_next(&data->handle); > + if (res <= 0) > + goto Unlock; > + } else > + res = PAGE_SIZE - pg_offp; The official kernel coding style is to put single instructions under if/else like this in braces if the other branch of the if/else is multiline (and therefore naturally in braces). So please do: + if (!pg_offp) { /* on page boundary? */ + res = snapshot_read_next(&data->handle); + if (res <= 0) + goto Unlock; + } else { + res = PAGE_SIZE - pg_offp; + } and analogously wherever applicable. Thanks, Rafael _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm