Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp789755imm; Fri, 15 Jun 2018 06:21:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIV2vOAyub8AHAoGkcxldhEvPRTn9gLRd5KGDBrRv6cKPUSnekNqd/wAhm4PpCkb/WlIDrs X-Received: by 2002:a62:f407:: with SMTP id r7-v6mr1939710pff.47.1529068916370; Fri, 15 Jun 2018 06:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529068916; cv=none; d=google.com; s=arc-20160816; b=l4YgWmd0DEvSLHG/G6CIurRMeBTBpHNnItZk9P/si99/H6LCnxa77Ge1QrtjI/FYxN /IWzbmzcvZN8IRoZH4JSVbINInIK4aWO+n+OPlX+kA3PgkGs8yRJ5RafGjdq4H6VUezq aKSZ6hme4leHHFMwOgSVbctlB/ZuSlcFiGeN8VxJvXxkHkCTvpUhl0WhqvO7F2Po3tHu 2nZ4tnsiU3LT3YlbwxF3NtAKMCjbBnn9Bj9Ls8CgtT1RcsFacMUy2CF8oALo9uKjNxdM WbauqOJmiSRF3xrVW/tiiD6jaKMIwVGvIRyFRNqobw1E7oHKevg7B+lgcuCaA3Tp+IHH VaBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9kib5JXdzFV2xFKKZux54piYP03z816VLVR4H+Wbx0A=; b=x9CFqHEhAu04H5ovtF3+0VdVCTJdZWKROaAMX8bDIdCo5Ts5mpd7Vxb+Vdf1p9tq8l VIViktYL6pJXQKdwlXGYRAfnE400Z4EYQFTe2RjgNJuTNzC/aRbD0UL9GRKIJpgjeS3T 9viKdn6d11YJ6d+K/NGggfQmNNMjhEUY8JzCiP707EQ+JBwZE7lpShsMzEh+bf/gOb9M gn6kq6c8AxDI21oyOjkmRCm6gfLAUaYPG/U1H7CnOOXKIDCzx8kQeSoMiLuxU8flE72b l9afvAKAPJOMAxLQxmleIn8tnx3Wf+vJdnCjSRN7UHJZny1NdLBvCjnXq1MhijgdGMwJ imiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68-v6si6503283pga.324.2018.06.15.06.21.41; Fri, 15 Jun 2018 06:21:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965785AbeFONU0 (ORCPT + 99 others); Fri, 15 Jun 2018 09:20:26 -0400 Received: from mga02.intel.com ([134.134.136.20]:65337 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936212AbeFONUV (ORCPT ); Fri, 15 Jun 2018 09:20:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2018 06:20:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,227,1526367600"; d="scan'208";a="232854769" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 15 Jun 2018 06:20:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3AE2F29B; Fri, 15 Jun 2018 16:20:17 +0300 (EEST) From: Andy Shevchenko To: Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Shaohua Li , linux-raid@vger.kernel.org, Dmitry Torokhov , linux-input@vger.kernel.org, Andrew Morton , Yury Norov , linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com Cc: Andy Shevchenko Subject: [PATCH v2 0/5] bitmap: Introduce alloc/free helpers Date: Fri, 15 Jun 2018 16:20:12 +0300 Message-Id: <20180615132017.23889-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A lot of code is using allocation of bitmaps using BITS_PER_LONG() macro and sizeof(unsigned long) operator. The readability suffers because of this. The series introduces three helpers, i.e. bitmap_alloc(), bitmap_zalloc() and bitmap_free(), to make it more cleaner. Patch 1 is a preparatory to avoid namespace collisions between bitmap API and MD bitmap. No functional changes intended. Patch 2 is just orphaned from previous release cycle. Patch 3 introduces new helpers. Patches 4 and 5 is just an example how to use new helpers. Locally I have like dozen of them against different subsystems and drivers. Ideally it would go through Input subsystem, thus, needs an Ack from MD maintainer(s). Since v2: - added namespace fix patch against MD bitmap API - moved functions to lib/bitmap.c to avoid circular dependencies - appended Dmitry's tags Andy Shevchenko (5): md: Avoid namespace collision with bitmap API bitmap: Drop unnecessary 0 check for u32 array operations bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() Input: gpio-keys - Switch to bitmap_zalloc() Input: evdev - Switch to bitmap_zalloc() drivers/input/evdev.c | 16 +- drivers/input/keyboard/gpio_keys.c | 8 +- drivers/md/dm-raid.c | 6 +- drivers/md/md-bitmap.c | 301 +++++++++--------- drivers/md/md-bitmap.h | 46 +-- drivers/md/md-cluster.c | 16 +- drivers/md/md.c | 44 +-- .../md/persistent-data/dm-space-map-common.c | 8 +- drivers/md/raid1.c | 20 +- drivers/md/raid10.c | 26 +- drivers/md/raid5-cache.c | 2 +- drivers/md/raid5.c | 24 +- include/linux/bitmap.h | 8 + lib/bitmap.c | 28 +- 14 files changed, 281 insertions(+), 272 deletions(-) -- 2.17.1