mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	hsweeten@visionengravers.com, gregkh@linuxfoundation.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: comedi: Use offset_in_page macro
Date: Tue, 4 Jul 2017 10:36:48 +0100	[thread overview]
Message-ID: <2fd3d16e-d2ec-2fde-b4c1-fc32e659e048@mev.co.uk> (raw)
In-Reply-To: <20170703231334.GA2576@amitoj-Inspiron-3542>

On 04/07/17 00:13, Amitoj Kaur Chawla wrote:
> Use offset_in_page macro instead of (var & ~PAGE_MASK)
>
> The Coccinelle semantic patch used to make this change is as follows:
> // <smpl>
> @@
> unsigned long p;
> @@
> - p & ~PAGE_MASK
> + offset_in_page(p)
> // </smpl>
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
>  drivers/staging/comedi/comedi_buf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
> index 8e9b30b..b455ff6 100644
> --- a/drivers/staging/comedi/comedi_buf.c
> +++ b/drivers/staging/comedi/comedi_buf.c
> @@ -165,7 +165,7 @@ int comedi_buf_map_put(struct comedi_buf_map *bm)
>  int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset,
>  			  void *buf, int len, int write)
>  {
> -	unsigned int pgoff = offset & ~PAGE_MASK;
> +	unsigned int pgoff = offset_in_page(offset);
>  	unsigned long pg = offset >> PAGE_SHIFT;
>  	int done = 0;
>
>

Seems reasonable, thanks.  Being picky, I'd prefer it if the line 
`#include <linux/mm.h>` was added, since that is where the 
`offset_in_page` macro is defined.  But it doesn't matter that much as 
the "mm.h" header file gets included indirectly, and there are plenty of 
examples where `offset_in_page` is used without including <linux/mm.h> 
directly.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

      reply	other threads:[~2017-07-04  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 23:13 Amitoj Kaur Chawla
2017-07-04  9:36 ` Ian Abbott [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fd3d16e-d2ec-2fde-b4c1-fc32e659e048@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=amitoj1606@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®