Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp203690pxu; Thu, 7 Jan 2021 02:38:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQf+Mf2U8aifFOldZ0N7YiDBvBjPm30UMIFh6A7hPX2r6FGrsUd1vzUi4hg6V4tGzplTCl X-Received: by 2002:a17:906:ca08:: with SMTP id jt8mr5572007ejb.368.1610015922282; Thu, 07 Jan 2021 02:38:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610015922; cv=none; d=google.com; s=arc-20160816; b=HJ4W+9F7CVqXH6y9Ul1KItJhay1jY7jA4Zd3W4WD0IabvlPd67c2rGw6YAfjrkykvC HfdOye4duqWrGVfmggViItAhM9K5BAyKqQzRUnGZ7TPGHvqEof1esXLs9D8j3fHctfDz M65OvYSacarzVWbFAYvivofvaMR6neIu7/BKfB5OiJcgTqqqWOb4bmaTU9v+2lGqjX5y vfvN0NfAotj53R837SY7ujfucD45Pd9M4MR2+LjuQROWWI54oLim+rzDor2yqrIQb0dm cJhuOISRrO9eKQfGLx6TTuO+SlHZso8cKJ+YXFjLTnKRlWAeznzJ5fCeZ54iwRTQjIdO eQyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nFfGlH5hXwbuaYUBsZBOfb6uPO2NVxjByxMtfTjhGZ4=; b=jg8y+D04gkapAsDpu5pVkMLWiF/Tw01XILizIT9Ii3pGcgfsbF+KnWafVMCjPfd+hA Gl81+wx2yO9S6dxeZxvQeTrPTZXZiHenRhGq8vByAmQ5eXeOBQQeKtWCZioX4N251JBV qcql84Ic8g/znkCwrFy5By+QDjRuKsGyPPnAQFqarpSzpxdVJjCTmeqONsOnUfI6wlZ6 cWKvW40J5T2edbvFlnSzRJTTEWo1y+wI2Wl/sfv0u7lzBLdojCIH+YrzIQE0tGxfL0+Y w5DPNz1K6TRZ/IJAqT0+q3be+bUIq8HkPPksXFXNWOOBTo3BiQWvUUEVCHJE6WVBS8hr mbLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OvqgYG5G; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co9si2087517edb.379.2021.01.07.02.38.18; Thu, 07 Jan 2021 02:38:42 -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; dkim=pass header.i=@linaro.org header.s=google header.b=OvqgYG5G; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbhAGKhe (ORCPT + 99 others); Thu, 7 Jan 2021 05:37:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727757AbhAGKhe (ORCPT ); Thu, 7 Jan 2021 05:37:34 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 672CCC0612F8 for ; Thu, 7 Jan 2021 02:36:53 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id m25so13363972lfc.11 for ; Thu, 07 Jan 2021 02:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nFfGlH5hXwbuaYUBsZBOfb6uPO2NVxjByxMtfTjhGZ4=; b=OvqgYG5GfLnUWMDVt7fwGeXDObUORXSH+iOnzildwroxSkzsO/YzNGjGRmbA7SYLPV x8nxD4BNfcPV6O2VQ+H2sXHcBagqd3oT5/cSajzlk/tGpxe5DIt7+J21on5fSDkjwPBE je997Wma6HpOQpxEn74aFuJskTFroRdqupPPP1RoadoStwgVfKrRXLnEMJg0nXKpjFb+ thRNzVOAUQJk/fJDOvb08chmTAZOJx1FawgClXTTJ56ubJsL96r4ruCXLe076I2FlDey l3Uyye8Vb8lv6IQvas953SreICCTijWTJEp7H8IMUn+A6U4qpQbflPXJ5xuWSeugoT+N nk3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nFfGlH5hXwbuaYUBsZBOfb6uPO2NVxjByxMtfTjhGZ4=; b=r7k5dHR3XVVLuQDmSpsvrS8pqmj9FFP1QRwMMRDYaogQi/vq75/PnJgD9n74W7PskA uSLTJytp7XOMgeaVN4NLAjzAH4sqPySt4SXkbCNtf3ZTX1wzMOPQeCL5Qftq3kQoQzIB yYtqLVuBo/sxGAo4riqd5jjdo5yiprfi1YZEOSrlcTGk/NN3kGcwQCvqGu++ahMOgClF bz+jY6tvfchpKV+L0iOQ3SKK/KOO/lxDM29j9wZOFXJRsIyhCzEBSiCmDg9HnmKFLOQA rCmSbUXN7YzTKF8i6AKd/m1chwsnaCtbwqgoXXFTs+HYCqVMbRESzezEbcS0FG2oum5U ejZA== X-Gm-Message-State: AOAM5333mwCYlsrwcDjy7zsRnZKtnNVWCvsgxeH1u1xJB+Z89L1ON4rc LrfBAzMKfkrvwFIzJSuwIjDw/wFDOhYOgBNFGpj2Eg== X-Received: by 2002:a05:6512:74e:: with SMTP id c14mr4116363lfs.529.1610015811936; Thu, 07 Jan 2021 02:36:51 -0800 (PST) MIME-Version: 1.0 References: <20201004162908.3216898-1-martin.blumenstingl@googlemail.com> <20201004162908.3216898-4-martin.blumenstingl@googlemail.com> In-Reply-To: From: Linus Walleij Date: Thu, 7 Jan 2021 11:36:40 +0100 Message-ID: Subject: Re: [RFC PATCH 3/3] gpio: ej1x8: Add GPIO driver for Etron Tech Inc. EJ168/EJ188/EJ198 To: Martin Blumenstingl Cc: Bjorn Helgaas , linux-usb , linux-pci , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:GPIO SUBSYSTEM" , Rob Herring , Bartosz Golaszewski , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 6, 2021 at 4:17 PM Martin Blumenstingl wrote: > > > unfortunately this means that xhci-pci now depends on xhci-pci-etron. > > > for xhci-pci-renesas this is fine (I think) because that part of the > > > code is needed to get the xHCI controller going > > > but for xhci-pci-etron this is a different story: the GPIO controller > > > is entirely optional and only used on few devices > > > > I might be naive but should it not be the other way around? > > That xhci-pci-etron is dependent on xhci-pci? I imagine > > it would be an optional add-on. > > the only way to achieve this that I can think of is to basically have > xhci-pci-etron implement it's own pci_driver and then call > xhci_pci_probe, xhci_pci_remove, etc. > but then it depends on the driver load order if the GPIO controller is exposed > > what structure did you have in mind to achieve this? Something that is compiled and called conditionally with stubs in the local .h file. Kconfig: config FOO tristate "Main matter" config FOO_ADD_ON tristate "Optional on" depends on FOO Makefile: obj-$(CONFIG_FOO) += foo.o obj-$(CONFIG_FOO_ADD_ON) += foo-add-on.o foo.h: struct foo { ... }; #if IS_ENABLED(CONFIG_FOO_ADD_ON) int foo_add_on_init(struct foo *); #else /* No CONFIG_FOO_ADD_ON */ static int foo_add_on_init(struct foo *) { return 0; } #endif foo.c: #include "foo.h" ret = foo_add_on_init(foo); (...) foo-add-on.c: int foo_add_on_init(struct foo *) { (...) } EXPORT_SYMBOL_GPL(foo_add_on_init); > > Make sure the etron part is an additional module that can be > > loaded after xhci-pci. > > my approach from above unfortunately would not achieve this > so if you have an idea how to achieve this (or have any other driver > in mind that I can use as reference, even if not related to > GPIO/USB/PCI then please let me know) See per above. I don't see any problem with this, it will be an additional module that does not feature a probe() call and device driver bind. I think it is also possible to link both files into the same object if the optional add on is enabled, so it is part of the main module when modprobing. The foo.h stubs are still needed, then the binary will just be smaller if the add-on is not enabled. There are solutions like this in the kernel, I just don't remember one right now so grep around. Yours, Linus Walleij