linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: LI Qingwu <qing-wu.li@leica-geosystems.com.cn>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Tomas Melin <tomas.melin@vaisala.com>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Rob Herring <robh@kernel.org>
Subject: RE: [PATCH V3 3/5] iio: accel: sca3300: modified to support multi chips
Date: Thu, 5 May 2022 14:12:18 +0000	[thread overview]
Message-ID: <AM9PR06MB7844C01CA580F046FA570B43D7C29@AM9PR06MB7844.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <CAHp75VfEK_TXXA3NdGgjis7duHgoDo4aSOZntdO0wEGLw0sQ7g@mail.gmail.com>



> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Wednesday, May 4, 2022 10:39 PM
> To: LI Qingwu <qing-wu.li@leica-geosystems.com.cn>
> Cc: Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen
> <lars@metafoo.de>; Rob Herring <robh+dt@kernel.org>; Tomas Melin
> <tomas.melin@vaisala.com>; devicetree <devicetree@vger.kernel.org>; Linux
> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-iio
> <linux-iio@vger.kernel.org>; Rob Herring <robh@kernel.org>
> Subject: Re: [PATCH V3 3/5] iio: accel: sca3300: modified to support multi chips
> 
> This email is not from Hexagon’s Office 365 instance. Please be careful while
> clicking links, opening attachments, or replying to this email.
> 
> 
> On Wed, May 4, 2022 at 4:35 PM LI Qingwu
> <qing-wu.li@leica-geosystems.com.cn> wrote:
> > > From: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > Sent: Wednesday, May 4, 2022 10:20 PM On Wed, May 4, 2022 at 3:36 PM
> > > LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn> wrote:
> 
> ...
> 
> > > > +struct sca3300_chip_info {
> > > > +       const struct iio_chan_spec *channels;
> > > > +       const int (*accel_scale_table)[2];
> > > > +       const int *accel_scale_modes_map;
> > > > +       const unsigned long *scan_masks;
> > > > +       const int *avail_modes_table;
> > > > +       const int *freq_modes_map;
> > > > +       const int *freq_table;
> > > > +       const u8 num_accel_scales;
> > > > +       const u8 num_avail_modes;
> > > > +       const u8 num_channels;
> > > > +       const u8 num_freqs;
> > > > +       const u8 chip_id;
> > >
> > > Why do you have const qualifier on all members?  The last one is
> > > understandable, but the rest, esp. pointers should be justified.
> > Because I thought it was static and has fix value for each chip, unacceptable
> for you?
> 
> But why const qualifier? What is the point of it for example for u8 members if
> the entire object is qualified as const below in the same patch?
> 
> On top of that, please explain what in your opinion the "const ...
> *foo" gives us, and what we will lose if we remove the "const" part out of them.

Ah, you are right, those const are unnecessary for nonpointer members.
for the pointers, the contexts that the pointer points to are still writable.
what about if I remove all the const from nonpointer and keep it for the pointers?
Like:
const struct iio_chan_spec *channels;
const int (*accel_scale_table)[2];
const int (*incli_scale_table)[2];
const int *accel_scale_modes_map;
const int *incli_scale_modes_map;
const unsigned long *scan_masks;
const int *avail_modes_table;
const int *freq_modes_map;
const int *freq_table;
const char *name;
u8 num_accel_scales;
u8 num_incli_scales;
u8 num_avail_modes;
u8 num_channels;
u8 num_freqs;
u8 chip_id;
bool angle;



> 
> > > > +       const char *name;
> > > > +};
> 
> --
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2022-05-05 14:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 13:36 [PATCH V3 0/5] iio: accel: sca3300: add compitible for scl3300 LI Qingwu
2022-05-04 13:36 ` [PATCH V3 1/5] dt-bindings: iio: accel: sca3300: Document murata,scl3300 LI Qingwu
2022-05-04 13:36 ` [PATCH V3 2/5] iio: accel: sca3300: add define for temp channel for reuse LI Qingwu
2022-05-04 13:36 ` [PATCH V3 3/5] iio: accel: sca3300: modified to support multi chips LI Qingwu
2022-05-04 14:20   ` Andy Shevchenko
2022-05-04 14:35     ` LI Qingwu
2022-05-04 14:38       ` Andy Shevchenko
2022-05-05 14:12         ` LI Qingwu [this message]
2022-05-05 18:01           ` Andy Shevchenko
2022-05-07 14:42             ` Jonathan Cameron
2022-05-06 20:12   ` Melin Tomas
2022-05-07  3:48     ` LI Qingwu
2022-05-06 20:12   ` Melin Tomas
2022-05-07 14:54   ` Jonathan Cameron
2022-05-04 13:36 ` [PATCH V3 4/5] iio: accel: sca3300: Add support for SCL3300 LI Qingwu
2022-05-04 13:36 ` [PATCH V3 5/5] iio: accel: sca3300: Add inclination channels LI Qingwu
2022-05-04 17:23   ` kernel test robot
2022-05-07 14:46   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR06MB7844C01CA580F046FA570B43D7C29@AM9PR06MB7844.eurprd06.prod.outlook.com \
    --to=qing-wu.li@leica-geosystems.com.cn \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=tomas.melin@vaisala.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).