Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp46331ybz; Tue, 21 Apr 2020 04:27:43 -0700 (PDT) X-Google-Smtp-Source: APiQypJ+rUmPM5SehYEtDMXKrhisG+xxgzfJIR76Fy+Syh9k5bdP1yfqoGIqX6cs8Q2u31oEL6CW X-Received: by 2002:a17:906:5918:: with SMTP id h24mr20942359ejq.210.1587468463614; Tue, 21 Apr 2020 04:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587468463; cv=none; d=google.com; s=arc-20160816; b=fb8+GUSR6R4KvnTmBuilEJVVV3sq+hHnsaHV5OVXUtCjTY3rRnDf1By2BpVdBHqwIh +HIdig2XY+pLKfOevfSIb1wXK/LcylkFAXx5P3M12z2KTXlJNYZZNyfy3FmMv7LngN7f qDXbAJKRvBVolUZ7FyltiM6RtTlKm5ubNocCx+MtOrtPYRCwRsOd8IT9T7U25kjba+Bc 5SrDAhUs1LGSBSDTH+34pbspP8vsJwJ6FlZsAv41pjYaCno+kX0Begon8yK4fFKiaBwA EVgGd3TICZ7lr2R9qbYNejTrxow8czx8wHZtke4ZjCseVFF68g2eWxW8J4SWM5q9ERf4 hhqQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=/nyZHnIln5SMvHTDYDPunqthnn+W6+8Xnre7urXhwVU=; b=0lsts/q1JpDyFk69IGGjWXPdsf7wQcvW7U+V1IKsh3a6kNyeu97Cvu21Th1g7MnKy+ 3lyocvWkFy8t/X7JYljA3CELyQ4rQ6bEhdq+2fyYxsWFm0YZz6Mx3FFJkFGQjBeWbRMv i2JCA1cwZ3HfIEHYAYvGCEb6S5nbVNE/qzzmsMtrs9yvPGQ970KmzmuzcytUg5d4mXR1 keWb1bRQF9Q+Ouczbyhvx4Xl3jL9vY3VecmYVjTVNydBbS40PhnxdH0OoMTU/y0Q6kbm 6+7z/99lNGp86bj/7ZgUuzHKZKNdbtuEk2M3uZFAHcMAjEqJQMTDFMsviAVEJx/I7+tl YbAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mOG4tZNB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g15si1323450eds.159.2020.04.21.04.27.20; Tue, 21 Apr 2020 04:27:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mOG4tZNB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728803AbgDULYj (ORCPT + 99 others); Tue, 21 Apr 2020 07:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728621AbgDULYh (ORCPT ); Tue, 21 Apr 2020 07:24:37 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E6CC061A10; Tue, 21 Apr 2020 04:24:37 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id p25so6456936pfn.11; Tue, 21 Apr 2020 04:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/nyZHnIln5SMvHTDYDPunqthnn+W6+8Xnre7urXhwVU=; b=mOG4tZNBITuLYVAvk5EmokI/PBxfJ81UacvSZUJMUBYH+Nqx7/qNaWaep6LO11k/uo kobKQyu9ZvqiFH481jOR6kBhGVLqmSa3IkVbagWWdfFoNhANdRFNtJl85kv224/61Lj7 HYYk5cSKPGNRUvcQl3ueKj0FWzNouX89mqbBwFEr8+GB7ktaafmZOAngOLHwcSHldWeJ mxrH/M3UGyADMvu4t/bkX+9OLJPAUMpzbmK+dRmW/PGWa77/ihr2YPN/NaSPm/urCC5U 1z0vNCBS+ErWvgFUlJhnk/o7rSbveHP5rDWRLd6V9dy26JPmtbiVS3LnY3s+CfeTP2VG K9sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/nyZHnIln5SMvHTDYDPunqthnn+W6+8Xnre7urXhwVU=; b=Mcfk2dz30EDaFeXp3oUzfrRjpOVjUa2R4Kl3UknYdunv4HY2F7hSKntfyhJS/vuqHi yUHo624IfqVB1sWj1/NSz85j/hbNZjxMI2WO2JntqJJ5C6RJ2KxODObZS/Dh6Uymqnea DXrAUWqLudHn6qwZTKUMz8qhxkPOab1mDf2vDh8FEXn9s7IOs2NnsSU550RCg+0mxfz5 91qgEdEeEdqEIcUaQiOx/LsdkTV1MB7ZR2SA3rmGWLr4rTQNHnmgstql6dB0fYGl9yfC fLMflons3jNStDrhuWmOsRTf4iKznozLYHjHN2pzUxKKkcL50QXcKdNTetgTAS29vkI/ DChA== X-Gm-Message-State: AGi0PubnyaEGRQrXXMNyeWl64yugmCChlZ8TowKxoAUnL3hp3XSEVnsG qIRSlbUXm5P2r9GvPVYmtBpOKeLtW3LLpYKNd4s= X-Received: by 2002:a63:1d4:: with SMTP id 203mr20189317pgb.74.1587468276844; Tue, 21 Apr 2020 04:24:36 -0700 (PDT) MIME-Version: 1.0 References: <20200421075532.19192-1-m.othacehe@gmail.com> <20200421075532.19192-3-m.othacehe@gmail.com> In-Reply-To: <20200421075532.19192-3-m.othacehe@gmail.com> From: Andy Shevchenko Date: Tue, 21 Apr 2020 14:24:30 +0300 Message-ID: Subject: Re: [PATCH v4 2/4] iio: vcnl4000: Add event support for VCNL4010/20. To: Mathieu Othacehe Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , linux-iio , Linux Kernel Mailing List 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 Tue, Apr 21, 2020 at 10:57 AM Mathieu Othacehe wrote: > > The VCNL4010 and VCNL4020 chips are able to raise interrupts on proximity > threshold events. Add support for threshold rising and falling events for > those two chips. Some nitpicks below (up to you and maintainer to address) ... > +static bool vcnl4010_in_periodic_mode(struct vcnl4000_data *data) Since it's boolean I would name it ..._is_in_prediodic_mode(). > { > + int ret; > > + ret = i2c_smbus_read_byte_data(data->client, VCNL4000_COMMAND); > + if (ret < 0) > + return false; > > + return (ret & VCNL4000_SELF_TIMED_EN) > 0; This > 0 for bitmasked values looks slightly strange. And actually if a sign bit is included, potentially wrong. I would rather go without any comparison, or do !!(foo & BAR). > +} ... > +static bool vcnl4010_thr_enabled(struct vcnl4000_data *data) _is_thr_enabled() ? > +{ > + int ret; > + > + ret = i2c_smbus_read_byte_data(data->client, VCNL4010_INT_CTRL); > + if (ret < 0) > + return false; > + > + return (ret & VCNL4010_INT_THR_EN) > 0; Ditto. > +} ... > + ret = devm_request_threaded_irq(&client->dev, client->irq, > + NULL, vcnl4010_irq_thread, > + IRQF_TRIGGER_FALLING | > + IRQF_ONESHOT, Isn't it by default when threaded IRQ is asked with NULL for hw handler? > + "vcnl4010_irq", > + indio_dev); -- With Best Regards, Andy Shevchenko