Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751960AbdGCXNc (ORCPT ); Mon, 3 Jul 2017 19:13:32 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:32961 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbdGCXNa (ORCPT ); Mon, 3 Jul 2017 19:13:30 -0400 Date: Mon, 3 Jul 2017 19:13:34 -0400 From: Amitoj Kaur Chawla To: abbotti@mev.co.uk, hsweeten@visionengravers.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: comedi: Use offset_in_page macro Message-ID: <20170703231334.GA2576@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 910 Lines: 31 Use offset_in_page macro instead of (var & ~PAGE_MASK) The Coccinelle semantic patch used to make this change is as follows: // @@ unsigned long p; @@ - p & ~PAGE_MASK + offset_in_page(p) // Signed-off-by: Amitoj Kaur Chawla --- 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; -- 2.7.4