[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae5c2e50-1a19-7a8f-7dbf-d7ef84128be6@linux.intel.com>
Date: Thu, 16 Jun 2022 08:04:09 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
cc: linux-serial <linux-serial@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Jonathan Corbet <corbet@....net>,
Arnd Bergmann <arnd@...db.de>, linux-doc@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org,
Lukas Wunner <lukas@...ner.de>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Lino Sanfilippo <LinoSanfilippo@....de>,
linux-api@...r.kernel.org
Subject: Re: [PATCH v7 5/6] serial: Support for RS-485 multipoint addresses
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@...db.de>
> > Cc: Jonathan Corbet <corbet@....net>
> > Cc: linux-api@...r.kernel.org
> > Cc: linux-doc@...r.kernel.org
> > Cc: linux-kernel@...r.kernel.org
> > Cc: linux-arch@...r.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. Or
do you mean I should create anonymous union? ...I'm skeptical that can be
pulled off w/o breaking user-space compile in some circumstances. Anon
unions were only introduced by C11 but is it ok to rely on C11 in uapi/
headers?
Even making padding smaller has some unwanted consequences if somebody is
clearing just .padding. In retrospect, having padding as a direct member
doesn't seem a good idea. That padding[5] should have been within an union
right from the start to make this easily extendable.
Maybe create a copy of that struct under another name which is just equal
sized, that would give more freedom on member naming. But can I change
ioctl's param type to another struct (in _IOR/_IOWR) w/o breaking
something?
--
i.
Powered by blists - more mailing lists