Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp339589pxf; Thu, 25 Mar 2021 05:31:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybGh84QSIuucH9kVuYq0Gu2wJkIA+gsowC74fG36GbzwyqQFomqNCmOw2Bsnxuk2bssv5E X-Received: by 2002:a17:906:f88a:: with SMTP id lg10mr9410429ejb.39.1616675460933; Thu, 25 Mar 2021 05:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616675460; cv=none; d=google.com; s=arc-20160816; b=NEsz5z+FC4EAHJl/MjqjIUvTySRvXhHw8fHU6+Z4LHPMJbaMsQ+aYhY4TyPDq0klCu S5xXpKIuTVQKYz+Qi023TxCtdISIf3M8DMLvNVLP5aNmb5azRVR9XvAIYZGbQ8rJV0Qg b8gT72OKlvYDXk9JVpI+Rpr6mCbCAVnKdXbtXRn7PGHbe4BUefIhPJkBBUk40uk7pYgm iXK2X9H4bohteBve5XMlL4YDwO6Y2cJ16+XOUa+c8iH3D6S7YKfeXR0Kwbk0nVWrrFbz wdUJpn7vWzDT1TkTfK6ByPWfwy+dJCEafua26M0l7u+Cktq674LztR2mETiKhHIAjvtb KwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=MQHaecDoaJDcFxo1gAOgI2H5G3uqKDr6HbE3wNSCobc=; b=ohAzY9sZApiFd8ggwV/GEXebbGy3Ve9ThhEMlZ3pXHnIgksgsf6U12k+BnLp3jWbg/ E+wlWy8ssvUNDA5RRKEQh81he5hnO8p7o9HbiSV7PaDoc2lfAydGQW+WpbWH7RtgQyvI Oxp43TyZuHDcMAFoXjAynhNoQmZKJJwPa6ur5X7vE4pMnW8XXRmdflC1DhYbCxoYworL OxaEwb3djySQg7VJyS4Js7tkWm2D8vE2YYXcU8TGGgWV7xwSw5mRVmo4s1vrzFqay8Bb onnrWtD4wArY+Gms8XK9SX6cDyS1K7EREamvYHHKWGvcRQded+mlXqgHGLDa8Vl4WgaK AVRQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si5473154edc.478.2021.03.25.05.30.38; Thu, 25 Mar 2021 05:31:00 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbhCYM3l (ORCPT + 99 others); Thu, 25 Mar 2021 08:29:41 -0400 Received: from mga17.intel.com ([192.55.52.151]:31183 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbhCYM3V (ORCPT ); Thu, 25 Mar 2021 08:29:21 -0400 IronPort-SDR: H+7PHIJYjgzXoSA3SjikI4do9GEpCH+fvd+dmYbvbfC/EQ4f+wi8i23BBsmbCi6/GmuTkW8y4L ORbjywBTKKWg== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="170895486" X-IronPort-AV: E=Sophos;i="5.81,277,1610438400"; d="scan'208";a="170895486" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2021 05:29:21 -0700 IronPort-SDR: DSezglEutuuQu6AWdxkFGNxke/t+lsxtOKUPD9GeinvP3zhY437MN9ypIgOule3NlFqRAgaHVs 3BiVJssR5e/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,277,1610438400"; d="scan'208";a="514623149" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Mar 2021 05:29:19 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: Benson Leung , Prashant Malani , Guenter Roeck , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] usb: typec: Declare the typec_class static Date: Thu, 25 Mar 2021 15:29:23 +0300 Message-Id: <20210325122926.58392-4-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210325122926.58392-1-heikki.krogerus@linux.intel.com> References: <20210325122926.58392-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is only to make the handling of the class consistent with the two other susbsystems - the alt mode bus and the mux class. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/class.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 5fa279a96b6ef..d3e1002386357 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -17,7 +17,11 @@ #include "class.h" static DEFINE_IDA(typec_index_ida); -static struct class *typec_class; + +static struct class typec_class = { + .name = "typec", + .owner = THIS_MODULE, +}; /* ------------------------------------------------------------------------- */ /* Common attributes */ @@ -551,7 +555,7 @@ typec_register_altmode(struct device *parent, /* Plug alt modes need a class to generate udev events. */ if (is_typec_plug(parent)) - alt->adev.dev.class = typec_class; + alt->adev.dev.class = &typec_class; ret = device_register(&alt->adev.dev); if (ret) { @@ -815,7 +819,7 @@ struct typec_partner *typec_register_partner(struct typec_port *port, partner->identity = desc->identity; } - partner->dev.class = typec_class; + partner->dev.class = &typec_class; partner->dev.parent = &port->dev; partner->dev.type = &typec_partner_dev_type; dev_set_name(&partner->dev, "%s-partner", dev_name(&port->dev)); @@ -967,7 +971,7 @@ struct typec_plug *typec_register_plug(struct typec_cable *cable, ida_init(&plug->mode_ids); plug->num_altmodes = -1; plug->index = desc->index; - plug->dev.class = typec_class; + plug->dev.class = &typec_class; plug->dev.parent = &cable->dev; plug->dev.type = &typec_plug_dev_type; dev_set_name(&plug->dev, "%s-%s", dev_name(cable->dev.parent), name); @@ -1132,7 +1136,7 @@ struct typec_cable *typec_register_cable(struct typec_port *port, cable->identity = desc->identity; } - cable->dev.class = typec_class; + cable->dev.class = &typec_class; cable->dev.parent = &port->dev; cable->dev.type = &typec_cable_dev_type; dev_set_name(&cable->dev, "%s-cable", dev_name(&port->dev)); @@ -1986,7 +1990,7 @@ struct typec_port *typec_register_port(struct device *parent, port->prefer_role = cap->prefer_role; device_initialize(&port->dev); - port->dev.class = typec_class; + port->dev.class = &typec_class; port->dev.parent = parent; port->dev.fwnode = cap->fwnode; port->dev.type = &typec_port_dev_type; @@ -2049,11 +2053,9 @@ static int __init typec_init(void) if (ret) goto err_unregister_bus; - typec_class = class_create(THIS_MODULE, "typec"); - if (IS_ERR(typec_class)) { - ret = PTR_ERR(typec_class); + ret = class_register(&typec_class); + if (ret) goto err_unregister_mux_class; - } return 0; @@ -2069,7 +2071,7 @@ subsys_initcall(typec_init); static void __exit typec_exit(void) { - class_destroy(typec_class); + class_unregister(&typec_class); ida_destroy(&typec_index_ida); bus_unregister(&typec_bus); class_unregister(&typec_mux_class); -- 2.30.2