Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162596AbbKTQjr (ORCPT ); Fri, 20 Nov 2015 11:39:47 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:54781 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759599AbbKTQjp (ORCPT ); Fri, 20 Nov 2015 11:39:45 -0500 From: Arnd Bergmann To: linux-scsi@vger.kernel.org Cc: jbottomley@odin.com, martin.petersen@oracle.com, nico@fluxnic.net, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] scsi: use sector_div instead of do_div Date: Fri, 20 Nov 2015 17:38:28 +0100 Message-ID: <24882658.08y4bWL6tn@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:WEtSqH3Cf2PkOZYt3cBTOEavICJ/3K2LRdqenocnhltQ5ko5Ek8 u2PVI0DluKRUYNdbbqgsXxcKmGabtQMO3uH2tKR8m71U5rXV3xAuUyBLXc3N8SGlQ4BjCfG aexB19ddnfnvohdt+SRx5l63WN9K3mjYWFwpVW3qFn8/o6ZRe2mapqMKW/iEGYijUd3TTIN We3CPh/HDnjk7ZWlHmZzw== X-UI-Out-Filterresults: notjunk:1;V01:K0:MsSK4ajEGlc=:cpM8NC4vAQILTxWT68VA8l 1xc9t1p3ml5zCJOahFZDaki7A0S0hN/5NSQD/Sk5icqvxIczLB4fmWQnEUEOq0QjZLyb78vSv VJvNgRoMMwF1m6fCzrqrRjCXSvGSFvkcAYGnIIUPJz6dO3JVHu8/HpZXI3c7DSKhRXyTVcmsA phtP3m7gDvw+B/VC66CfDQ6IH+u4/LXWksTASAYZCCZUqn7FErje+R+PSz7gIp8WxN0WVRlQF yC+PJtr4vGgdmPKg4mYjLTAjHMS6p7O88JuDoFfxmELC/rLLXCKL4vBLYQvdZws+uabOnvljM BhQ1rMUeQAj/JdvvC9px2hmRUinWXfc0Cy7OFSN2hiT8nNnsqQNP9UNAtCCVKrSALhJP8pqhl 4aHz7WywwrfH2AXi4Z0lw19AQ4I2L8/LDDpvGX3WYBlf0v8kfvl7Gr+4o6r35Dnjg7Vk8z6TY NNNXohUsG8xoSK7CZpllfX3qPb45TwjeHXp6wFAtrl7v8u2UZ8pWIT9xXYwHeM6GnwCA2rKDq sk9Nkg2flJqFGXqcbhkc3uYNk0N+nog3IbiGg2stA/BrXP+XyYGE70zn5f/A3HsAy0QiGu5pY BPwjXEybK7S5poxP5jCXUmkOI5jSOKVgdOi5JRyi0qyWPIuLUPQpwAAdFpb7ScLovZd6B3LnW eePk7eYxiLVTOnuLGxndVQWfeIjfY7X9FcTsjSwZj6TdbF2ACoN7rCNUyd5OXf2sU+R9JlM0T 50EtKX6ldSrAAI8N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1496 Lines: 43 do_div is the wrong way to divide a sector_t, as it is less efficient when sector_t is 32-bit wide. With the upcoming do_div optimizations, the kernel starts warning about this: drivers/scsi/scsi_debug.c: In function 'dif_store': include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast This changes the code to use sector_div instead, which always produces optimal code. Signed-off-by: Arnd Bergmann --- Found on the ARM randconfig build today, after I merged Nico's patches for linux-next diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index dfcc45bb03b1..ec622ba9864a 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -678,7 +678,7 @@ static void *fake_store(unsigned long long lba) static struct sd_dif_tuple *dif_store(sector_t sector) { - sector = do_div(sector, sdebug_store_sectors); + sector = sector_div(sector, sdebug_store_sectors); return dif_storep + sector; } @@ -2780,7 +2780,7 @@ static unsigned long lba_to_map_index(sector_t lba) lba += scsi_debug_unmap_granularity - scsi_debug_unmap_alignment; } - do_div(lba, scsi_debug_unmap_granularity); + sector_div(lba, scsi_debug_unmap_granularity); return lba; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/