From: Jonathan Cameron <jic23@kernel.org>
To: Markuss Broks <markuss.broks@gmail.com>
Cc: nekodevelopper@gmail.com, Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 3/4] iio: accel: mc3230: add mc3510c support
Date: Sun, 12 Jan 2025 10:52:33 +0000 [thread overview]
Message-ID: <20250112105233.283f3d49@jic23-huawei> (raw)
In-Reply-To: <8d5a2647-a130-4d99-a3e1-3abd1d336bbb@gmail.com>
On Sun, 12 Jan 2025 01:04:34 +0200
Markuss Broks <markuss.broks@gmail.com> wrote:
> On 1/11/25 10:11 PM, Vasiliy Doylov via B4 Relay wrote:
> > From: Vasiliy Doylov <nekodevelopper@gmail.com>
> >
> > This commit integrates support for the mc3510c into the mc3230 driver.
> >
> > Tested on Huawei MediaPad T3 10 (huawei-agassi)
> >
> > Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com>
> > ---
> > drivers/iio/accel/mc3230.c | 55 ++++++++++++++++++++++++++++++++++++----------
> > 1 file changed, 44 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c
> > index 3cad6f2d7a2a79df38f90e5656763f6ed019a920..ebbb96c658d87a83007c7c3c7212ce9ebf039963 100644
> > --- a/drivers/iio/accel/mc3230.c
> > +++ b/drivers/iio/accel/mc3230.c
> > @@ -22,20 +22,41 @@
> > #define MC3230_MODE_OPCON_STANDBY 0x03
> >
> > #define MC3230_REG_CHIP_ID 0x18
> > -#define MC3230_CHIP_ID 0x01
> > -
> > #define MC3230_REG_PRODUCT_CODE 0x3b
> > -#define MC3230_PRODUCT_CODE 0x19
> >
> > /*
> > * The accelerometer has one measurement range:
> > *
> > * -1.5g - +1.5g (8-bit, signed)
> > *
> > - * scale = (1.5 + 1.5) * 9.81 / (2^8 - 1) = 0.115411765
> > */
> >
> > -static const int mc3230_nscale = 115411765;
> > +enum mc3xxx_chips {
> > + MC3230,
> > + MC3510C,
> > +};
> > +
> > +struct mc3xxx_chip_info {
> > + const char *name;
> > + const u8 chip_id;
> > + const u8 product_code;
> > + const int scale;
> > +};
> The struct members are usually ordered alphabetically. Also, const
> specifiers for u8s and int are redundant, you will only want it for the
> pointer, usually.
No they are not usually ordered alphabetically (in kernel code anyway)
Much more important characteristics apply when choosing structure ordering.
1) Comprehensibility - keep related items next to each other.
2) Slight potential performance benefit from frequently accessed items as first entry.
3) Padding concerns. pahole will help but generally it is easy to work out
from first principles.
In that order. Sure you can do alphabetical if none of the above apply, but
it is far from a critical factor.
Const specifiers here are harmless as anotation but not necessary as you say.
Jonathan
next prev parent reply other threads:[~2025-01-12 10:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 20:11 [PATCH 0/4] iio: accel: mc3230: add mount matrix, of match and mc3510c support Vasiliy Doylov via B4 Relay
2025-01-11 20:11 ` [PATCH 1/4] iio: accel: mc3230: add mount matrix support Vasiliy Doylov via B4 Relay
2025-01-12 10:48 ` Jonathan Cameron
2025-01-11 20:11 ` [PATCH 2/4] iio: accel: mc3230: add OF match table Vasiliy Doylov via B4 Relay
2025-01-11 23:07 ` Markuss Broks
2025-01-12 10:42 ` Jonathan Cameron
2025-01-12 10:46 ` Jonathan Cameron
2025-01-11 20:11 ` [PATCH 3/4] iio: accel: mc3230: add mc3510c support Vasiliy Doylov via B4 Relay
2025-01-11 23:04 ` Markuss Broks
2025-01-12 10:52 ` Jonathan Cameron [this message]
2025-01-12 11:01 ` Jonathan Cameron
2025-01-11 20:11 ` [PATCH 4/4] dt-bindings: iio: accel: mc3230: document mc3510c Vasiliy Doylov via B4 Relay
2025-01-11 22:46 ` Markuss Broks
2025-01-12 11:03 ` 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=20250112105233.283f3d49@jic23-huawei \
--to=jic23@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markuss.broks@gmail.com \
--cc=nekodevelopper@gmail.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).