Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3079419pxk; Mon, 28 Sep 2020 07:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwohDgPL8xIE4zVh4l5ITA8U5BjHHQezswV6oY+zdG43xZJwZWhDf8RNggAZboF1mM4qDjj X-Received: by 2002:aa7:db47:: with SMTP id n7mr2187809edt.315.1601304936912; Mon, 28 Sep 2020 07:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601304936; cv=none; d=google.com; s=arc-20160816; b=dixOeHW+WLpBcPOTHkJy3qOW+YPoD5SxsuXM2x9zqxaxiCXg8CL6I5ECs4nlwyCaBZ g/DjI9al/ZzXjbdOirLLlkgyWwtbE8HYe7ndxm0pBPAQV3QT75xtGrDqgTlMRXYeTiek pc6hnS64ReHYXj2m0zUhl3XYaoQtnYMiRGRCA1s3zZIOk+7a0GkvpfeetoYz5xG0zh0Z KQg6b3+UxCunWPJQX4IPdBtoxoRPaSA0rUWO8g2AGtXhi+bI/mEB338BrHTkGr0RSMAZ PYtr+/OLiE2r4lPny1ZVzS7fbZJ4acJY64nvll4Vl5bqSwgx2CbTJOn3mpt2nZJGo1CK BpRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pb2hEgRaRZDX0+sB29ngdH9rbWg1o3VgDq0s7JnHNBs=; b=qe6w4UTfn3qRXkHdEtoES/wCpUrJrv3vtjXyzlj6V8Dboini3OR+ShrvKCgD1cWFJr 5uwZaanEWKRy9Z+jfaBzmQRD2p4cxBMCIaao4mFPuJWRMtstEKGI7lIUm2hAqi3bWeLL KnjfbxdunIwlxYhtw45FKBzavYy5jP+75KZJX06cHSm9PRHgjyYQYhszX33KLSQPuOYw 8/Wb4zw3ZZIVR//S14H0Ot/NNG+1OfB9nkEGT9f2LJ6CAjEzofFTDNybm0rUTRVjDuhU uTk7Fi9P5sd0/LSyOrwkI8PIkSvKX38P0FQkngKOW2otgbldCb9ciso6entaUF31rlYv apxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=FntVd3CA; 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 lu5si718874ejb.377.2020.09.28.07.55.14; Mon, 28 Sep 2020 07:55:36 -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=FntVd3CA; 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 S1726665AbgI1Owj (ORCPT + 99 others); Mon, 28 Sep 2020 10:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbgI1Owi (ORCPT ); Mon, 28 Sep 2020 10:52:38 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74727C0613CE for ; Mon, 28 Sep 2020 07:52:38 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id z23so8878474ejr.13 for ; Mon, 28 Sep 2020 07:52:38 -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=pb2hEgRaRZDX0+sB29ngdH9rbWg1o3VgDq0s7JnHNBs=; b=FntVd3CAlGxvIH4D+noS3jlMmsCTpRkC5DCHq1JxdpEAXzkRTzYq261oz+W7Lof3vk hGokbGShQ01LM1tmcsHu+Hx//aZCwNyAU+V6nWjgmSn9sdxDcInd2Aue35dQbaKmZ9TZ NTJuZ8wCzV+W83TR6rvT+PfxVsyjAMsy6N8y8yiDtV9N6oKKLUgNwuYQXAQVY3eGFLh4 NZ2BmJpg3yCZmeiMWUKJaN3uVcpI5+sBo+b0pNvWOFGFcOuDNh5ayN9eyEI2LEXmhRa/ WZqvMztMmjoFxeg2m6w4QFLfng09t25Iv+k+WZG074s9e/uTZHlwMfK4p11mv8htlXZo tXNg== 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=pb2hEgRaRZDX0+sB29ngdH9rbWg1o3VgDq0s7JnHNBs=; b=Ruec/KUuiQM7hxY/W27NET78ibjv5xP4PzJ7/oUqDt9eytqNmO3ChBNM9rry//Ydxt zwQd6Md1dd22nyqLPN1DuBAMzmUYopvqrOZIRvelufu8DOyJpsjwXZR4UgNaL/ULlkAG bIwlLSwd4r8WzBA2HzM6eImx9dt7AIQWfkJVB0vK7EBH5TUnkSZhRGkAoD6lOeqQeQ6w SFQ1/wb74s2DjjM/xuF3qFaySXmOH6NNGCAH3IdGLiLm0tgO2J9isIq4zT6f8884CBke BBv8Xf2DwffqMQNA31/yHUzAkotfxyC8/4tbQ5nMbLL8sZxwJ16WT2ir+v0zy4Izv/AQ wEoA== X-Gm-Message-State: AOAM532ZLE5/1VYlRVH4fXy5WtM+kcrZbnv93DwhL03QkUxv0aw43jH3 Z69s/W32MZ4tBPW+D3aRnvDjhCMh88ZaxUFmHE4wZlLXGqs= X-Received: by 2002:a17:906:fccb:: with SMTP id qx11mr2049874ejb.429.1601304756574; Mon, 28 Sep 2020 07:52:36 -0700 (PDT) MIME-Version: 1.0 References: <20200928104155.7385-1-brgl@bgdev.pl> <20200928104155.7385-8-brgl@bgdev.pl> <20200928130023.GJ3956970@smile.fi.intel.com> <20200928140028.GO3956970@smile.fi.intel.com> In-Reply-To: <20200928140028.GO3956970@smile.fi.intel.com> From: Bartosz Golaszewski Date: Mon, 28 Sep 2020 16:52:25 +0200 Message-ID: Subject: Re: [PATCH v2 7/9] gpio: mockup: pass the chip label as device property To: Andy Shevchenko Cc: Bartosz Golaszewski , Linus Walleij , Jonathan Corbet , Kent Gibson , linux-gpio , linux-doc , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 4:00 PM Andy Shevchenko wrote: > > On Mon, Sep 28, 2020 at 03:13:53PM +0200, Bartosz Golaszewski wrote: > > On Mon, Sep 28, 2020 at 3:00 PM Andy Shevchenko > > wrote: > > > > > > On Mon, Sep 28, 2020 at 12:41:53PM +0200, Bartosz Golaszewski wrote: > > > > From: Bartosz Golaszewski > > > > > > > > While we do check the "chip-name" property in probe(), we never actually > > > > use it. Let's pass the chip label to the driver using device properties > > > > as we'll want to allow users to define their own once dynamically > > > > created chips are supported. > > > > > > > > The property is renamed to "chip-label" to not cause any confusion with > > > > the actual chip name which is of the form: "gpiochipX". > > > > > > > > ^^^ here, see below > > > > > > If the "chip-label" property is missing, let's do what most devices in > > > > drivers/gpio/ do and use dev_name(). > > > > > > ... > > > > > > > + snprintf(chip_label, sizeof(chip_label), > > > > + "gpio-mockup-%c", i + 'A'); > > > > + properties[prop++] = PROPERTY_ENTRY_STRING("chip-label", > > > > + chip_label); > > > > > > You added new property, now count is up to 4. But at the same time > > > > > > #define GPIO_MOCKUP_MAX_PROP 4 > > > > > > how do you avoid overflow? > > > > > > > I renamed the property, the previous "chip-name" is no longer used. In > > fact it was never used but was accounted for in GPIO_MOCKUP_MAX_PROP. > > Either I'm missing something or... > > Current code in linux-next has 3 properties to be possible > > PROPERTY_ENTRY_U32("gpio-base", base); > PROPERTY_ENTRY_U16("nr-gpios", ngpio); > PROPERTY_ENTRY_BOOL("named-gpio-lines"); > > You adding here > PROPERTY_ENTRY_STRING("chip-label", chip_label); > > Altogether after this patch is 4 which is maximum, but since array is passed by > a solely pointer, the terminator is a must. > Thanks for explaining my code to me. Yes you're right and I'm not sure why I missed this. :) I'll fix this in v3. Actually this means the code is wrong even before this series - it's just that we don't use the "chip-name" property. Bartosz