Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3041138pxk; Mon, 28 Sep 2020 07:02:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvR4SDdW+vNMprTCEx8Pvt0lyaDCO2sehLToB+wiCf7i8gKd5LTIo38U6cUvL90jQnIVnl X-Received: by 2002:a17:906:6b0b:: with SMTP id q11mr1866932ejr.412.1601301748410; Mon, 28 Sep 2020 07:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601301748; cv=none; d=google.com; s=arc-20160816; b=FSMSg0IycZg5q9jwZym3Ej6PAfVQtB5rQxpcjLPtwKExOmqgeRdKwE4Nxb/mkVvGsh 8Q6dqb23VqZEapJ0is/1h4fJswQ/IpChvp/369K9uBCWYhCM5ozMx5o1g/ULsYrOijLM /SrHgLEfzFvwmak+VXJgGKi5KGnlJJeUzOYsPenxsdgPHYMhBSY8rYaVc/cHL/NraBhq iJekbdtJNdLKeQSNr5MDILk+2rCZhpuijyHVhUZBAkGvhQihIennZDH1wVEuy9mVvWl2 voTtz/kZCf4fS+0LA9rt9hep69gAzgLc9Eb0JvB4WsvRJ5dxwPNIL/DI8LFGoCgpLcxf OoHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=F7sVonc1OPq+ihNzOeK0cCctvkIzcA3QYv3FyTJgyww=; b=yqz47XQc6d1ROfzBAtX/ofu+DXGUmitL99/P2ZGfBazfHGzWA0oTHdhnwnf8FWdfQc imfMK8UuC/fkNumg+rF8zuDegAjQ3dsiHbVLMGcD/7E5rxW/qD19+TEZF0q2tFsixIdW XROGDG/zt7O6N/Fjc13Ai6eHvqZyY+vKM8SCWWuoBjwzrCc8E1k/002d2MB/LY4xuN8K tOSarxvKy8z4zO7yxBjb33JJ9EEXp3KLuWxzYQNJAUDfR8xz7i68qhF6QGeCbSYNjoBY mTB82ZYJ2+hFYnj0LsS7jfXVTHDUcQ4UK5GD8sWLi17hUpZ7822ZXGKWsqqmypy/zEfU mc/A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si626388ejx.712.2020.09.28.07.02.02; Mon, 28 Sep 2020 07:02:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726485AbgI1OAh (ORCPT + 99 others); Mon, 28 Sep 2020 10:00:37 -0400 Received: from mga06.intel.com ([134.134.136.31]:24872 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbgI1OAg (ORCPT ); Mon, 28 Sep 2020 10:00:36 -0400 IronPort-SDR: jSeUvsbFEYcAhIO1tNRw3IdWScXeUnzd+zuEDF1fBcJxErukwvB5ya46rchtiqOHeuzp6V4G9f vNoMSp2UXTHw== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="223590527" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="223590527" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 07:00:35 -0700 IronPort-SDR: 5jLQCLLh3KcK8aGFbbCzqv3iW/C+MB5YBdG/iR3D1c6+5eZbnDiuDhyTO3Vkhz9rR/d4V2RYPY BavmS1IsEnfA== X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="338193646" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 07:00:33 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kMthc-002ZfX-De; Mon, 28 Sep 2020 17:00:28 +0300 Date: Mon, 28 Sep 2020 17:00:28 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Linus Walleij , Jonathan Corbet , Kent Gibson , linux-gpio , linux-doc , LKML Subject: Re: [PATCH v2 7/9] gpio: mockup: pass the chip label as device property Message-ID: <20200928140028.GO3956970@smile.fi.intel.com> References: <20200928104155.7385-1-brgl@bgdev.pl> <20200928104155.7385-8-brgl@bgdev.pl> <20200928130023.GJ3956970@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- With Best Regards, Andy Shevchenko