Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2820161pxk; Tue, 15 Sep 2020 03:16:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWVdbLIX+z7ySmgM1Lqm3rbkUQPfkPjqlaVtPGm0qknpH31riosN4ClCdrrd7zpwSz1ev6 X-Received: by 2002:a17:906:1484:: with SMTP id x4mr18812475ejc.81.1600164960016; Tue, 15 Sep 2020 03:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600164960; cv=none; d=google.com; s=arc-20160816; b=bxJmy7re2Dhv0LtKR5lyjzVjcT51osDA+vjfFEBESWNE8EavagcLSGbfsVWJ5PqWtK pei2idHRdvX9E/ouDkQDHBmKQW1f1Uz4KYd9nc35rRQvlAcKp90T33VLedj2Z5QaWGeP mOaDsiMwHHblobmkaGby8rSRoeH+VJ31qxEfi9nb3sc8ucqJBKVVRbzrref8rkhOl+9H 7DDU4eQOnOyFQxoxlNU2/cUpaL4F7uvEUQBGlpHS2wkj+CNBiNqRVAHDMdU79rXzVP0P xiESzf2QOy0swgAzk7eyIaMrgrp++mIrtBT64nT3FekBiN6PXooI3DWzcvBGMzWNdxOG PowQ== 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=6PF6jhPHZkI3ThcxAwiW0uIimLHRGDaXWK3SDQgKreY=; b=hCLBSdUy6jGtQ6YQUt/p4Wd/5wbUSHvAsb7IcALMcq4intF14F0UVY7MXWhc0/bdLg 7ds/kPHVfH0MoK4l2o+7mxiDUNyDKymuR75Yzus3I16qqYWJPItmz3NqSVq/mJB46Fq7 qQb79F6WZkkdSxfErr0cgG0Ph7Wq/D+jcm2OLHp2ScUhnaPSYbTC8y/Xfx+45OjatE5q KJ1/qfknbjnbovgfxVkFrrO+7ppyfnMKPTFgVx2BuPY9PnIC44N/n19gCVEhK6qBAtbH qgOvn6F0CnUv5R9nWY0qqASNqBSkDsGGZCGbK4fIUCnLDfugU/VN6xGpi9SZFoJ+gGpx XrNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="cZv1f/yH"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gr23si6968226ejb.586.2020.09.15.03.15.37; Tue, 15 Sep 2020 03:16:00 -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=@gmail.com header.s=20161025 header.b="cZv1f/yH"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbgIOKMn (ORCPT + 99 others); Tue, 15 Sep 2020 06:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbgIOKMm (ORCPT ); Tue, 15 Sep 2020 06:12:42 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99511C06174A; Tue, 15 Sep 2020 03:12:41 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id q4so1520897pjh.5; Tue, 15 Sep 2020 03:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6PF6jhPHZkI3ThcxAwiW0uIimLHRGDaXWK3SDQgKreY=; b=cZv1f/yHj+EycMimrqz6L0GKUkMMocTN9uchZtlogc7B0hp4o12EbPv8ybmxeessN9 vklarSeI2BioDoIqanxkg3iHlhh21KMAHPpLlWHPJvDDbmj13Sh6jCtKq3gqUA5Zjck7 xzEd3ZaPyYgzpbLSPIL0Ckm0+q6oyBd710M75LhDlKLMhczZAWptHDtyRPqbOXg5dU8A 83CNFSmVsBNR+4OC/K+Iu3rSaPPn2qa8Xp1bvSYvI0/fSkbwC5LYEeSEDbuzolO6QlTV fMRSZPIC6dKvtnF6u/QgNgE2lZqiWeMdhtFYYgTpi7aftAbcvIU9FXWxWUdyNhp+EXe2 l1Dw== 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=6PF6jhPHZkI3ThcxAwiW0uIimLHRGDaXWK3SDQgKreY=; b=t/j4LdVSSY7kRyTDQAfq4mMGthy6WurHwcui294Zv89KB+9acuGzi67XvZKchfrQgC GtWKANJtHcOdRdGpeuevNcvYk1Mo/NDMw0PGnwyXxPwGZbKR7sQx0XgMFi6j7sfioVmj LIvkdx/CR85c10qutLh/0wxPNrTTIy5x+iy3dNx1Tz+6ltLuZXt/HipJQHLKVrf5/2WM 4YLjLYlcz5hOLDjlP8RH71S4yk+9uquAatbX8v5Ud9nFQ9YKG52WarXHPVICQBj+P+II ZP3lU6uWugQH24ySQAbgFbO2BQGNcnlk16IdV20K3kvvBNoUZSIxuZSwItMnrR5wbWAX jwAA== X-Gm-Message-State: AOAM531ptArfoKRdDOM+mYCV6Ltp2R2bEUFBnPFkwmy/uz68MLvH9iyJ N7M1UyWzGKAqPK1/+JNk8jsnjTE4XlSodlr+JI7zuqGMGOZys9x+ X-Received: by 2002:a17:90a:fd98:: with SMTP id cx24mr3282961pjb.181.1600164761022; Tue, 15 Sep 2020 03:12:41 -0700 (PDT) MIME-Version: 1.0 References: <20200909102640.1657622-1-warthog618@gmail.com> <20200909102640.1657622-4-warthog618@gmail.com> In-Reply-To: <20200909102640.1657622-4-warthog618@gmail.com> From: Andy Shevchenko Date: Tue, 15 Sep 2020 13:12:23 +0300 Message-ID: Subject: Re: [PATCH v8 03/20] gpio: uapi: define GPIO_MAX_NAME_SIZE for array sizes To: Kent Gibson Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , 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 1:29 PM Kent Gibson wrote: > > Replace constant array sizes with a macro constant to clarify the source > of array sizes, provide a place to document any constraints on the size, > and to simplify array sizing in userspace if constructing structs > from their composite fields. > Reviewed-by: Andy Shevchenko > Signed-off-by: Kent Gibson > --- > include/uapi/linux/gpio.h | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h > index 9c27cecf406f..285cc10355b2 100644 > --- a/include/uapi/linux/gpio.h > +++ b/include/uapi/linux/gpio.h > @@ -14,6 +14,11 @@ > #include > #include > > +/* > + * The maximum size of name and label arrays. > + */ > +#define GPIO_MAX_NAME_SIZE 32 > + > /** > * struct gpiochip_info - Information about a certain GPIO chip > * @name: the Linux kernel name of this GPIO chip > @@ -22,8 +27,8 @@ > * @lines: number of GPIO lines on this chip > */ > struct gpiochip_info { > - char name[32]; > - char label[32]; > + char name[GPIO_MAX_NAME_SIZE]; > + char label[GPIO_MAX_NAME_SIZE]; > __u32 lines; > }; > > @@ -52,8 +57,8 @@ struct gpiochip_info { > struct gpioline_info { > __u32 line_offset; > __u32 flags; > - char name[32]; > - char consumer[32]; > + char name[GPIO_MAX_NAME_SIZE]; > + char consumer[GPIO_MAX_NAME_SIZE]; > }; > > /* Maximum number of requested handles */ > @@ -123,7 +128,7 @@ struct gpiohandle_request { > __u32 lineoffsets[GPIOHANDLES_MAX]; > __u32 flags; > __u8 default_values[GPIOHANDLES_MAX]; > - char consumer_label[32]; > + char consumer_label[GPIO_MAX_NAME_SIZE]; > __u32 lines; > int fd; > }; > @@ -182,7 +187,7 @@ struct gpioevent_request { > __u32 lineoffset; > __u32 handleflags; > __u32 eventflags; > - char consumer_label[32]; > + char consumer_label[GPIO_MAX_NAME_SIZE]; > int fd; > }; > > -- > 2.28.0 > -- With Best Regards, Andy Shevchenko