From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13DECC4332D for ; Sat, 21 Mar 2020 18:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDD6A2076E for ; Sat, 21 Mar 2020 18:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbgCUSb7 convert rfc822-to-8bit (ORCPT ); Sat, 21 Mar 2020 14:31:59 -0400 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:60720 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbgCUSb7 (ORCPT ); Sat, 21 Mar 2020 14:31:59 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id DEEA79E77F2; Sat, 21 Mar 2020 18:31:56 +0000 (GMT) Date: Sat, 21 Mar 2020 18:31:54 +0000 From: Jonathan Cameron To: Jean-Baptiste Maneyrol Cc: Andy Shevchenko , Rohit Sarkar , linux-iio Subject: Re: [PATCH] iio: imu: inv_mpu6050: add debugfs register r/w interface Message-ID: <20200321183154.128d8920@archlinux> In-Reply-To: References: <5e730c2f.1c69fb81.9eda3.5c70@mx.google.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Thu, 19 Mar 2020 11:08:44 +0000 Jean-Baptiste Maneyrol wrote: > Hello, > > iio debugfs register interface is quite handy because we can read a single register and write a value. > > regmap debugfs is only a dump of all registers, as far as I know (may have missed something). So this is something Mark has discussed before around regmap and more generally IIRC. The issue is that a write interface does make it somewhat easy to do really nasty things in some drivers that use regmap (to the extent of setting boards on fire etc). For IIO we are much safer - the worst you can do is break the IIO driver. I've never been that fussed myself about the debugfs interfaces as it's easy to hack them in when needed for actual debugging, but have taken the view that if someone has enough of a usecase to want to add them to a particular driver, then it's up to them. Jonathan > > Thanks. > JB > > From: Andy Shevchenko > > Sent: Thursday, March 19, 2020 11:24 > > To: Rohit Sarkar > > Cc: linux-iio ; Linux Kernel Mailing List ; Jonathan Cameron ; Hartmut Knaack ; Lars-Peter Clausen ; Peter Meerwald-Stadler ; > Jean-Baptiste Maneyrol ; Andy Shevchenko ; Linus Walleij > > Subject: Re: [PATCH] iio: imu: inv_mpu6050: add debugfs register r/w interface > >   > > >  CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe. > > > > On Thu, Mar 19, 2020 at 8:10 AM Rohit Sarkar wrote: > > > > > > The iio debugfs interface provides direct access to read and write device > > > registers if debugfs is enabled. > > > > But regmap API provides at least reading facility. Isn't it enough? > > > > ... > > > > >  static const struct iio_info mpu_info = { > > >         .read_raw = &inv_mpu6050_read_raw, > > >         .write_raw = &inv_mpu6050_write_raw, > > >         .write_raw_get_fmt = &inv_write_raw_get_fmt, > > >         .attrs = &inv_attribute_group, > > >         .validate_trigger = inv_mpu6050_validate_trigger, > > > > > +       .debugfs_reg_access = &inv_mpu6050_reg_access > > > > Leaving comma is helpful for future development. > > > > >  }; > > > > >