devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: <Victor.Duicu@microchip.com>
Cc: <dlechner@baylibre.com>, <nuno.sa@analog.com>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<robh@kernel.org>, <linux-kernel@vger.kernel.org>,
	<andy@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>,
	<Marius.Cristea@microchip.com>
Subject: Re: [PATCH v5 2/2] iio: temperature: add support for MCP998X
Date: Sat, 27 Sep 2025 16:25:33 +0100	[thread overview]
Message-ID: <20250927162533.14f3c475@jic23-huawei> (raw)
In-Reply-To: <42a376a9451ed340e0aa7f1c01a16554298c0693.camel@microchip.com>

On Wed, 24 Sep 2025 12:47:31 +0000
<Victor.Duicu@microchip.com> wrote:

> On Sat, 2025-09-20 at 11:55 +0100, Jonathan Cameron wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> >   
> 
> Hi Jonathan,
> 
> > On Thu, 18 Sep 2025 14:19:37 +0300
> > <victor.duicu@microchip.com> wrote:
> >   
> > > From: Victor Duicu <victor.duicu@microchip.com>
> > > 
> > > This is the driver for Microchip MCP998X/33 and MCP998XD/33D
> > > Multichannel
> > > Automotive Temperature Monitor Family.
> > > 
> > > Signed-off-by: Victor Duicu <victor.duicu@microchip.com>  
> > Hi Victor,
> > 
> > Various minor comments inline.
> > Given the build warnings I didn't elect to just tidy these up whilst
> > applying.
> > Seemed like there was slightly too high a risk of me messing it up!
> > Also we have lots of time as IIO is closed for this cycle now.
> > 
> > Jonathan
> >   
> ...
> 
> > 
> >   
> > > +/**
> > > + * Bit flags and their meaning  
> > 
> > As below. I don't think it is worth encoding these in a bitmap. Just
> > use
> > 5 bools to represent the state.
> >   
> > > + * @RECD34_ENABLE:           state of Resistance Error
> > > Correction(REC) on channels 3 and 4
> > > + * @RECD12_ENABLE:           state of Resistance Error
> > > Correction(REC) on channels 1 and 2
> > > + * @APDD_ENABLE:             state of anti-parallel diode mode
> > > + * @RUN_STATE:                       chip is in run state,
> > > otherwise is in standby state
> > > + * @WAIT_BEFORE_READ:                whether we need to wait a
> > > delay before reading a new value
> > > + */
> > > +#define RECD34_ENABLE                                0
> > > +#define RECD12_ENABLE                                1
> > > +#define APDD_ENABLE                          2
> > > +#define RUN_STATE                            3
> > > +#define WAIT_BEFORE_READ                     4
> > > +#define USE_PREVIOUS_FREQ                    5
> > > +  
> 
> Considering that I am planning to add new features to this driver,
> I think that it would be useful to keep the flags.

Unless there are many of these I think the loss of readability vs
the likely limited extra space used by bools still makes flags a
less than ideal approach.  For reasons of DMA safe buffer allocations
on many architectures there is a lot of padding in the iio_dev / iio_priv
allocation, so you can always check if it makes any difference at all
on the allocated data

> 
> > > +#define MCP9982_CHAN(index, si, __address)
> > > (                                         \  
> > Why the outer set of ()?  
> 
> Without the outer () compiler returns error "Macros with complex values
> should be enclosed in parentheses."

Hmm. I'd ignore that as an unhelpful warning in this case.

> 
> > > +     (struct iio_chan_spec)
> > > {                                                        \
> > > +             .type =
> > > IIO_TEMP,                                                       \
> > > +             .info_mask_separate =
> > > BIT(IIO_CHAN_INFO_RAW),                           \
> > > +             .info_mask_shared_by_all_available =
> > > BIT(IIO_CHAN_INFO_SAMP_FREQ) |     \
> > > +            
> > > BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY),                    
> 
> Kind Regards,
> Victor


  reply	other threads:[~2025-09-27 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 11:19 [PATCH v5 0/2] add support for MCP998X victor.duicu
2025-09-18 11:19 ` [PATCH v5 1/2] dt-bindings: iio: temperature: " victor.duicu
2025-09-18 14:56   ` Conor Dooley
2025-09-18 11:19 ` [PATCH v5 2/2] " victor.duicu
2025-09-19  6:27   ` kernel test robot
2025-09-20 10:39     ` Jonathan Cameron
2025-09-19  6:59   ` kernel test robot
2025-09-20 10:55   ` Jonathan Cameron
2025-09-24 12:47     ` Victor.Duicu
2025-09-27 15:25       ` Jonathan Cameron [this message]
2025-09-20 11:42 ` [PATCH v5 0/2] " 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=20250927162533.14f3c475@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Marius.Cristea@microchip.com \
    --cc=Victor.Duicu@microchip.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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).