From patchwork Thu Jun 30 19:35:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 586299 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 A93DCCCA482 for ; Thu, 30 Jun 2022 19:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236823AbiF3Tfi (ORCPT ); Thu, 30 Jun 2022 15:35:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236739AbiF3Tfi (ORCPT ); Thu, 30 Jun 2022 15:35:38 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABA304132B for ; Thu, 30 Jun 2022 12:35:36 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id p14so365565pfh.6 for ; Thu, 30 Jun 2022 12:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nMR3w2slRmIoMgD9RUa7XssGwQFlVgMDP5zlNPfT9rg=; b=htnbQRhXh0XK4DxF3roI1PzQJuqFiWeh7p5k55PXd6dQHF2ilOGnTc6LvTrtFRChqO Pc91ZYD+8jq6ia1q3d/zK3VQzbgtvNH2eGOV8fHjTbCzmaqM81LIuBKt0kngeM6vWAJL fpk5T3QlnqVzxhTDymGofiJWLyt+E9a2DH05o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nMR3w2slRmIoMgD9RUa7XssGwQFlVgMDP5zlNPfT9rg=; b=Qpm5ioTjIgB2g6jRDEIikfP1yZlTvbrPYzIZZu8/BpaowBJfec90WmkkNeGR/qx7K9 p6HJsgB30M9eYWjGgT8S5XsDVmXMtwBataX+52/UUxR5VCUB7MJ9Tux7XiyssyUBYBCR pEFxoPEVgJWi5kfceEQRkIq6yO72bUrmtofOtK82S5TryirGxJR9KPsL9vhBFsL2LH6u rH7xIMVvzZoKe9lMQgjzlzFwYoc3Tl+oaqIn3Z1lSPAetpujL7/YsW0wunUMUKK6lDTi prfFLPtFykDXXd+tQOjuyMOVEy0jNH79dKswO5ThH5AXxnqiMgEEJwzyM5icjmrmk3Ou UaWA== X-Gm-Message-State: AJIora/xP4E8yI88HNprOfs5iJxwnaU8QUJDew0eHGe97ZVxEWhV5B8s SkyIMkHrNnmW7OBbctKT/cToaA== X-Google-Smtp-Source: AGRyM1tOxkExkVLxKKqPo2pR0OwHCeR3W+4BknYMewioXwUMJxXur9nVHSyqcbLRH4HlXvTk69vHrQ== X-Received: by 2002:aa7:8e9e:0:b0:525:1d15:8fb8 with SMTP id a30-20020aa78e9e000000b005251d158fb8mr15976510pfr.35.1656617736165; Thu, 30 Jun 2022 12:35:36 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:9fbf:277c:23e1:eabb]) by smtp.gmail.com with UTF8SMTPSA id x1-20020a17090300c100b0016a33177d3csm13772541plc.160.2022.06.30.12.35.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jun 2022 12:35:35 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Douglas Anderson , Michal Simek , linux-usb@vger.kernel.org, Ravi Chandra Sadineni , Roger Quadros , Bastien Nocera , Peter Chen , Stephen Boyd , Krzysztof Kozlowski , Matthias Kaehlcke , Rob Herring Subject: [PATCH v24 1/4] of/platform: Add stubs for of_platform_device_create/destroy() Date: Thu, 30 Jun 2022 12:35:27 -0700 Message-Id: <20220630123445.v24.1.I08fd2e1c775af04f663730e9fb4d00e6bbb38541@changeid> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220630193530.2608178-1-mka@chromium.org> References: <20220630193530.2608178-1-mka@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Code for platform_device_create() and of_platform_device_destroy() is only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved symbols when CONFIG_OF_ADDRESS is not set. Signed-off-by: Matthias Kaehlcke Acked-by: Rob Herring Reviewed-by: Stephen Boyd Reviewed-by: Douglas Anderson --- Changes in v24: - none Changes in v23: - none Changes in v22: - none Changes in v21: - none Changes in v20: - added 'Reviewed-by' tags from Stephen and Doug Changes in v19: - still no changes ... Changes in v18: - still no changes ... Changes in v17: - none Changes in v16: - none Changes in v15: - none Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - added Rob's 'Acked-by' tag Changes in v8: - fixed C&P error in commit message Changes in v7: - none Changes in v6: - patch added to the series include/linux/of_platform.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 84a966623e78..d15b6cd5e1c3 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -61,16 +61,18 @@ static inline struct platform_device *of_find_device_by_node(struct device_node } #endif +extern int of_platform_bus_probe(struct device_node *root, + const struct of_device_id *matches, + struct device *parent); + +#ifdef CONFIG_OF_ADDRESS /* Platform devices and busses creation */ extern struct platform_device *of_platform_device_create(struct device_node *np, const char *bus_id, struct device *parent); extern int of_platform_device_destroy(struct device *dev, void *data); -extern int of_platform_bus_probe(struct device_node *root, - const struct of_device_id *matches, - struct device *parent); -#ifdef CONFIG_OF_ADDRESS + extern int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, @@ -84,6 +86,18 @@ extern int devm_of_platform_populate(struct device *dev); extern void devm_of_platform_depopulate(struct device *dev); #else +/* Platform devices and busses creation */ +static inline struct platform_device *of_platform_device_create(struct device_node *np, + const char *bus_id, + struct device *parent) +{ + return NULL; +} +static inline int of_platform_device_destroy(struct device *dev, void *data) +{ + return -ENODEV; +} + static inline int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, From patchwork Thu Jun 30 19:35:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 586298 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 19C51C43334 for ; Thu, 30 Jun 2022 19:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236916AbiF3Tfs (ORCPT ); Thu, 30 Jun 2022 15:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236889AbiF3Tfn (ORCPT ); Thu, 30 Jun 2022 15:35:43 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B79443AFE for ; Thu, 30 Jun 2022 12:35:42 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id n16-20020a17090ade9000b001ed15b37424so424212pjv.3 for ; Thu, 30 Jun 2022 12:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HPqBYBlLTOMK1qOOrCVZV8mMsTTnAaW6SeEmmR24dkw=; b=JgU/8dDdLh39FOHDtB4AmUWjf7ovmaGZuK/G8C1PG/C/tYs735zbQK0N/MnZlnSPLB ZLK10V1TD8tvUZXXl9Ko8jDPOCz8/3m124YGDC9/2FXlcTKGUbo6f+Rex7iF+7A195kQ rJ6uJKAq9QbVm/Vk4hmgV2uKn+MTr34Wk+ZPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HPqBYBlLTOMK1qOOrCVZV8mMsTTnAaW6SeEmmR24dkw=; b=VOZFpDwlAPxhNy7ZHU4Nsw6lI6TSQUtzhTt0C4TZ9TqMYy09fXdeDmwHGgjN6V1yBr i7XGDuH5MVKHPTHOcyTziKWBGChxu/mDwMjtk0X75nrBcY8ErvUOMZMPoTv8g4w4yN4d DRgzdTydTgJSmv2uUax9G2vl6zJkC6QSgJf0CHotdVZ8C3ZhoPb2s5MSzDFZN4KstdjY ouWg3UFxiQZdr/vq6f8xHgUU8nQpTu2um0lNwHWwfkAcLNR3lo9G5BAFYesbPKgIT5Av LZOBP/MIjIawEYxI9FevtpGs92MjdA+lNa0vAcdhL3+Doo03IKQw+7jz1CEcQof2qWBB 0bNA== X-Gm-Message-State: AJIora+OnrzXMSbVMYBBsrgYtuWxgBX3gyKAYcHxn5fiU3UW3yceJevC vHJ/R7WocILlnoPVoMTZrAghOA== X-Google-Smtp-Source: AGRyM1vKEnFsSb/7xvOUe8N53dVQYfzaU0mqetLQxEbvbMl83VqlJ3+QnERF74meQu8+e3UuCc1hrw== X-Received: by 2002:a17:902:c950:b0:16b:8ec7:b34 with SMTP id i16-20020a170902c95000b0016b8ec70b34mr16017029pla.143.1656617741784; Thu, 30 Jun 2022 12:35:41 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:9fbf:277c:23e1:eabb]) by smtp.gmail.com with UTF8SMTPSA id be19-20020a056a001f1300b005254c71df0esm13732068pfb.86.2022.06.30.12.35.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jun 2022 12:35:41 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Douglas Anderson , Michal Simek , linux-usb@vger.kernel.org, Ravi Chandra Sadineni , Roger Quadros , Bastien Nocera , Peter Chen , Stephen Boyd , Krzysztof Kozlowski , Matthias Kaehlcke , Bhuvanesh Surachari , Dan Carpenter , Kai-Heng Feng , Mathias Nyman , Vincent Mailhol Subject: [PATCH v24 4/4] usb: core: hub: Create platform devices for onboard hubs in hub_probe() Date: Thu, 30 Jun 2022 12:35:30 -0700 Message-Id: <20220630123445.v24.4.Ic9dd36078f9d803de82ca01a6700c58b8e4de27e@changeid> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220630193530.2608178-1-mka@chromium.org> References: <20220630193530.2608178-1-mka@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Call onboard_hub_create/destroy_pdevs() from hub_probe/disconnect() to create/destroy platform devices for onboard USB hubs that may be connected to the hub. The onboard hubs must have nodes in the device tree. onboard_hub_create/destroy_pdevs() are NOPs unless CONFIG_USB_ONBOARD_HUB=y/m. Also add a field to struct usb_hub to keep track of the onboard hub platform devices that are owned by the hub. Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson --- Changes in v24: - none Changes in v23: - added Doug's 'Reviewed-by' tag Changes in v22: - patch added to the series (moved creation/deletion from HCD) drivers/usb/core/hub.c | 9 ++++++++- drivers/usb/core/hub.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 68e9121c1878..8055130ee602 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1752,6 +1753,8 @@ static void hub_disconnect(struct usb_interface *intf) if (hub->quirk_disable_autosuspend) usb_autopm_put_interface(intf); + onboard_hub_destroy_pdevs(&hub->onboard_hub_devs); + kref_put(&hub->kref, hub_release); } @@ -1869,6 +1872,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) INIT_DELAYED_WORK(&hub->leds, led_work); INIT_DELAYED_WORK(&hub->init_work, NULL); INIT_WORK(&hub->events, hub_event); + INIT_LIST_HEAD(&hub->onboard_hub_devs); spin_lock_init(&hub->irq_urb_lock); timer_setup(&hub->irq_urb_retry, hub_retry_irq_urb, 0); usb_get_intf(intf); @@ -1889,8 +1893,11 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) usb_autopm_get_interface_no_resume(intf); } - if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) + if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) { + onboard_hub_create_pdevs(hdev, &hub->onboard_hub_devs); + return 0; + } hub_disconnect(intf); return -ENODEV; diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 22ea1f4f2d66..ccf90052d12a 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -73,6 +73,7 @@ struct usb_hub { spinlock_t irq_urb_lock; struct timer_list irq_urb_retry; struct usb_port **ports; + struct list_head onboard_hub_devs; }; /**