From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E473AE80AA6 for ; Wed, 27 Sep 2023 13:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231984AbjI0Nsh (ORCPT ); Wed, 27 Sep 2023 09:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbjI0Nse (ORCPT ); Wed, 27 Sep 2023 09:48:34 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27B7D121; Wed, 27 Sep 2023 06:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695822513; x=1727358513; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=iNqkbzBKdsM1K2XrkEqjYDoPQ/oFpePtITJItg0KYTA=; b=mqHLCKnzZ8xjDmTamvHmZlSX3s8wr7X5tGZk5PUcY69a3qFdLY1roorY k05RE/l6GyyaK0ukgCSroEyqj4P1W3OqjahzGIBJfKrgRwRkC1ob0zhy+ fUYUk7yxUO9b0uWPCevgXIn3jEo4Jn8H3YkB2nsdZ5b9q1EJ/ZuMmcfO9 cUw1eR7CCIdyeBUaMjEoE78+SSL0Ji5H57/ZAygCLI/C3gImCJ+zL1db0 UG+hoU7t4IPexAA6Oh0F0xx0Pw1ADI6FWrbvQwitMCtADDhRAvbg0zbL7 y6sSGMMre//mg9154hDqriIVjuJvEiu1fG9IuLDrPPQn1OidS2fDBMvct g==; X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="366888121" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="366888121" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 06:48:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="749212402" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="749212402" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga002.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 06:48:30 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1qlUtv-00000000tvO-3DF4; Wed, 27 Sep 2023 16:48:27 +0300 Date: Wed, 27 Sep 2023 16:48:27 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Mika Westerberg , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v3 04/11] gpiolib: provide gpio_device_find_by_label() Message-ID: References: <20230915150327.81918-1-brgl@bgdev.pl> <20230915150327.81918-5-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 Wed, Sep 27, 2023 at 02:42:28PM +0200, Bartosz Golaszewski wrote: > On Wed, Sep 27, 2023 at 2:33 PM Andy Shevchenko > wrote: > > On Wed, Sep 27, 2023 at 01:22:36PM +0200, Bartosz Golaszewski wrote: > > > On Mon, Sep 18, 2023 at 9:19 AM Andy Shevchenko > > > wrote: > > > > On Fri, Sep 15, 2023 at 05:03:19PM +0200, Bartosz Golaszewski wrote: > > > > > From: Bartosz Golaszewski ... > > > > > +static int gpio_chip_match_by_label(struct gpio_chip *gc, void *label) > > > > > +{ > > > > > + return gc->label && !strcmp(gc->label, label); > > > > > +} > > > > > > > > I am still wondering if we can oblige providers to have label to be non-empty. > > > > > > Of course we can. Just bail out of gpiochip_add_data_with_key() if it > > > is. But that's material for a different patch. > > > > Yes, but my point here is that > > 1) the current users are already following this requirement; > > 2) the enforcement can be done explicitly somewhere (in the register function). > > > > Is the 1) incorrect assumption? > > I remember doing a quick glance over GPIO providers and it looks like > ALL of them set the label. But I may have missed something. I would > start with a warning. For now I would drop the NULL check. We will have a few weeks to see if somebody screams about. Meanwhile we can add the real error message patch if no-one complains. -- With Best Regards, Andy Shevchenko