From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jirislaby@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-serial <linux-serial@vger.kernel.org>,
"Greg KH" <gregkh@linuxfoundation.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Arnd Bergmann" <arnd@arndb.de>,
linux-doc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org, "Lukas Wunner" <lukas@wunner.de>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Lino Sanfilippo" <LinoSanfilippo@gmx.de>,
linux-api@vger.kernel.org
Subject: Re: [PATCH v7 5/6] serial: Support for RS-485 multipoint addresses
Date: Thu, 16 Jun 2022 10:53:56 +0300 (EEST) [thread overview]
Message-ID: <accefd7-6fbf-b1f1-f467-5eaab0dac051@linux.intel.com> (raw)
In-Reply-To: <c0996d75-070e-21e6-eb51-a10a358dbb46@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3500 bytes --]
On Thu, 16 Jun 2022, Jiri Slaby wrote:
> On 16. 06. 22, 7:04, Ilpo Järvinen wrote:
> > On Wed, 15 Jun 2022, Andy Shevchenko wrote:
> >
> > > On Wed, Jun 15, 2022 at 03:48:28PM +0300, Ilpo Järvinen wrote:
> > > > Add support for RS-485 multipoint addressing using 9th bit [*]. The
> > > > addressing mode is configured through .rs485_config().
> > > >
> > > > ADDRB in termios indicates 9th bit addressing mode is enabled. In this
> > > > mode, 9th bit is used to indicate an address (byte) within the
> > > > communication line. ADDRB can only be enabled/disabled through
> > > > .rs485_config() that is also responsible for setting the destination and
> > > > receiver (filter) addresses.
> > > >
> > > > [*] Technically, RS485 is just an electronic spec and does not itself
> > > > specify the 9th bit addressing mode but 9th bit seems at least
> > > > "semi-standard" way to do addressing with RS485.
> > > >
> > > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > > Cc: Jonathan Corbet <corbet@lwn.net>
> > > > Cc: linux-api@vger.kernel.org
> > > > Cc: linux-doc@vger.kernel.org
> > > > Cc: linux-kernel@vger.kernel.org
> > > > Cc: linux-arch@vger.kernel.org
> > >
> > > Hmm... In order to reduce commit messages you can move these Cc:s after
> > > the
> > > cutter line ('---').
> >
> > Ok, although the toolchain I use didn't support preserving --- content
> > so I had to create hack to preserve them, hopefully nothing backfires due
> > to the hack. :-)
> >
> > > > - __u32 padding[5]; /* Memory is cheap, new structs
> > > > - are a royal PITA .. */
> > > > + __u8 addr_recv;
> > > > + __u8 addr_dest;
> > > > + __u8 padding[2 + 4 * sizeof(__u32)]; /* Memory is cheap,
> > > > new structs
> > > > + * are a royal PITA ..
> > > > */
> > >
> > > I'm not sure it's an equivalent. I would leave u32 members untouched, so
> > > something like
> > >
> > > __u8 addr_recv;
> > > __u8 addr_dest;
> > > __u8 padding0[2]; /* Memory is cheap, new structs
> > > __u32 padding1[4]; * are a royal PITA .. */
> > >
> > > And repeating about `pahole` tool which may be useful here to check for
> > > ABI
> > > potential changes.
> >
> > I cannot take __u32 padding[] away like that, this is an uapi header.
>
> Yeah, but it's padding after all. I would personally break it for example as
> Andy suggests (if pahole shows no differences in size on both 32/64 bit) and
> wait if something breaks. To be honest, I'd not expect anyone to touch it. And
> if someone does, we would fix it somehow and they should too...
I realized there are plenty of anonymous unions already in include/uapi/
so I think I can keep padding[5] too:
union {
/* v1 */
__u32 padding[5]; /* Memory is cheap, new structs are a pain */
/* v2 (adds addressing mode fields) */
struct {
__u8 addr_recv;
__u8 addr_dest;
__u8 padding0[2];
__u32 padding1[4];
};
};
I'll just skip manual pahole step and add a few BUILD_BUG_ON()s and use
our build bot to do a quick check over all archs it builds for, that gives
much better confidence on it being ok:
BUILD_BUG_ON(((&rs485.delay_rts_after_send) + 1) != &rs485.padding[0]);
BUILD_BUG_ON(&rs485.padding[1] != &rs485.padding1[0]);
BUILD_BUG_ON(sizeof(rs485) != ((u8 *)(&rs485.padding[4]) - ((u8 *)&rs485.flags) + sizeof(__u32)));
--
i.
next prev parent reply other threads:[~2022-06-16 7:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220615124829.34516-1-ilpo.jarvinen@linux.intel.com>
2022-06-15 12:48 ` [PATCH v7 1/6] serial: 8250: make saved LSR larger Ilpo Järvinen
2022-06-15 14:00 ` Andy Shevchenko
2022-06-15 12:48 ` [PATCH v7 2/6] serial: 8250: create lsr_save_mask Ilpo Järvinen
2022-06-15 14:01 ` Andy Shevchenko
2022-06-15 12:48 ` [PATCH v7 3/6] serial: 8250_lpss: Use 32-bit reads Ilpo Järvinen
2022-06-15 12:48 ` [PATCH v7 4/6] serial: take termios_rwsem for .rs485_config() & pass termios as param Ilpo Järvinen
2022-06-15 14:05 ` Andy Shevchenko
2022-06-16 5:15 ` Ilpo Järvinen
2022-06-15 12:48 ` [PATCH v7 5/6] serial: Support for RS-485 multipoint addresses Ilpo Järvinen
2022-06-15 14:13 ` Andy Shevchenko
2022-06-16 5:04 ` Ilpo Järvinen
2022-06-16 5:48 ` Jiri Slaby
2022-06-16 7:53 ` Ilpo Järvinen [this message]
2022-06-15 12:48 ` [PATCH v7 6/6] serial: 8250_dwlib: Support for 9th bit multipoint addressing Ilpo Järvinen
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=accefd7-6fbf-b1f1-f467-5eaab0dac051@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=LinoSanfilippo@gmx.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=u.kleine-koenig@pengutronix.de \
/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