From patchwork Tue Feb 2 12:50:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 375775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E8CAC433DB for ; Tue, 2 Feb 2021 12:53:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D429F64F4E for ; Tue, 2 Feb 2021 12:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231812AbhBBMxr (ORCPT ); Tue, 2 Feb 2021 07:53:47 -0500 Received: from mga14.intel.com ([192.55.52.115]:18020 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbhBBMxm (ORCPT ); Tue, 2 Feb 2021 07:53:42 -0500 IronPort-SDR: XSPcDy+VFKmjoVfF4hmNjDn8Q1ZyUXwHKqGcw+pPq1xAm2jMnGW6WvFl1dmeDFllDzNdbk0FE0 3m8aI9aOk6UQ== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070665" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070665" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:42 -0800 IronPort-SDR: 4C25tBqAZLmxJskvaOnYxprVRBMu06DXhiX1RIG9KjYQXMWYvz/uah29/LE84XffqDjQf8jJ8v ow/G/KYLR0iw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741040" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:40 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 3/6] usb: dwc3: haps: Constify the software node Date: Tue, 2 Feb 2021 15:50:29 +0300 Message-Id: <20210202125032.64982-4-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org What platform_device_add_properties() does is it allocates dynamically a software node that will contain the device properties supplied to it, and then couples that node with the device. Since that node is always created, it might as well be constant. Signed-off-by: Heikki Krogerus --- drivers/usb/dwc3/dwc3-haps.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-haps.c b/drivers/usb/dwc3/dwc3-haps.c index 55b4a901168e8..a0f046855a233 100644 --- a/drivers/usb/dwc3/dwc3-haps.c +++ b/drivers/usb/dwc3/dwc3-haps.c @@ -33,6 +33,10 @@ static const struct property_entry initial_properties[] = { { }, }; +static const struct software_node dwc3_haps_swnode = { + .properties = initial_properties, +}; + static int dwc3_haps_probe(struct pci_dev *pci, const struct pci_device_id *id) { @@ -77,7 +81,7 @@ static int dwc3_haps_probe(struct pci_dev *pci, dwc->pci = pci; dwc->dwc3->dev.parent = dev; - ret = platform_device_add_properties(dwc->dwc3, initial_properties); + ret = device_add_software_node(&dwc->dwc3->dev, dwc3_haps_swnode); if (ret) goto err; @@ -91,6 +95,7 @@ static int dwc3_haps_probe(struct pci_dev *pci, return 0; err: + device_remove_software_node(&dwc->dwc3->dev); platform_device_put(dwc->dwc3); return ret; } @@ -99,6 +104,7 @@ static void dwc3_haps_remove(struct pci_dev *pci) { struct dwc3_haps *dwc = pci_get_drvdata(pci); + device_remove_software_node(&dwc->dwc3->dev); platform_device_unregister(dwc->dwc3); }