Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3373123pxb; Mon, 9 Nov 2020 09:27:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHG6ixHJ75+6hQRBJm2/5yitsaD9wAhBE691M49zDSUd1FB2t9DThruhmPbzjGxjmRStm1 X-Received: by 2002:aa7:c4c2:: with SMTP id p2mr16979734edr.371.1604942858503; Mon, 09 Nov 2020 09:27:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604942858; cv=none; d=google.com; s=arc-20160816; b=TQByMmrQmlwvZifp8hey7CpHkqTL2Dts6myxReIJ6W92cx6QkHyqo6/eSkW5dIjuV+ tQ6x9sy/eYv53RtwXMEc+guP/dfhRexfI0Zm0u/meFhryqhuHFL1Nzu2t5Lpv3OFLpXM ooIRWtY2dl7exdv2gNvTwuLlYiKkVBOJB1Gzx8xU1aiVXLwsHT2eRCjeS3XYFaIra4Mq 87ChqDopIrLK2qqm1g1ALmnLmv7LRF2C68IcnqihYwDLidi83M0+fQ1zR1gLL1crePO6 aDgqpFiDnrv/E/0g2+UHJ3kJCK4EcFAecQrvlcWkRKVcYHTBrMgCdGfjJ9/QSsc08sZW W9zQ== 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=mKFubmKMw0PDhBQ2pzPvXXRqDIT7LT5eksu6X+RpE0o=; b=gUoHpwftwPkSUK/LkuXHbZbXI2amyn3bd/Hihtk/7dFX8Ju/AZKjZ3lVZ2moQIwIi5 UqAnKntyxdCSpvTwXrmLvkok+Rmg/AuqV1ebDk0V0GiBH9+5q5aMKqyo/V6AwUxTagwJ XmOOoFm8xqjPCT74xzjwCCiWz5rNQfDQ03v60HWOcTdzrRIu/kd1mq3M6pZ4ZU/wju4t FPQzmUkgVwUZBpIPBPiczoTTZoW3EWRa61k4LTBEnTv+JFrFgE4tQgzGds9Ubtlmd3Qp OXO7v1UqqMF74ScULD5RIuToxg1bOIIQFrMo6HLKiot40Enln+d8GM6MVtxdVp170M2H jYTQ== 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 o18si7581308edr.500.2020.11.09.09.27.15; Mon, 09 Nov 2020 09:27:38 -0800 (PST) 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 S1730931AbgKIRXi (ORCPT + 99 others); Mon, 9 Nov 2020 12:23:38 -0500 Received: from mga02.intel.com ([134.134.136.20]:43094 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730315AbgKIRXh (ORCPT ); Mon, 9 Nov 2020 12:23:37 -0500 IronPort-SDR: xxlME6wkNqhOqBF4UxtsSs4VFuysoUXgxnCqAne18ZzkNtnC8rr7IaOm8rUlHUucsF09DIA7JX mSWpy6rVyLNA== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="156845543" X-IronPort-AV: E=Sophos;i="5.77,463,1596524400"; d="scan'208";a="156845543" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 09:23:36 -0800 IronPort-SDR: 8onsfZOFzt4e0C2bbif6I2wUeGTYo+Lq+K3T8j9WoPRkkUACsHwlLWexCCK0F66sxp7bq950hV deZvTmVWgoGg== X-IronPort-AV: E=Sophos;i="5.77,463,1596524400"; d="scan'208";a="327337190" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 09:23:33 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kcAuB-005F9X-8Q; Mon, 09 Nov 2020 19:24:35 +0200 Date: Mon, 9 Nov 2020 19:24:35 +0200 From: Andy Shevchenko To: Lukasz Stelmach Cc: Dmitry Torokhov , "Rafael J. Wysocki" , Heikki Krogerus , Mika Westerberg , Linus Walleij , Ard Biesheuvel , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Marek Szyprowski , Bartlomiej Zolnierkiewicz Subject: Re: [PATCH v8 3/6] software node: implement reference properties Message-ID: <20201109172435.GJ4077@smile.fi.intel.com> References: <20191108042225.45391-1-dmitry.torokhov@gmail.com> <20191108042225.45391-4-dmitry.torokhov@gmail.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, Nov 09, 2020 at 06:02:29PM +0100, Lukasz Stelmach wrote: > It was <2019-11-07 czw 20:22>, when Dmitry Torokhov wrote: > > It is possible to store references to software nodes in the same fashion as > > other static properties, so that users do not need to define separate > > structures: > > > > static const struct software_node gpio_bank_b_node = { > > .name = "B", > > }; > > > > static const struct property_entry simone_key_enter_props[] = { > > PROPERTY_ENTRY_U32("linux,code", KEY_ENTER), > > PROPERTY_ENTRY_STRING("label", "enter"), > > PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW), > > { } > > }; > > > > Signed-off-by: Dmitry Torokhov > > --- > > I am writing a piece that needs to provide a list of gpios to a > diriver. The above example looks like what I need. Nope. It mustn't be used for GPIOs or PWMs or whatever that either should come via lookup tables or corresponding firmware interface. > At the moment the driver gets the list from fwnode/of_node. The list > contain references to phandles which get resolved and and the driver > ends up with a bunch of gpio descriptors. Great. > > This example looks nice but does the code that reads the reference from > the gpios property and returns a gpiod actually exist? If it doesn't, I > am willing to write it. > > At first glance it makes more sense to me to pass (struct gpiod_lookup > *) instead of (struct software_node *) and make gpiolib's gpiod_find() > accept lookup tables as parameter instead of searching the > gpio_lookup_list? Or do you think such temporary table should be > assembled from the above structure and then used in gpiod_find()? > > Any other suggestions on how to get a bunch of gpios (the description > for gpios is available in the devicetree) for a device described with a > software nodes? -- With Best Regards, Andy Shevchenko