Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4325233imm; Mon, 18 Jun 2018 12:59:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMiSEksZE5smITraj6mCghkM2m+YadYoqlD3pnUe4eBhaLuictD7tVy6BFPY6cfwt2mtp+ X-Received: by 2002:a62:f807:: with SMTP id d7-v6mr14979680pfh.213.1529351960059; Mon, 18 Jun 2018 12:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529351960; cv=none; d=google.com; s=arc-20160816; b=M96xOu1N2IFFt+q8xqmVhw6PVMPTqfZ/xuBHfSe1UQqNbCuMYSy0S0z5Clbs3ir4/T UsFgYEjFBPQsWsyJCP3UVW8nMs/gXmzmLHPhikO2+cH+Vi/Deu5goJtxilOD3ZHucoKg wxGw2x88IcbscdOClPqu1+i+TS84fgIGc4j5ZTzSIu4Yww6lco0zD9Kwz1na0A6KeH8w W6ssOvkNKM9k29sw+ANDGd2VlWsTmlXp/Nd1SyksZAUMuywAYSFDxWqgbd3jt0bYilgp wt2Q17LDi7IvfPtxUaI39FUbcxYT5wPnKYZisqHegmBfPaE3FxAjfxK+ndrrcMrMTRLH ryUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Pi9gENfzOZQEObvEnMp1V3mn1A4hE5NRpwJSebd8olE=; b=lNkmy4CLQc2Elcye1plIrwfdYHB2kk01Z/FRFPZBGQDGPXJGorVi9mFE1Tojd1+809 Mr4BEqRFAO4RFZfNiUi5q5w7dNLXNgQKjFWLqRhyTCJjhMAEpRVHKtH29suBwRnp9HOy 4DXm5/vhykY6BN9bRadu5rmumtXQCkbvCFYiRH8e53nEhvxNV8ANrR2XcvjyqFbxxG8l mtUyVyLoA5TQW9fB7qC79qlB05wyTJKOVrBAmPpWJT9B+vXJlyWNaAmMH5/65O+bHZXt 3RtqmgOtVU29dPs7eM37AymC95CmZWclj8zFwS4TZxvm0be+Hwiywasyk2T/O7IqOsfr xgGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IxQjoplg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g33-v6si16384843plb.297.2018.06.18.12.59.05; Mon, 18 Jun 2018 12:59:20 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IxQjoplg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755387AbeFRT5C (ORCPT + 99 others); Mon, 18 Jun 2018 15:57:02 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:36476 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755344AbeFRT47 (ORCPT ); Mon, 18 Jun 2018 15:56:59 -0400 Received: by mail-ua0-f195.google.com with SMTP id c23-v6so11504664uan.3; Mon, 18 Jun 2018 12:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Pi9gENfzOZQEObvEnMp1V3mn1A4hE5NRpwJSebd8olE=; b=IxQjoplg6RFSPBMbQ20agJdk0slOcE0r84VMxkptp0ElWVZ1XKMVUOex/kKUrWgp3i 4R4GkMZD+VittMd3FIEFTDAa31PjbYof5xHzDk55/z9STeCHRXqpM0v0Ys/cUg9mFfIs AY1zztz1ez4+0cA/GW1YfsTjScz3I0T5gHKDcPekJRf2drrS2Qbx3VFZcG+fmL5hIwop DAKFRA88pIW3NpBdtE5ItyeYiCAiokWFfpOrY4Mf6zB25NkHyVXG2m6s2glGA9N9INSg fiObhRA/egrG1s+YMJ1nmNRTwetbpOJ/jRyXObM5ezyIrT/C2CvIneGARiIVzuVe4fTc 5M0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Pi9gENfzOZQEObvEnMp1V3mn1A4hE5NRpwJSebd8olE=; b=h9YxQ8PQVXH0BIjyDxIPPQs9jGV/XGqTKGBFtX4ighB2GugFdwO+lMbUd7CmO1n7/C m7lGbKi6Zs8T+AthkImCfepfWOXtjFzt5/dQoBBTnlKjuaUJiO8YH46gYxtnK/idahL5 bTsZuR5RgH1zBYu4V46ifxLgrMiq/vVfeU8z/GKzOwBaJHqtdEnU2KI/kDe4LInK9NXa xlC/ReX2sMXAKvdeNCbfo07+AQ9MDWw3JPYN4ScPSJVMg5K55NvQEma+I5Z0qnpsBUsM a71h0gPdkWPRoNbeHozMazBr6758lsCHbcSXhMqsPvSOkdHHEs15qHF4QZeaV0+CGVr9 yC4A== X-Gm-Message-State: APt69E1AswnmUN/ngclbHOY2CZUcDRaafZOltgXEPBmr4qB51sT2Y8kX QUoW1xEY6mSvPzqMIm9Wvhua5chsIaKfJ6CEDBE= X-Received: by 2002:ab0:1446:: with SMTP id c6-v6mr8613438uae.12.1529351818518; Mon, 18 Jun 2018 12:56:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:8b02:0:0:0:0:0 with HTTP; Mon, 18 Jun 2018 12:56:57 -0700 (PDT) In-Reply-To: <780cba4e119110f2d2a81e237874592cff4d7868.camel@perches.com> References: <20180615132017.23889-1-andriy.shevchenko@linux.intel.com> <20180615132017.23889-6-andriy.shevchenko@linux.intel.com> <20180615214231.GA371@yury-thinkpad> <0a3d86d7746792a2f848cef386941fc182653515.camel@perches.com> <8cfbdf809f531f8aa315fe1679c3273858038f41.camel@linux.intel.com> <780cba4e119110f2d2a81e237874592cff4d7868.camel@perches.com> From: Andy Shevchenko Date: Mon, 18 Jun 2018 22:56:57 +0300 Message-ID: Subject: Re: [PATCH v2 5/5] Input: evdev - Switch to bitmap_zalloc() To: Joe Perches Cc: Andy Shevchenko , Yury Norov , agk@redhat.com, Mike Snitzer , dm-devel@redhat.com, shli@kernel.org, linux-raid@vger.kernel.org, Dmitry Torokhov , linux-input , Andrew Morton , Linux Kernel Mailing List , Mika Westerberg Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 6:49 PM, Joe Perches wrote: > On Mon, 2018-06-18 at 15:02 +0300, Andy Shevchenko wrote: >> On Sat, 2018-06-16 at 12:16 -0700, Joe Perches wrote: >> > On Sat, 2018-06-16 at 21:45 +0300, Andy Shevchenko wrote: >> > > On Sat, Jun 16, 2018 at 12:46 AM Yury Norov > > > om> wrote: >> > > > On Fri, Jun 15, 2018 at 04:20:17PM +0300, Andy Shevchenko wrote: >> > > > > Switch to bitmap_zalloc() to show clearly what we are >> > > > > allocating. >> > > > > Besides that it returns pointer of bitmap type instead of opaque >> > > > > void *. >> > > >> > > >> > > > > + mem = bitmap_alloc(maxbit, GFP_KERNEL); >> > > > > if (!mem) >> > > > > return -ENOMEM; >> > > > >> > > > But in commit message you say you switch to bitmap_zalloc(). IIUC >> > > > bitmap_alloc() is OK here. But could you please update comment to >> > > > avoid confusing. >> > > >> > > There are two places, one with alloc, another with zalloc. >> > > I will clarify this in commit message of next version. >> > > >> > > > > + mask = bitmap_zalloc(cnt, GFP_KERNEL); >> > > > > if (!mask) >> > > > > return -ENOMEM; >> > > > > >> > > > > error = bits_from_user(mask, cnt - 1, codes_size, codes, >> > > > > compat); >> > > > >> > > > If my understanding of bits_from_user() correct, here you can also >> > > > use >> > > > bitmap_alloc(), true? >> > >> > Also it might be useful to have a separate bitmap_from_user >> > to alloc and copy. >> >> Maybe. I didn't check if there are such users except this driver. >> >> Anyway, it's out of scope of the series. > > That seems incorrect as you are introducing alloc/free helpers. > > Perhaps bitmap_dup_user [or some better name] could or should > be one of the helpers. Can you help with estimation how many existing users need this kind of functionality? One of them evdev, which has an open coded variant. Also, pay attention to that fact we have already bitmap_parse_user() and bitmap_parlelist_user() which are called by several users. If the estimation will show something like 3+, it would definitely make sense, otherwise, I wouldn't like spend time on it. -- With Best Regards, Andy Shevchenko