Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3598198pxb; Mon, 21 Feb 2022 01:24:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw43kxgSJk5RQE+iuLtvp8ANKajjh7gjf6GMoEIdb9sWcSE8N2XqsekW87PDM0aDInlkkir X-Received: by 2002:a17:902:9682:b0:14e:fe33:64af with SMTP id n2-20020a170902968200b0014efe3364afmr18265901plp.160.1645435476501; Mon, 21 Feb 2022 01:24:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645435476; cv=none; d=google.com; s=arc-20160816; b=CocIpmXVOE8lHdXz1fipNECsXBdQL5GnGQ3MulPNUpmLwHqgqgxiItrY5kvzGBcVu6 S5oP8iuL/0rD6zPsoazQ1URmPu74qi8xlRP25VtHiu9q68e7ySZT8o4i4SdaQ8oHFMtr KIxF1csNwxuUDX/aFRRjj+u0V0zPmI7jOJGLCp19IZicrExHYkcUNenjtYXMRLUbuivw inVIrjM6S2D72AxUsezEmNI/Lt1Cb1GceoveA+N6Pbu7bhsln85DKQHq9Q3kBjSTL9Mg +a06z9futBaMYKoqxxMQjt8IyrYJbfCQ9gFWRW6focnUrujftgpG3USKOojnF2NoPFUz 0DTQ== 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 :dkim-signature; bh=J2peOWNPOGHBcrtQXRa+3tzy8RKpain9Vbe6pXfAxtc=; b=civ9+wVsBkpJbZaNWnXB85Y7/0giYw1tjUl3vnM/DJvJHDwkfNpyVaiftsI7Dj8NvR SkFkzlLRJLiJtigr98A/RnQHYphVYett4xtAjVyHfME+6sldrjYEW8Y3aYT/37+2ntaE yiVKOgKURZryYVkVXJ9LCmVvMxivj5UW55+Z73cMfu8jcTtx9iGDflcOn3QpW4rtk4uo 81QG5XYwhWRIIcD6p8bU6Ls+InR3TQppyDy9RNljHm6o8+OgvIFjlPE6/ZWDp/40kI0/ GvvUsLMX7d65uYpp4e1s7O262M612hvGBkVoZMDiqwAzD6YM4S02wl2ln8dG8nuck7Nv L50g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Duyfglcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 198si16745273pga.752.2022.02.21.01.24.22; Mon, 21 Feb 2022 01:24:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Duyfglcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235053AbiBTLSF (ORCPT + 99 others); Sun, 20 Feb 2022 06:18:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiBTLSD (ORCPT ); Sun, 20 Feb 2022 06:18:03 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E85143AFB; Sun, 20 Feb 2022 03:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645355863; x=1676891863; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wFiGHzKu/gkWdPi94TIZ1NxsAlvi0yITyD0myZyZrQc=; b=DuyfglcsIbXJoAUdkKW4gcOJXIEti9jsjsslsMnu2O5xQjq3rtaGbncv m4U7b+iNLzJtWwh+lt+1p0rCuOPKjXTFUJ9yqzM+CRSZOk9rw9j5TsYhY iQXBNAomp/lJI4RFKy2omkc5ok0nFDIzATZ5xolAtOuEnRFnHCbykcv79 4JJNq4HMIkKZsptTN2RVZSHXhED3dNSbsg6sLbcHuTqfYhlobDYskYYXQ 8iUGIf9ENP4/Mq3yO9lQ9xGSuqpRKhQgV5lTofDvAnoEhsTDMU4Pdv9xa Y+J0dgOVpZ7iE7nw2+z+eARWRSDEldZpYERm1tYvElGVgTICJ9fbEHL+y g==; X-IronPort-AV: E=McAfee;i="6200,9189,10263"; a="337795825" X-IronPort-AV: E=Sophos;i="5.88,383,1635231600"; d="scan'208";a="337795825" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2022 03:17:42 -0800 X-IronPort-AV: E=Sophos;i="5.88,383,1635231600"; d="scan'208";a="638243794" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2022 03:17:39 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nLkCs-006Uow-OJ; Sun, 20 Feb 2022 13:16:46 +0200 Date: Sun, 20 Feb 2022 13:16:46 +0200 From: Andy Shevchenko To: Bjorn Andersson Cc: Rob Herring , Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Hans de Goede , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Dmitry Baryshkov Subject: Re: [PATCH v2 1/6] device property: Helper to match multiple connections Message-ID: References: <20220208031944.3444-1-bjorn.andersson@linaro.org> <20220208031944.3444-2-bjorn.andersson@linaro.org> 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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 18, 2022 at 11:00:45AM -0800, Bjorn Andersson wrote: > On Wed 09 Feb 04:30 PST 2022, Andy Shevchenko wrote: > > On Mon, Feb 07, 2022 at 07:19:39PM -0800, Bjorn Andersson wrote: ... > > > +int fwnode_connection_find_matches(struct fwnode_handle *fwnode, > > > + const char *con_id, void *data, > > > + devcon_match_fn_t match, > > > + void **matches, unsigned int matches_len) > > > +{ > > > + unsigned int count; > > > + > > > + if (!fwnode || !match || !matches) > > > > !matches case may be still useful to get the count and allocate memory by > > caller. Please, consider this case. > > > > As discussed in previous version, and described in the commit message, > the returned value of "match" is a opaque pointer to something which > has to be passed back to the caller in order to be cleaned up. > > E.g. the typec mux code returns a pointer to a typec_mux/switch object > with a refcounted struct device within, or an ERR_PTR(). > > So unfortunately we can must gather the results into matches and pass it > back to the caller to take consume or clean up. It's fine. You have **matches, means pointer of an opaque pointer. What I'm talking about is memory allocation for and array of _pointers_. That's what caller very much aware of and can allocate on heap. So, please consider this case. -- With Best Regards, Andy Shevchenko