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 25D77C433FE for ; Mon, 6 Dec 2021 08:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239656AbhLFIpT (ORCPT ); Mon, 6 Dec 2021 03:45:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239568AbhLFIpP (ORCPT ); Mon, 6 Dec 2021 03:45:15 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E874C061354 for ; Mon, 6 Dec 2021 00:41:46 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id x15so39942058edv.1 for ; Mon, 06 Dec 2021 00:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kYsv0I6A6o5uFK+UPY8fyAiz1zz4uJD9KLB+ITvNrnU=; b=Na9oLGTjiwHYKrfq7A9Qz4LGmlnRJjcpjIOYPpDh/3BPi9g5o1X8rpVW4mP/sxLFWM hAuDGpKChArD8g+AXlU3xZp/f/CHbnKk1crqS++1O4gK3JoooqAizE3HZFSUN9B+eaqK 3CZjCwIC5WElGg5rbsUrL1k4xBeKlcgQZLyMBwKuYvrHfsbaL1C8bahRh0XklvAoVPZF VQN9nFEdammFsIlCeEssLeM5W9x/+5bmPw/SKWrmpagzgxdh6Q8E3taxBMV46/WvALY1 E6lPsbdWc7CDV7BKSnBtiGSzkK0b0Sk7YbTI4crokMt+UXLf3a/071HEN/2Woe91yaGy O2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kYsv0I6A6o5uFK+UPY8fyAiz1zz4uJD9KLB+ITvNrnU=; b=YXnj8KKXpf/FETGSJJ34q9CAoSECKOZPsxhT50b1SClVDNDBZiUhMYugge57EnbYd8 gwzynhktRuOUdo7yP4Fx3fiV9VkFGFAuojhRLI/izaqaVpwF+ebR2SFz3B0DQVR3wC1J QxBh3UqBCVuhtEXcRMY65ZPuw8Qxx0lzFpHjJ3z5UlIgJfGuXrmLbV99mtL5e/L4SxQq kqzgT2plmhiI6tWOuDv5t9/IsZPCySUppeurEocOW2cTRGRG3q16eXJCzrsb95w31JUd OKIqi0vFFrAD5N2nKGuglo4BTq8OCvWi4CxKFj6vN/bOrMC2dZFqbP0tYjoI4s3fFg5a l3ag== X-Gm-Message-State: AOAM533Y8+0lS/9YNe/HbaNRm0RW0T6aUQWEQh0e5vYzaXTjLK83bM16 eynsWGguPvMksJv7djJgtvSNEQGXuC3KeZfDWR/hBg== X-Google-Smtp-Source: ABdhPJwaXHvLPRG0pSMIzqzjXufeL6J34ZTE554GDIxU4BWMdqMOHmcM0b1i3AQuocmn3XKeV23g6rGKxx5cN6iGC/8= X-Received: by 2002:a17:907:c15:: with SMTP id ga21mr43076617ejc.349.1638780104294; Mon, 06 Dec 2021 00:41:44 -0800 (PST) MIME-Version: 1.0 References: <20211203133003.31786-1-brgl@bgdev.pl> <20211203133003.31786-4-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 6 Dec 2021 09:41:33 +0100 Message-ID: Subject: Re: [PATCH v12 3/7] gpiolib: of: make fwnode take precedence in struct gpio_chip To: Andy Shevchenko Cc: Kent Gibson , Linus Walleij , Shuah Khan , Geert Uytterhoeven , Viresh Kumar , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 3, 2021 at 9:10 PM Andy Shevchenko wrote: > > On Fri, Dec 03, 2021 at 08:28:34PM +0100, Bartosz Golaszewski wrote: > > On Fri, Dec 3, 2021 at 8:04 PM Andy Shevchenko > > wrote: > > > On Fri, Dec 03, 2021 at 08:56:27PM +0200, Andy Shevchenko wrote: > > > > On Fri, Dec 03, 2021 at 08:51:56PM +0200, Andy Shevchenko wrote: > > > > > On Fri, Dec 03, 2021 at 02:29:59PM +0100, Bartosz Golaszewski wrote: > > ... > > > > > > > if (gc->parent) > > > > > > gdev->dev.of_node = gc->parent->of_node; > > > > > > > > > > > > + if (gc->fwnode) > > > > > > + gc->of_node = to_of_node(gc->fwnode); > > > > > > + > > > > > > /* If the gpiochip has an assigned OF node this takes precedence */ > > > > > > if (gc->of_node) > > > > > > gdev->dev.of_node = gc->of_node; > > > > > > > > > > Similar should be done in acpi_gpio_dev_init(): > > > ^^^^^^ (1) > > ... > > > > If we have parent device for several GPIO devices, this won't work right now > > > due to limitations of fwnode regarding to the sturct device. > > > > > > So, it means we may not have shared primary with different secondary fwnodes. > > > > > > So, come back to the initial suggestion (overwrite it for now): > > > > > > /* > > > * If custom fwnode provided, use it. Currently we may not > > > * handle the case where shared primary node has different > > > * secondary ones. Ideally we have to use > > > * set_secondary_fwnode() here. > > > */ > > > if (gc->fwnode) > > > device_set_node(&gdev->dev, gc->fwnode); > > > > > > > Other parts of gpiolib-of depend on the of_node being there. > > Converting it to fwnode is a whole other task so for now I suggest we > > just convert the fwnode to of_node in struct gpio_chip as per my > > patch. > > But this is about ACPI counterpart. If you do this, do this in both cases. > Above code for ACPI (1). > This series concerns the gpio-sim driver and it only uses configfs (with manually created platform devices) or device-tree. I would prefer to do ACPI separately and I'd like you to lead that because I neither have any HW to test nor claim to understand it. :) Bart