From: Petre Rodan <petre.rodan@subdimension.ro>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Angel Iglesias <ang.iglesiasg@gmail.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Andreas Klinger <ak@it-klinger.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Subject: Re: [PATCH v5 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors
Date: Wed, 29 Nov 2023 15:51:54 +0200 [thread overview]
Message-ID: <ZWdB-vU2MAptRk8d@sunspire> (raw)
In-Reply-To: <ZWcUPkzfGqxYsysp@smile.fi.intel.com>
Hello,
thank you for the code review.
On Wed, Nov 29, 2023 at 12:36:46PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 29, 2023 at 09:04:49AM +0200, Petre Rodan wrote:
> ...
>
> > + for (index = 0; index < ARRAY_SIZE(hsc_range_config); index++) {
> > + if (strncmp(hsc_range_config[index].triplet,
> > + triplet,
> > + HSC_PRESSURE_TRIPLET_LEN - 1) == 0) {
> > + hsc->pmin = hsc_range_config[index].pmin;
> > + hsc->pmax = hsc_range_config[index].pmax;
> > + found = 1;
> > + break;
> > + }
> > + }
> > + if (hsc->pmin == hsc->pmax || !found)
> > + return dev_err_probe(dev, -EINVAL,
> > + "honeywell,pressure-triplet is invalid\n");
>
> This one is important. I think I told already twice that this is NIH
> device_property_match_property_string(). Please, use this API directly.
let me see if we are on the same frequency.
you told me to use match_string/sysfs_match_string.
using any of those assume having the strings in an array, which means I have to
clutter the code with 242 extra lines in order to split up hsc_range_config:
enum hsc_variants {
HSC001BA = 0,
HSC1_6BA = 1,
[ .. 115 lines skipped ]
HSC150PG = 117,
}
static const char * const hsc_triplet_variants[] = {
[HSC001BA] = "001BA",
[HSC1_6BA] = "1.6BA",
[ .. 115 lines skipped ]
[HSC150PG] = "150PG",
};
and change my structure to
static const struct hsc_range_config hsc_range_config[] = {
[HSC001BA] = { .pmin = 0, .pmax = 100000 },
[ .. 117 lines skipped ]
};
just to have the privilege of using match_string() on hsc_triplet_variants.
now, which is worse for maintenance? a handful of lines of code that do a
loop of strncmp or the clutter depicted above?
I can go either way, but I want to make sure you see where this leads.
> > +#ifndef _HSC030PA_H
> > +#define _HSC030PA_H
>
> > +#include <linux/mutex.h>
>
> > +#include <linux/property.h>
>
> Is not used here.
ok.
since we are here, can you please tell me how is mutex.h used outside of hsc030pa.c where it was included previously?
cheers,
peter
--
petre rodan
next prev parent reply other threads:[~2023-11-29 13:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 7:04 [PATCH v5 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors Petre Rodan
2023-11-29 10:36 ` Andy Shevchenko
2023-11-29 13:51 ` Petre Rodan [this message]
2023-11-29 14:14 ` Andy Shevchenko
2023-11-29 14:16 ` Andy Shevchenko
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=ZWdB-vU2MAptRk8d@sunspire \
--to=petre.rodan@subdimension.ro \
--cc=ak@it-klinger.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ang.iglesiasg@gmail.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=robh+dt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.