linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 10/11] gpiolib: add new ioctl() for monitoring changes in line info
Date: Thu, 19 Dec 2019 13:12:49 +0000	[thread overview]
Message-ID: <20191219131249.GA12008@firefly> (raw)
In-Reply-To: <CAMRc=Mcy=Q+9Eb6mb5JEq+CCbxgBY1CfTDsYj1Rt9bcLXgeY=g@mail.gmail.com>

On Thu, Dec 19, 2019 at 02:05:19PM +0100, Bartosz Golaszewski wrote:
> wt., 10 gru 2019 o 18:00 Andy Shevchenko <andy.shevchenko@gmail.com> napisał(a):
> >
> > > On a different note: why would endianness be an issue here? 32-bit
> > > variables with 64-bit alignment should still be in the same place in
> > > memory, right?
> >
> > With explicit padding, yes.
> >
> > > Any reason not to use __packed for this structure and not deal with
> > > this whole compat mess?
> >
> > Have been suggested that explicit padding is better approach.
> > (See my answer to Kent)
> >
> > > I also noticed that my change will only allow user-space to read one
> > > event at a time which seems to be a regression with regard to the
> > > current implementation. I probably need to address this too.
> >
> > Yes, but we have to have ABI v2 in place.
> 
> Hi Andy,
> 
> I was playing with some ideas for the new ABI and noticed that on
> 64-bit architecture the size of struct gpiochip_info is reported to be
> 68 bytes, not 72 as I would expect. Is implicit alignment padding not
> applied to a struct if there's a non-64bit-aligned 32-bit field at the
> end of it? Is there something I'm missing here?
> 

Struct alignment is based on the size of the largest element.
The largest element of struct gpiopchip_info is a __u32, so the struct
gets 32-bit alignment, even on 64-bit.

The structs with the problems all contain a __u64, and so get padded out
to a 64-bit boundary.

Cheers,
Kent.


  reply	other threads:[~2019-12-19 13:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 15:59 [PATCH v2 10/11] gpiolib: add new ioctl() for monitoring changes in line info Bartosz Golaszewski
2019-12-04 15:59 ` [PATCH v2 11/11] tools: gpio: implement gpio-watch Bartosz Golaszewski
2019-12-04 22:42   ` Andy Shevchenko
2019-12-05  9:45     ` Bartosz Golaszewski
2019-12-05  9:44   ` Kent Gibson
2019-12-05  9:48     ` Bartosz Golaszewski
2019-12-04 22:34 ` [PATCH v2 10/11] gpiolib: add new ioctl() for monitoring changes in line info Andy Shevchenko
2019-12-05  9:42   ` Bartosz Golaszewski
2019-12-05 10:27     ` Andy Shevchenko
2019-12-05 13:47       ` Bartosz Golaszewski
2019-12-05 17:02         ` Andy Shevchenko
2019-12-06 21:20           ` Bartosz Golaszewski
2019-12-10 17:00             ` Andy Shevchenko
2019-12-19 13:05               ` Bartosz Golaszewski
2019-12-19 13:12                 ` Kent Gibson [this message]
2019-12-19 13:17                   ` Bartosz Golaszewski
2019-12-05 10:47 ` Kent Gibson
2019-12-05 10:50   ` Bartosz Golaszewski

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=20191219131249.GA12008@firefly \
    --to=warthog618@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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).