From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47FB7C43603 for ; Thu, 19 Dec 2019 13:13:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A5B620716 for ; Thu, 19 Dec 2019 13:13:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WKhevbX3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726847AbfLSNNB (ORCPT ); Thu, 19 Dec 2019 08:13:01 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:32772 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfLSNNB (ORCPT ); Thu, 19 Dec 2019 08:13:01 -0500 Received: by mail-pf1-f196.google.com with SMTP id z16so3246930pfk.0; Thu, 19 Dec 2019 05:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1gRwWTLS967Ubmo9QBFf6oeS3GYO3y9qdE++OzuCjo8=; b=WKhevbX3LE/LkS46gPKn0pKaWJ1UCYgcM/cOiNU2eJNXWeJsUyqiRs/NsDzOWFuXaG DHUhnDLQgUmbEA7kPJjVcaXltfn1NdN4M5HO0EF1R37j0qMHWpWutAqHDPSrEckIZdYD bJiT+XP8zeKlbNGUYT6XKe/IIPVN9OoNEHrEjv3xJLP10qsRU5EOLSIanlGodcna33c+ b07r47q5KK9YkOWTO5zhje/FAhCTL/rZ36ZN4WGxuN6s0jF+aGPOPE5zOzRYSAyDxaAa FkviBuNB2o9n7tKLzHqojXxgwyfh4ASBE1HJmXL54iw4KBxUtqgGiiaqtBwCGB+V8eBx 3v9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=1gRwWTLS967Ubmo9QBFf6oeS3GYO3y9qdE++OzuCjo8=; b=EBROHK4wnHw+Xx8L8+GP5zsHclvU2APBLAi3WxPXuakTKIn271yE43x/4vzp5NCIwf S5RCnBXeZxuAQcbZfaJuESJiUsE6ArM5a89N4RjkuNUUBCLcE3BsAk0f4yhfHBGGQ+cX BKNZPj7GOawCDDTxgrpNOQ06O4sPpeM5PbmCrvQnwFhMfFszGNqO31Ejon3DIkEAKPl7 Dnyntq2Ou1iXbi3SC+VH3VEl+aF2jq1GZ9ga4Burf5bGfeZDWGVnlUaxqZJdm2uIgG8B UGqFdC6JIiVLtZ+HcLaZGoQaJ14VTEy+zo1TDiDfonVcZYI0qnwcfpsuVW/hx1vUNO+I JoKg== X-Gm-Message-State: APjAAAW/bxxSNdEvjya+/keCF5j5sir8OnLshSZ0Lrrp6HK9LtAtlz0S PPiR2Mcbp1UTmspQSfDqhw0= X-Google-Smtp-Source: APXvYqy0izi6mgWThqnu1MUAe9tocw6rn0MpkH29qND2aoM9yGkQdgIqZuH/xgG3IqQ6u4j/XtcGEQ== X-Received: by 2002:aa7:8007:: with SMTP id j7mr9721396pfi.73.1576761180732; Thu, 19 Dec 2019 05:13:00 -0800 (PST) Received: from firefly (220-235-124-2.dyn.iinet.net.au. [220.235.124.2]) by smtp.gmail.com with ESMTPSA id w66sm8631924pfw.102.2019.12.19.05.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 05:13:00 -0800 (PST) Date: Thu, 19 Dec 2019 13:12:49 +0000 From: Kent Gibson To: Bartosz Golaszewski Cc: Andy Shevchenko , Bartosz Golaszewski , Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Subject: Re: [PATCH v2 10/11] gpiolib: add new ioctl() for monitoring changes in line info Message-ID: <20191219131249.GA12008@firefly> References: <20191204155941.17814-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Thu, Dec 19, 2019 at 02:05:19PM +0100, Bartosz Golaszewski wrote: > wt., 10 gru 2019 o 18:00 Andy Shevchenko 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.