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 E0129CA0FF8 for ; Tue, 5 Sep 2023 16:45:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232764AbjIEQpO (ORCPT ); Tue, 5 Sep 2023 12:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354551AbjIEMfj (ORCPT ); Tue, 5 Sep 2023 08:35:39 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED0981AD; Tue, 5 Sep 2023 05:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693917335; x=1725453335; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=6lmLJ6H5zU3EUldRsqwHO7V8tPddeVLvBnfcVZaU8Ek=; b=TWSg4ROTl4qbTNZ8rxM8TK59bTMFFKxvYueiNyDL7bx4S/6HUeLrFt9Q LKnHrTwvdUvxKQqcQhJ36rg9wxBTK7aGR+jzwEoLfzJdZNDrx64fTNSyz DIGI8fnWYcoVu/sGXnXhqqDLbapphXE//gdUvBV3b0tts/Xn0LwoQD9Sm jPQX1dQnUuFnbQJTgfss0inWfPDWjxNGFjZysnX1v1w/daX/ZJxPrGiR5 fFFWKpcK+xYGOPJwzVmjD7Mut66VSc6hORXIoxL/BYfqjckg+sPaO6k/C OBVtNmH3GtVcC4rb/tJbIwrqAmIqPj6uLNlvqVtzTSWCf2ljM5/11/ugg Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="357090284" X-IronPort-AV: E=Sophos;i="6.02,229,1688454000"; d="scan'208";a="357090284" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 05:35:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="744256861" X-IronPort-AV: E=Sophos;i="6.02,229,1688454000"; d="scan'208";a="744256861" Received: from unknown (HELO smile.fi.intel.com) ([10.237.72.54]) by fmsmga007.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 05:35:33 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qdVHH-006gZh-0h; Tue, 05 Sep 2023 15:35:31 +0300 Date: Tue, 5 Sep 2023 15:35:30 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Kent Gibson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v3] gpio: sim: don't fiddle with GPIOLIB private members Message-ID: References: <20230905082413.21954-1-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 Tue, Sep 05, 2023 at 02:10:38PM +0200, Bartosz Golaszewski wrote: > On Tue, Sep 5, 2023 at 2:09 PM Andy Shevchenko > wrote: > > On Tue, Sep 05, 2023 at 03:05:17PM +0300, Andy Shevchenko wrote: > > > On Tue, Sep 05, 2023 at 10:24:13AM +0200, Bartosz Golaszewski wrote: ... > > > > + chip->swnode = swnode; > > > > + ret = device_for_each_child(dev, chip, gpio_sim_chip_set_device); > > > > + if (!ret) > > > > + return -ENODEV; > > > > > > Can bus_find_device_by_fwnode() be used here? > > > > Answering to myself: you already mentioned that this should cover any bus, > > so the answer is "no". > > I think I mentioned it under the gpio-consumer where it's true. Here > we are sure it's on the platform bus. Then bus_find_device_by_fwnode() can be used here, no? > > But also we have device_find_child() if I understood the purpose of the above > > it should suit better, no? > > Right, it's a better match. In either case be careful about reference counting on the returned dev. -- With Best Regards, Andy Shevchenko