Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3437260pxf; Mon, 29 Mar 2021 02:06:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5kpNJddHK8ioyinuVAuHm2nxIbYei8R3wg3x6+ODmeRimOJUs6SS8ROnsQrnK1Hs/rVsN X-Received: by 2002:a17:906:29c3:: with SMTP id y3mr26460535eje.430.1617008803616; Mon, 29 Mar 2021 02:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617008803; cv=none; d=google.com; s=arc-20160816; b=XeU910MxGsRUkmzIOb6CMBQjpe+CNuP3C/ohNtswvYSIUwK4XwL8lstLMbKEiVXUGK lWuG3yCfFmxWMHO99oBIMNTL5N/M5xt9AqO5AketX33S1BjSSOg4DZRCb4SlycXvy5pG sh+Yxhnoe3ZB9wpUgktl+61srrb7eAfos3LnBpBaSwwO11BjpXXmDHkF5/LSGGsVAMtO ZcPUYN+JBVUC/zD+QBbbDcqYFh+7EuFLcvoYqxk9MyTk1KyMqJ75JLBXhCbUpVuZD8DU s+LAJ6te7VZnaJXSUas/6Z+IMzuji1E89rpB4vSGp22koNEbpNs3LePVL5Z7RgW5B+R3 Lt5w== 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=rbLbSSpBzPVAcx14iybQJrDwZW6MtrifGMGfKJ6tijtAQJ+0OyOQT7i8pHOSslDlGt SnIgG6RRaqxwXrK6slP6tcVwXO5fuooF6ejhQuNf8qek2v5C035bjmK0U+w4T0MjsetT MX+MMQU7xjV2EPKm+LfEQjJIi2URvpg8z12SlnjWCiNwJiDOpHQgvcGXfMJG9/I3A83f R96952RPkrB2FghiNfSBwfJzsL0gLlpHeQTeeuVcfTuYJp/rTMmHbZO8GbmQ5mSc4WnQ jFC141pzUcYHZBd0D1iQzJA28mJ0ZadbTiD99Df6gx28eJWtIHYyOhTjDru5kx3TxfGJ wcpw== 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 i17si15464767ejo.365.2021.03.29.02.06.20; Mon, 29 Mar 2021 02:06:43 -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 S232000AbhC2JEu (ORCPT + 99 others); Mon, 29 Mar 2021 05:04:50 -0400 Received: from mga06.intel.com ([134.134.136.31]:14122 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234874AbhC2IoY (ORCPT ); Mon, 29 Mar 2021 04:44:24 -0400 IronPort-SDR: B/UvlM9Spu1CUCRr3GjofPm8nPPz8FqthccTrQxWcfAYt/2POmRtiQ0MMhPz1DghZOYcDJnZeP t0hEuBt8Ae3A== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="252854828" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="252854828" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 01:44:20 -0700 IronPort-SDR: OwdVY7bEpo4j2ZTORj3PppNEXnvgXRQUDgJWFC/4Nj6sEliOnUuBP+iqQv9/gP4MWdoZzQ0IF4 fWkuEbuSKKrg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515918690" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 01:44:17 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: Alan Stern , Benson Leung , Prashant Malani , Guenter Roeck , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] usb: typec: Declare the typec_class static Date: Mon, 29 Mar 2021 11:44:22 +0300 Message-Id: <20210329084426.78138-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329084426.78138-1-heikki.krogerus@linux.intel.com> References: <20210329084426.78138-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