Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp179271pxk; Wed, 9 Sep 2020 02:27:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQPBlydALWzEFHKtGz/mjJ44yTM/NEXs0NNsO26PthTPaHyZuV6vUWxYiBcbz+qS3WTaXP X-Received: by 2002:a17:906:819:: with SMTP id e25mr2801762ejd.211.1599643665985; Wed, 09 Sep 2020 02:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599643665; cv=none; d=google.com; s=arc-20160816; b=0kptoyd8ujx1aNQo+4VcwxXY+4jeebvwdEjtpTEr/oWRcHNFm7SHkvvH/EmZlv4Bca KKHb6zriiE6RbpMSubHaoWJVm9urra2P6z00xjLm02cB5L9XPFFKaTnL0c5nICPv7Dx4 ufZBRHmIHF7n6LV+/4grfj8mW+RjGfOnx7udzz27tPvWkwEhSouzDEBtcVOnBqO/3j9B Ku32MPLCV+pZyaTc+p8rrunGL5eycDcuGjDYPGULJVBwuuX25UrwdFAjb9TLjCxF9pj5 PhaDY1nDd8h+LR4wZyaCyo0aEFYQq157fE3o2eSl8mJymQBh534722reX0iDJcFyBI72 GJvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=r6DZDXW2YGItYWu3dtFgHpQyQnbLb2FyzRV1Tm+8JvY=; b=SmLdst1WWXwYiS2DpHbN+yhkWAEgQQfWI8cgdndUL45gMxp2pRW+/QQE+uIUbHAeYk CufB4o6Bgwv/YmWP1UB3UyLiYYNfED1/y6FRmXCxiOE8KmuxdDuLxVdgdV2UM6XuBJii mj/5/KfOawl/hExj2Fg7jJO5jnwreRBSbXGcdHp1/HvvkfssmLq4yw1kM2hI4zdgMi0+ g2dUeFhZPH5YGCLbbVSxMUjE6Xjlq+C7eRxXINIzpbNsBRIPwsO3iCvIyh4AX+Rky3DU aXY2FZ/BEFre0LERub8SIfaB/p4OTlBods2U+kzNZ/ccc6kh/ozK5XXhVumpKz4/h7Ir mtag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=MLtuElp1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ot13si1117952ejb.450.2020.09.09.02.27.23; Wed, 09 Sep 2020 02:27:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=MLtuElp1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728442AbgIIJ0Q (ORCPT + 99 others); Wed, 9 Sep 2020 05:26:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbgIIJ0N (ORCPT ); Wed, 9 Sep 2020 05:26:13 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BE9C061755 for ; Wed, 9 Sep 2020 02:26:12 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id gr14so2569742ejb.1 for ; Wed, 09 Sep 2020 02:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r6DZDXW2YGItYWu3dtFgHpQyQnbLb2FyzRV1Tm+8JvY=; b=MLtuElp1YLqmIO7OwQ6l20NeACyG2PIdqREORO+akPvUrIJCNfv+jHg31uTBSo7tvY CWEcZxrZOG/vFPhcUp88soN0nhZBwCZS/ZxqylYK2NDagz4mQaUufqceBiMtj5lUOCYC hJBvGSk25zG56nS6GkLDsmc/oLxglNmKYqU29+p9CcUCnB/CunbqRkprARZw+gg/67zV CAiaQ3H/+18KUUyU5U5TSqVDidt4eCNkNnnDRe4WPtvtlQFi0i/XED+LXl3xyO4HW7Vf jp7VUZSBHJvvk0b7RYSAEd99Pq8U03/mtiK3fVP1LH4DnerRYFX89OZBSf+VE2dNMbde o27g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=r6DZDXW2YGItYWu3dtFgHpQyQnbLb2FyzRV1Tm+8JvY=; b=kl1fV6vhaBMTVh/aGrO2qqk9j3REtaUMhYQxZmXu6Rmy4/vL5NNFPXK8VBj+1jLi3T b70aEjPndXzeuoghIyn8nyjKWEiUQ3NRfh7DzfjpPgLKBabx57iIqh5SVnp8iVxuCOf9 WzC1Lb6oRmIRw8K4OHnU1wQMAKhENtOe9sG6m01jPYStQE3+hm/31DprrbJysYcyw6DT Ag0jeM5b3rX4C3aBD2jJK6ZeYElni7hFpFvIvh7GnPRvPbOsTqtcr93fBB6M1NwuEuW5 VQvjr9Izb8sNCq1QdFk4mtiAN03lUVMrz6n3WSRYziIuFpFz7yE5O+vEgamAWD76FbXe +/LQ== X-Gm-Message-State: AOAM533UhikZqlZYdUmE2B3LzwM5o18xxrf+dswy58TaLSd2gkdRVajz w07nXsYOn9E/PSep3vuX3VjuQk4N+Gms8F4CBH/I9A== X-Received: by 2002:a17:906:c1c3:: with SMTP id bw3mr2653214ejb.516.1599643571188; Wed, 09 Sep 2020 02:26:11 -0700 (PDT) MIME-Version: 1.0 References: <20200905133549.24606-1-warthog618@gmail.com> <20200905133549.24606-8-warthog618@gmail.com> <20200909092401.GA1431678@sol> In-Reply-To: <20200909092401.GA1431678@sol> From: Bartosz Golaszewski Date: Wed, 9 Sep 2020 11:26:00 +0200 Message-ID: Subject: Re: [PATCH v7 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL To: Kent Gibson Cc: LKML , linux-gpio , Linus Walleij Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 9, 2020 at 11:24 AM Kent Gibson wrote: > > On Sat, Sep 05, 2020 at 09:35:36PM +0800, Kent Gibson wrote: > > Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and > > returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. > > > > The struct linereq implementation is based on the v1 struct linehandle > > implementation. > > > > Signed-off-by: Kent Gibson > > --- > > > > [snip] > > > if (copy_from_user(&offset, ip, sizeof(offset))) > > return -EFAULT; > > @@ -1104,6 +1505,25 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt) > > MAJOR(devt), gdev->id); > > > > return 0; > > + /* > > + * array sizes must ensure 64-bit alignment and not create holes in > > + * the struct packing. > > + */ > > + BUILD_BUG_ON(IS_ALIGNED(GPIO_V2_LINES_MAX, 2)); > > + BUILD_BUG_ON(IS_ALIGNED(GPIO_MAX_NAME_SIZE, 8)); > > + > > + /* > > + * check that uAPI structs are 64-bit aligned for 32/64-bit > > + * compatibility > > + */ > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_attribute), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_config_attribute), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_config), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_request), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_info), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_info_changed), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_event), 8)); > > + BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_values), 8)); > > } > > > > A couple of things here - these should all be !IS_ALIGNED. > And the BUILD_BUG_ON gets compiled out, and so doesn't fail, if they are > after the return. > > How would you like that fixed - v8 or a patch once v7 is in? > > Cheers, > Kent. v8 please. Why is it compiled out though? Does it need some config option? Bart