Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp237893pxj; Thu, 10 Jun 2021 20:44:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMm30VrFuOuu4CD/ZWUDyJ5ctQUU42mv9KLBwFn3ZH+wcZjwPLfcnm8ie8JUoTh3DEdZb6 X-Received: by 2002:a17:906:c2d6:: with SMTP id ch22mr1573648ejb.227.1623383085703; Thu, 10 Jun 2021 20:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623383085; cv=none; d=google.com; s=arc-20160816; b=lPfFfHFJBaJMbrdytusPxOUxYPDdrMoHZjuaGIJtLwuPxqm56DL5ev0L82rT+QXMdy UvzuPp5m1CXaAL2qOo5AAHdGi6tMKrtGWrxXQYjmwm5i5e9FhlpxqtLMYmLuM2K7vSFv ZPEWXKWl6QZItpSPBMm+7+wIKe8eMa+jEu8xZTggEKFGBmF1FsZCuLViJu6V8onT18fD G2t2yQpWQb3dsoZnuuLzHmx63OdaJP11RzJEZM0Gr6MA0VeEQtTJ6U5Nj7L85XQlUUcG toqGp+reghDmq87rFT7a3jvBpXPEI8vVmGfbnBpSVC7zzYOd0dX9a6VHMpYSG1hHC454 Z0Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SxxbAF3jaVNlurlddu+dUL7InQzwoLHvI2QS6L1ZxjQ=; b=Ap2aPRs1FWZRezkFgfBhB6qFUNvyChT20PYZr3jug/9/JPC+91dRa4L9OOmuqeFHtE mFFZfxm6QfQ7I6c/KBH2x5oRQt4723Ih9LHQ47dWTnL3r0nDpu41Loh2+93i9UurQEwi yNZUnX1k5uwjHJFLtYUe8gVp0hBzNGEJyRqdYPZydigpGa+WClQtYq5bMnWSWZ11qdDC i1NZaKRAOKsjV8sSv3w34Z/B17zJtce18CyDw5R0T9EzycGDDsoBj4AexvhDBXF98S1X 7dquTbUDo53KK0YguZnJNorMnIMd0nx1i/iwbjiEEybuKajOY57Vhc7VitBGYwp5v8sk Qm2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BpsBGYsc; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m13si3697637edv.357.2021.06.10.20.44.22; Thu, 10 Jun 2021 20:44: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=@linaro.org header.s=google header.b=BpsBGYsc; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231610AbhFKDmj (ORCPT + 99 others); Thu, 10 Jun 2021 23:42:39 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:42624 "EHLO mail-pl1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbhFKDmi (ORCPT ); Thu, 10 Jun 2021 23:42:38 -0400 Received: by mail-pl1-f172.google.com with SMTP id v13so2133240ple.9 for ; Thu, 10 Jun 2021 20:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SxxbAF3jaVNlurlddu+dUL7InQzwoLHvI2QS6L1ZxjQ=; b=BpsBGYsc3slgoB7ffao6X7asqYsjp6NuzRTK9sRNfRDGAbKOJwOk07koFr9cSJgJ1C zS8/elLhYZqjTn0hueib/5CkQFqxhqrPifwrvceCqxnNzhyBJEiHX3W7ygy81esbwu5s 376cXmfHLiodod8ml8ifkYZOjjUdjM40YhDqma+KYO8E+xQri7K0gPITGNhSAm3NzsNi 8fCJZQhCwz7zmobOpFIGlF74GGeYtPKcp58AG0VXzkLrXtTYAdbCtB/Xwldi2L+WI9Wg 50QyhP5Nenm9EFuqhKd+Ah5wMUf4Hzf2o/iiCGHwr3AgeHXvgqqNqbO+A9DDZfBiHpu2 uUmw== 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:in-reply-to:user-agent; bh=SxxbAF3jaVNlurlddu+dUL7InQzwoLHvI2QS6L1ZxjQ=; b=Ijf5Yx9OzrxxsvKvImDm3NRcMvlASA55Ohqlx9qOlYmnHd1zOXmt+hcDuz56+F7AwX WYNqmIMsa4KeujjUBSyu9X+WSU+8M/GMoLLlQUyJjB0p5SSfa15XG7Aahm6ZjKhTBpu9 UaCA/ZPbPReBBvIftWN4Q9kRCsUPhD06ZLtTwLWl4xU8yWGIOvcBY8Ksf03lc2bAMW0z fygcUt1iuw4j1jZ0qq5HRZeNQGQjKyyJa+5NbDPFHb7r8+2LO8Y94UCNyS94ilUkLmvQ 9zOHqIqwIZFGSNI3CEYLjTSaLWbl1bU4rH+GGzSjJqnyLa+dfjmlUnfBaUOU5Q2rEXiH AXjg== X-Gm-Message-State: AOAM533KC0cC/JzpqUixvwMLtC+1q0ropysFHHqcLKXPbIEdxoLyeh6y 4rp7HSFFwYCMlmi4aChWpu+Zlw== X-Received: by 2002:a17:902:8e88:b029:ee:b947:d7df with SMTP id bg8-20020a1709028e88b02900eeb947d7dfmr1954566plb.48.1623382771923; Thu, 10 Jun 2021 20:39:31 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id p11sm1342742pjj.43.2021.06.10.20.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 20:39:31 -0700 (PDT) Date: Fri, 11 Jun 2021 09:09:29 +0530 From: Viresh Kumar To: Jean-Philippe Brucker Cc: Bartosz Golaszewski , Linus Walleij , "Enrico Weigelt, metux IT consult" , Viresh Kumar , "Michael S. Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-gpio@vger.kernel.org, Stefan Hajnoczi , "Stefano Garzarella --cc virtualization @ lists . linux-foundation . org" , stratos-dev@op-lists.linaro.org Subject: Re: [PATCH V3 1/3] gpio: Add virtio-gpio driver Message-ID: <20210611033929.ifnafw2gznjklnq2@vireshk-i7> References: <01000179f5da7763-2ea817c6-e176-423a-952e-de02443f71e2-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10-06-21, 19:40, Jean-Philippe Brucker wrote: > On Thu, Jun 10, 2021 at 12:16:46PM +0000, Viresh Kumar via Stratos-dev wrote: Fixed everything else you suggested. > > +struct virtio_gpio_config { > > + char name[32]; > > + __u16 ngpio; > > + __u16 padding; > > + __u32 gpio_names_size; > > + char gpio_names[0]; > > A variable-size array here will make it very difficult to append new > fields to virtio_gpio_config, when adding new features to the device. (New > fields cannot be inserted in between, since older drivers will expect > existing fields at a specific offset.) Yes, I thought about that earlier and though maybe we will be able to play with that using the virtio-features, I mean a different layout of config structure if we really need to add a field in config, based on the feature flag. > You could replace it with a reference to the string array, for example > "__u16 gpio_names_offset" declaring the offset between the beginning of > device-specific config and the string array. But, I like this idea more and it does make it very flexible. Will adapt to it. > The 'name' field could also be indirect to avoid setting a fixed > 32-char size, but that's not as important. Yeah, 32 bytes is really enough. One won't be able to make any sense out of a bigger name anyway :) > > +} __packed; > > No need for __packed, because the fields are naturally aligned (as > required by the virtio spec) Yeah, I know, but I tend to add that for structures which aren't very simple (like the request/response ones), just to avoid human errors and hours of debugging someone need to go through. __packed won't harm at least :) -- viresh